-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtestbot.js
65 lines (49 loc) · 1.63 KB
/
testbot.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
63
64
65
// dependencies
var _ = require('lomath')
var scraper = require('reqscraper');
var req = scraper.req;
// Test bot
var fs = require('fs');
// var bot = require(__dirname+'/API.js');
// var Alice = new bot('your-bot-token');
// get your chat_id from here
// Alice.getUpdates().then(console.log)
// try sending a message, and log the HTTP call for confirmation
// Alice.sendMessage('your-chat-id', 'Hey wanna see some cool art?').then(console.log);
// Alice.sendPhoto('your-chat-id', fs.createReadStream(__dirname+'/alexiuss.jpg'), 'Chronoscape by Alexiuss').then(console.log)
// var kb = {
// keyboard: [
// ['one'],
// ['two', 'three'],
// ['four', 'five', 'six']
// ],
// one_time_keyboard: true
// };
// Alice.sendMessage('your-chat-id', "Choose a lucky number", undefined, undefined, kb)
// A test bot (req) to send sample message to the main bot
var testopt = {
method: 'POST',
url: 'http://localhost:8443',
formData: _.flattenJSON({
"update_id": 734575200,
"message": {
"message_id": 14,
"from": {
"id": 86953862,
"first_name": "your name",
"last_name": "your lastname",
"username": "your username",
},
"chat": {
"id": 86953862,
"first_name": "your name",
"last_name": "your lastname",
"username": "your username",
},
"date": 1435524670,
"text": "\/td aapl,goog"
}
})
}
// send test call
// req(testopt).then(console.log)