-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (34 loc) · 1.29 KB
/
index.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
const bot = require("./bot");
const associations = require("./models/assotiations");
const sequelize = require("./db");
const { handleMessage, handleCallbackQuery } = require("./handlers/handlers");
associations.func();
const commands = [
{ command: "/start", description: "Начальное приветствие" },
{
command: "/info",
description: "Получить информацию обо всех доступных командах",
},
{ command: "/create", description: "Создать напоминание" },
{ command: "/id", description: "Узнать свой айди" },
{ command: "/rlist", description: "Узнать все свои напоминания" },
{ command: "/help", description: "Обратная связь с автором" },
{ command: "/weather", description: "Узнать погоду" },
];
const start = async () => {
try {
await sequelize.authenticate();
await sequelize.sync();
console.log("Connection has been established successfully.");
} catch (error) {
console.error("Unable to connect to the database:", error);
}
bot.setMyCommands(commands);
bot.on("message", (msg) => {
handleMessage(msg, bot, commands);
});
bot.on("callback_query", (msg) => {
handleCallbackQuery(msg);
});
};
start();