mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-29 01:15:58 +00:00
Made stats admin-only
This commit is contained in:
parent
42399712da
commit
74176098fc
@ -3,7 +3,7 @@ module.exports = function(bot, msg) {
|
|||||||
const lynxFullPhoto = 'https://graph.org/file/a77382dab4d62ba626806.jpg';
|
const lynxFullPhoto = 'https://graph.org/file/a77382dab4d62ba626806.jpg';
|
||||||
|
|
||||||
const message = `*Hello! I'm Lynx!*\n\nI'm a simple bot made entirely from scratch in Node.js by Lucas Gabriel (lucmsilva).\n\n` +
|
const message = `*Hello! I'm Lynx!*\n\nI'm a simple bot made entirely from scratch in Node.js by Lucas Gabriel (lucmsilva).\n\n` +
|
||||||
`I am running on a *GitHub Codespaces* server (see /stats), so please refrain from overusing or spamming the bot!\n\n` +
|
`I am running on a *GitHub Codespaces* server, and sometimes may I am off, so please refrain from overusing or spamming the bot!\n\n` +
|
||||||
`*Some commands to test:*
|
`*Some commands to test:*
|
||||||
• */chatinfo* - send some information about the group
|
• */chatinfo* - send some information about the group
|
||||||
• */customize* - customize your pronouns (WIP)
|
• */customize* - customize your pronouns (WIP)
|
||||||
@ -13,7 +13,6 @@ module.exports = function(bot, msg) {
|
|||||||
• */privacy* - read the Privacy Policy
|
• */privacy* - read the Privacy Policy
|
||||||
• */random* - pick a random number between 0-10
|
• */random* - pick a random number between 0-10
|
||||||
• */start* - start the bot
|
• */start* - start the bot
|
||||||
• */stats* - show where the bot is running
|
|
||||||
• */whois* - send some information about yourself\n\n` +
|
• */whois* - send some information about yourself\n\n` +
|
||||||
`*See my source code in:* [GitHub Repository](https://github.com/lucmsilva651/lynx)\n\n` +
|
`*See my source code in:* [GitHub Repository](https://github.com/lucmsilva651/lynx)\n\n` +
|
||||||
`Thanks to all users, testers, contributors, and others. Without you, perhaps this bot wouldn't be possible ❤️`;
|
`Thanks to all users, testers, contributors, and others. Without you, perhaps this bot wouldn't be possible ❤️`;
|
||||||
|
@ -2,6 +2,7 @@ const os = require('os');
|
|||||||
|
|
||||||
module.exports = function (bot, msg) {
|
module.exports = function (bot, msg) {
|
||||||
const chatId = msg.chat.id;
|
const chatId = msg.chat.id;
|
||||||
|
const admins = process.env.TGBOT_ADMINS;
|
||||||
|
|
||||||
function formatUptime(uptime) {
|
function formatUptime(uptime) {
|
||||||
const hours = Math.floor(uptime / 3600);
|
const hours = Math.floor(uptime / 3600);
|
||||||
@ -43,6 +44,11 @@ module.exports = function (bot, msg) {
|
|||||||
|
|
||||||
const message = getSystemInfo();
|
const message = getSystemInfo();
|
||||||
|
|
||||||
|
const isAdmin = admins.includes(msg.from.id.toString());
|
||||||
|
if (isAdmin) {
|
||||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||||
.catch(error => console.error('WARN: Message cannot be sent:', error));
|
.catch(error => console.error('WARN: Message cannot be sent:', error));
|
||||||
};
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user