-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot.py
More file actions
32 lines (22 loc) · 823 Bytes
/
bot.py
File metadata and controls
32 lines (22 loc) · 823 Bytes
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
#1739013133:AAH0gFLM5zUy7JH1CQmvewE1tIH7R07xUCk
from telegram import *
from telegram.ext import *
from chatterbot import ChatBot
import analyser.reply_generator as ds
BOT_TOKEN = #<PASTE YOUR TOKEN HERE>
bot = Bot(BOT_TOKEN)
updater = Updater(BOT_TOKEN,use_context = True)
dispatcher = updater.dispatcher
chatbot = ChatBot('Quotes Bot',read_only = True, logic_adapters=[
"chatterbot.logic.BestMatch","chatterbot.logic.MathematicalEvaluation"
])
def test_function(update:Update,context:CallbackContext):
texts = str(ds.get_response(update.message.text))
print(texts)
bot.send_message(
chat_id = update.effective_chat.id,
text = texts
)
start_value = MessageHandler(filters=Filters.all, callback=test_function)
dispatcher.add_handler(start_value)
updater.start_polling()