telegram Command Enable #5

Merged
Sirherobrine23 merged 2 commits from Telegram_Bot_Commands into main 2020-12-30 15:10:56 +00:00
Showing only changes of commit 3c8fe27782 - Show all commits

View File

@@ -2,14 +2,28 @@ const { Telegraf } = require('telegraf')
const token = require('../../index').token
const bot = new Telegraf(token)
bot.start((ctx) => {
ctx.reply(`Hello ${ctx.message.from.username}\nWe have some things still being done in the programming of the new bot more works 👍:\n\nCommands:\n/server_start\n/server_stop\n/server_restart\n/log\n/command: Commands are not working in this version, wait until it is broken\n\nThe messages are re-transmitted to the minecraft chat if it is already connected: ✔\nMessage Control: ❌`)
const amenssagem = `Hello ${ctx.message.from.username}
We have some things still being done in the programming of the new bot more works 👍:
Commands:
/server_start
/server_stop
/server_restart
/log
/command: Commands are not working in this version, wait until it is broken
The messages are re-transmitted to the minecraft chat if it is already connected: ✔
Message Control: ❌`
ctx.reply(``)
})
bot.help((ctx) => ctx.reply('Use o/start'))
bot.action('delete', ({ deleteMessage }) => deleteMessage())
bot.command('server_start', (ctx) => {
if (require('./check').checkUser(ctx.message.from.username)){
console.log('Sucess')
ctx.reply(`Under maintenance ${ctx.message.from.username}`)
const bds_status = require('../../index').detect()
if (!bds_status){
require('../../index').start()
ctx.reply(`The server has started`)
} else
ctx.reply(`${ctx.message.from.username} already started`)
} else {
console.log('Erro');
ctx.reply(`Please contact the Server Administrator, You are not on the list, I count to add your username \(${ctx.message.from.username}\) on the whitelist`)