Skip to content
This repository was archived by the owner on Aug 25, 2023. It is now read-only.

Commit c094f3d

Browse files
committed
Webhooks for RedditLiveBot
1 parent 6111879 commit c094f3d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

examples/redditlivebot/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const nodeogram = require('nodeogram'),
33
WebSocketClient = require('websocket').client,
44
config = require('./config.json'),
5-
bot = new nodeogram.Bot(config.token, {profiles_path: __dirname + '/profiles.json', enableHelp: true}),
5+
bot = new nodeogram.Bot(config.token, {profiles_path: __dirname + '/profiles.json', enableHelp: true, useWebhooks: config.useWebhooks, webhookPort: config.webhookPort, webhookRoute: config.webhookRoute}),
66
request = require('superagent-promise')(require('superagent'), Promise);
77

88
var threads = {}, // thread_id: [user_id, ...]
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"token": "SOMETHING"
2+
"token": "SOMETHING",
3+
"useWebhooks": true,
4+
"webhookPort": 8080,
5+
"webhookRoute": "/"
36
}

lib/Bot.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function Bot(token, options) {
2727
this.saveUsers = true;
2828
this.saveChats = true;
2929
this.enableHelp = true;
30-
this.debug = true;
3130
this.forms = {}; // user_id: {form, answers}
3231
this.webhookRoute = '/';
3332
this.webhookPort = 8080;
@@ -87,9 +86,7 @@ function Bot(token, options) {
8786
};
8887

8988
this.handleUpdates = (updates) => {
90-
if (this.debug){
91-
console.log(JSON.stringify(updates));
92-
}
89+
console.log(JSON.stringify(updates));
9390
if (updates.length > 0) {
9491
this.lastUpdate = updates[updates.length - 1].update_id + 1;
9592
var now = Date.now() / 1000;

0 commit comments

Comments
 (0)