Telegram bot #150
@ -45,11 +45,9 @@ bot.command("basic", ctx => {
|
||||
try {
|
||||
const Server = bds.start();
|
||||
Server.log(function (data){
|
||||
Object.getOwnPropertyNames(GetID()).forEach(Id => {
|
||||
console.log(Id);
|
||||
if (ChatIDs[Id]) bot.telegram.sendMessage(Id, data)
|
||||
})
|
||||
})
|
||||
for (let stx of global.LiveLog) stx.reply(data);
|
||||
});
|
||||
global.ServerExec = Server;
|
||||
return ctx.reply("Server Started")
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@ -137,9 +135,13 @@ bot.command("live_log", ctx => {
|
||||
ctx.reply(ctx.chat.id)
|
||||
})
|
||||
|
||||
// text
|
||||
bot.on("message", ctx => {
|
||||
global.ServerExec.command(ctx.message.text);
|
||||
});
|
||||
|
||||
// catch
|
||||
bot.catch(console.log);
|
||||
|
||||
// End And Lauch
|
||||
process.on("exit", bot.stop)
|
||||
bot.launch()
|
||||
|
4
index.js
4
index.js
@ -2,7 +2,7 @@
|
||||
const { resolve } = require("path");
|
||||
const path = require("path")
|
||||
const fs = require("fs");
|
||||
const { randomUUID } = require("crypto");
|
||||
const randomUUID = require("uuid").v4;
|
||||
|
||||
function date(format) {
|
||||
const today = new Date(),
|
||||
@ -180,4 +180,4 @@ module.exports.tmphost = require("./lib/tempHost")
|
||||
/**
|
||||
* Load Crontab Backup
|
||||
*/
|
||||
module.exports.Cron_Loaded = CronBackups;
|
||||
module.exports.Cron_Loaded = CronBackups;
|
||||
|
3
package-lock.json
generated
3
package-lock.json
generated
@ -30,7 +30,8 @@
|
||||
"open": "^8.0.0",
|
||||
"properties-to-json": "^0.2.1",
|
||||
"request-ip": "^2.1.3",
|
||||
"telegraf": "^4.0.0"
|
||||
"telegraf": "^4.0.0",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"bin": {
|
||||
"bds_maneger": "bin/bds_maneger.js"
|
||||
|
@ -75,7 +75,8 @@
|
||||
"open": "^8.0.0",
|
||||
"properties-to-json": "^0.2.1",
|
||||
"request-ip": "^2.1.3",
|
||||
"telegraf": "^4.0.0"
|
||||
"telegraf": "^4.0.0",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.19.0",
|
||||
|
@ -2,7 +2,7 @@ const child_process = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { resolve, join } = require("path");
|
||||
const { randomUUID } = require("crypto");
|
||||
const randomUUID = require("uuid").v4;
|
||||
const { CronJob } = require("cron");
|
||||
const { GetCronBackup } = require("../lib/BdsSettings");
|
||||
const { Backup } = require("./backups");
|
||||
|
Reference in New Issue
Block a user