UNPKG

640 BJavaScriptView Raw
1const express = require('express');
2
3const VkBotSdk = require('../index');
4
5const main = async () => {
6 const app = express();
7
8 const sdk = new VkBotSdk({
9 debug: true,
10 group_id: 0,
11 secret: '',
12 confirmation: '',
13 access_token: ''
14 });
15
16 const bot = sdk.getCallback();
17
18 bot.defaultReply((ctx, params, next) => {
19 ctx.reply('Default reply');
20 });
21
22 app.use(express.json())
23 app.all('/callback', bot.eventsCallback);
24
25 app.listen(8000);
26};
27
28main().then(() => {
29 console.log('Initialized');
30}).catch((e) => {
31 console.error(e);
32});