Made stats admin-only
This commit is contained in:
parent
42399712da
commit
74176098fc
2 changed files with 10 additions and 5 deletions
|
@ -2,6 +2,7 @@ const os = require('os');
|
|||
|
||||
module.exports = function (bot, msg) {
|
||||
const chatId = msg.chat.id;
|
||||
const admins = process.env.TGBOT_ADMINS;
|
||||
|
||||
function formatUptime(uptime) {
|
||||
const hours = Math.floor(uptime / 3600);
|
||||
|
@ -43,6 +44,11 @@ module.exports = function (bot, msg) {
|
|||
|
||||
const message = getSystemInfo();
|
||||
|
||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('WARN: Message cannot be sent:', error));
|
||||
};
|
||||
const isAdmin = admins.includes(msg.from.id.toString());
|
||||
if (isAdmin) {
|
||||
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||
.catch(error => console.error('WARN: Message cannot be sent:', error));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue