-
Notifications
You must be signed in to change notification settings - Fork 4
/
bot.py
358 lines (275 loc) · 10.2 KB
/
bot.py
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#!/usr/bin/env python
import os
import telebot
import logging
from telebot import types
from replies import *
from decouple import config
TOKEN = config("TOKEN")
bot = telebot.TeleBot(TOKEN, parse_mode="HTML") # You can set parse_mode by default. HTML or MARKDOWN
# logger = telebot.logger
# telebot.logger.setLevel(logging.DEBUG) # Outputs debug messages to console.
# logging.basicConfig(level=logging.DEBUG,
# format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@bot.message_handler(commands=['start'])
def send_welcome(m):
user_markup = types.ReplyKeyboardMarkup(True, True)
user_markup.row(question1,question2 )
user_markup.row(question3,question17)
user_markup.row(question4,question18)
user_markup.row(question5,question38)
user_markup.row(question6)
user_markup.row(question7)
user_markup.row(question8)
user_markup.row(question9)
user_markup.row(question10)
user_markup.row(question11)
user_markup.row(question12)
user_markup.row(question13)
user_markup.row(question14)
user_markup.row(question15)
user_markup.row(question16)
user_markup.row(question19)
user_markup.row(question20)
user_markup.row(question21)
user_markup.row(question22,question23)
user_markup.row(question24)
user_markup.row(question25)
user_markup.row(question26)
user_markup.row(question27)
user_markup.row(question28)
user_markup.row(question29)
user_markup.row(question30)
user_markup.row(question31)
user_markup.row(question32)
user_markup.row(question33)
user_markup.row(question34)
user_markup.row(question35)
user_markup.row(question36)
user_markup.row(question37)
user_markup.row(question39)
user_markup.row(question40)
cid = m.chat.id
line1 = 'Hello, I\'m Adigun 🤖! Press any button below to interact with me. You will love using me to get Blockchain information.'
msg = line1
bot.send_message(cid, msg, reply_markup=user_markup)
# main menu
@bot.message_handler(commands=['menu'])
@bot.message_handler(regexp="menu")
def main_menu(m):
user_markup = telebot.types.ReplyKeyboardMarkup(True, True)
user_markup.row(question1,question2 )
user_markup.row(question3,question17)
user_markup.row(question4,question18)
user_markup.row(question5,question38)
user_markup.row(question6)
user_markup.row(question7)
user_markup.row(question8)
user_markup.row(question9)
user_markup.row(question10)
user_markup.row(question11)
user_markup.row(question12)
user_markup.row(question13)
user_markup.row(question14)
user_markup.row(question15)
user_markup.row(question16)
user_markup.row(question19)
user_markup.row(question20)
user_markup.row(question21)
user_markup.row(question22,question23)
user_markup.row(question24)
user_markup.row(question25)
user_markup.row(question26)
user_markup.row(question27)
user_markup.row(question28)
user_markup.row(question29)
user_markup.row(question30)
user_markup.row(question31)
user_markup.row(question32)
user_markup.row(question33)
user_markup.row(question34)
user_markup.row(question35)
user_markup.row(question36)
user_markup.row(question37)
user_markup.row(question39)
user_markup.row(question40)
cid = m.chat.id
user_msg = 'Welcome to the main menu.\n please, select an option \n'
bot.send_message(cid, user_msg, reply_markup=user_markup)
# help details
@bot.message_handler(regexp="Help")
def command_help(m):
cid = m.chat.id
help_text = "Adigun 🤖: Send my creator *@Josylad* a private message if you need help with anything."
bot.send_message(cid, help_text, parse_mode='Markdown')
@bot.message_handler(regexp='^What is Blockchain$')
def send_answer(m):
user_msg = answer1
bot.reply_to(m, user_msg)
#fixing this regex part was serious work, but it works now!
@bot.message_handler(regexp='^What is blockchain software$')
def send_answer(m):
user_msg = answer2
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What Is A Private Blockchain$')
def send_answer(m):
user_msg = answer3
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What Is A Smart Contract$')
def send_answer(m):
user_msg = answer4
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is Mining$')
def send_answer(m):
user_msg = answer5
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^How does a blockchain work$')
def send_answer(m):
user_msg = answer6
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is a blockchain application$')
def send_answer(m):
user_msg = answer7
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What are the benefits of blockchain technology$')
def send_answer(m):
user_msg = answer8
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is the blockchain revolution$')
def send_answer(m):
user_msg = answer9
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is decentralized finance$')
def send_answer(m):
user_msg = answer10
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is a block in a blockchain$')
def send_answer(m):
user_msg = answer11
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is a blockchain wallet$')
def send_answer(m):
user_msg = answer12
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^How Blockchain Can Be Used In Businesses$')
def send_answer(m):
user_msg = answer13
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What are the Types of Blockchain$')
def send_answer(m):
user_msg = answer14
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Is Blockchain Hackable or Not Hackable$')
def send_answer(m):
user_msg = answer15
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is Blockchain Consensus Algorithms$')
def send_answer(m):
user_msg = answer16
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is Proof of Work$')
def send_answer(m):
user_msg = answer17
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is Proof of Stake$')
def send_answer(m):
user_msg = answer18
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What are the Key features of Blockchain$')
def send_answer(m):
user_msg = answer19
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^How Does Blockchain Work$')
def send_answer(m):
user_msg = answer20
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Is there any restriction that only a particular industry should utilize Blockchain$')
def send_answer(m):
user_msg = answer21
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is a cryptocurrency$')
def send_answer(m):
user_msg = answer22
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Why use cryptocurrency"$')
def send_answer(m):
user_msg = answer23
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^How many cryptocurrencies exist in the web$')
def send_answer(m):
user_msg = answer24
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What was the first cryptocurrency$')
def send_answer(m):
user_msg = answer25
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What are the most common cryptocurrencies$')
def send_answer(m):
user_msg = answer26
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is alternative currency$')
def send_answer(m):
user_msg = answer27
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Is it that difficult to obtain cryptocurrency coin$')
def send_answer(m):
user_msg = answer28
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is Cryptocurrency Mining$')
def send_answer(m):
user_msg = answer29
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Why should I get involved in cryptocurrency$')
def send_answer(m):
user_msg = answer30
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is a cryptocurrency wallet$')
def send_answer(m):
user_msg = answer31
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is cryptocurrency exchange and market$')
def send_answer(m):
user_msg = answer32
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^How is the cryptocurrency value determined$')
def send_answer(m):
user_msg = answer33
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What are the exciting reason for you to get involved with the digital currency$')
def send_answer(m):
user_msg = answer34
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What will be the worst part about cryptocurrencies$')
def send_answer(m):
user_msg = answer35
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Which cryptocurrency is the best to date$')
def send_answer(m):
user_msg = answer36
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Is there a fake cryptocurrency$')
def send_answer(m):
user_msg = answer37
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^Is Cryptocurrency Legal$')
def send_answer(m):
user_msg = answer38
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is the main difference between tokens and cryptocurrencies$')
def send_answer(m):
user_msg = answer39
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='^What is the difference between cryptocurrency and digital currency$')
def send_answer(m):
user_msg = answer40
bot.reply_to(m, user_msg)
@bot.message_handler(regexp='')
def send_answer(m):
user_msg = 'Hi, it seems you have entered an invalid comman, kindly use the menu or reply with "menu"'
bot.reply_to(m, user_msg)
# Upon calling this function, TeleBot starts polling the Telegram servers for new messages.
# - none_stop: True/False (default False) - Don't stop polling when receiving an error from the Telegram servers
# - interval: True/False (default False) - The interval between polling requests
# Note: Editing this parameter harms the bot's response time
# - timeout: integer (default 20) - Timeout in seconds for long polling.
bot.polling()