-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
48 lines (31 loc) · 1.31 KB
/
main.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
#!/usr/bin/env python3
from telegram.ext import *
import responses as R
from random import randrange
import sys
sys.path.append(r'D:\\condatr\\envs\\telegram_bot\\python39.zip')
API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
print("Bot started..")
def start_command(update,context):
update.message.reply_text("type something to start")
def help_command(update,context):
update.message.reply_text("Temel iletisim, kripto fiyat sorgulama, hava durumu, film öneri, rastgele resim")
def print_hi(update,context):
update.message.reply_text("hello {}".format(randrange(999)))
def handle_message(update, context):
text = str(update.message.text).lower()
response = R.sample_responses(text)
update.message.reply_text(response)
def error(update, context):
print("Update {} caused error {}").format(update, context.error)
def main():
updater = Updater(API_KEY)
dp = updater.dispatcher
dp.add_handler(CommandHandler("start", start_command))
dp.add_handler(CommandHandler("help", help_command))
dp.add_handler(CommandHandler("teragron", print_hi))
dp.add_handler(MessageHandler(Filters.text, handle_message))
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
main()