Telegram bot #150
14
bin/telegram_bot.js
Normal file → Executable file
14
bin/telegram_bot.js
Normal file → Executable file
@ -118,14 +118,18 @@ bot.command("log", ctx => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Live Log User
|
// Live Log User
|
||||||
|
global.LiveLog = [];
|
||||||
bot.command("live_log", ctx => {
|
bot.command("live_log", ctx => {
|
||||||
const option = ctx.message.text.replace("/platform", "").trim();
|
const option = ctx.message.text.replace("/platform", "").trim();
|
||||||
if (/enable/.test(option)) {
|
if (/enable/.test(option)) {
|
||||||
SaveID(ctx.from.id)
|
global.LiveLog.push(ctx);
|
||||||
console.log(GetID())
|
ctx.reply("Sucess");
|
||||||
} else if (/disable/.test(option)) {
|
} else if (/disable/.test(option)) {
|
||||||
RemoveID(ctx.from.id)
|
// ctx.from.id
|
||||||
console.log(GetID())
|
for (let ctx_Logs in global.LiveLog) {
|
||||||
|
if (global.LiveLog[ctx_Logs].from.id === ctx.from.id) delete global.LiveLog[ctx_Logs];
|
||||||
|
global.LiveLog = global.LiveLog.filter(a=>a);
|
||||||
|
ctx.reply("Ok");
|
||||||
} else ctx.reply("Invalid option")
|
} else ctx.reply("Invalid option")
|
||||||
ctx.reply(ctx.chat.id)
|
ctx.reply(ctx.chat.id)
|
||||||
})
|
})
|
||||||
@ -135,4 +139,4 @@ bot.catch(console.log);
|
|||||||
|
|
||||||
// End And Lauch
|
// End And Lauch
|
||||||
process.on("exit", bot.stop)
|
process.on("exit", bot.stop)
|
||||||
bot.launch()
|
bot.launch()
|
||||||
|
Reference in New Issue
Block a user