Telegram bot #150

Merged
Sirherobrine23 merged 14 commits from Telegram_bot into main 2021-08-11 02:47:35 +00:00
13 changed files with 993 additions and 982 deletions
Showing only changes of commit 573accb6c5 - Show all commits

View File

@ -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()

View File

@ -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
View File

@ -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"

View File

@ -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",

View File

@ -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");