-
Notifications
You must be signed in to change notification settings - Fork 0
/
tgterminal.js
62 lines (53 loc) · 1.91 KB
/
tgterminal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import TelegramBot from "node-telegram-bot-api";
import fs from "fs";
import { config } from "./config.js";
const bot = new TelegramBot(config.TOKENs[2], { polling: false });
const qu1z3xId = "923690530";
async function sendDataAboutText(chatId, firstName, text) {
await bot.sendMessage(
qu1z3xId,
`<b><a href="https://t.me/digfusionbot">⚪</a> #digfusion | Text\n\n<a href="tg://user?id=${chatId}">${firstName}</a> | </b><code>${chatId}</code>\n<blockquote><i>${text}</i></blockquote>`,
{
parse_mode: "html",
disable_notification: true,
disable_web_page_preview: true,
}
);
}
async function sendDataAboutButton(chatId, firstName, data) {
await bot.sendMessage(
qu1z3xId,
`<b><a href="https://t.me/digfusionbot">⚪</a> #digfusion | Button\n\n<a href="tg://user?id=${chatId}">${firstName}</a> | </b><code>${chatId}</code>\n<blockquote><b>[${data}]</b></blockquote>`,
{
parse_mode: "html",
disable_notification: true,
disable_web_page_preview: true,
}
);
}
async function sendDataAboutError(chatId, firstName, text) {
await bot.sendMessage(
qu1z3xId,
`<b><a href="https://t.me/digfusionbot">⚪</a> #digfusion | ⛔️ ERROR ⛔️\n\n<a href="tg://user?id=${chatId}">${firstName}</a> | </b><code>${chatId}</code>\n<blockquote><i>${text}</i></blockquote>`,
{
parse_mode: "html",
disable_notification: true,
disable_web_page_preview: true,
}
);
}
async function sendDataAboutDataBase(dataToSend) {
fs.writeFile("DB.json", JSON.stringify(dataToSend), (err) => {
if (err) throw err;
// Отправляем файл пользователю
bot.sendDocument(qu1z3xId, "./DB.json", {
caption: `<b><a href="https://t.me/digfusionbot">⚪</a> #digfusion | Data</b>`,
parse_mode: "HTML",
});
});
}
//? ЭКСПОРТ ФУНКЦИЙ В index.js
export { sendDataAboutButton };
export { sendDataAboutError };
export { sendDataAboutText };
export { sendDataAboutDataBase };