forked from go-telegram-bot-api/telegram-bot-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSpring
More file actions
79 lines (48 loc) · 2.18 KB
/
Copy pathSpring
File metadata and controls
79 lines (48 loc) · 2.18 KB
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
from typing import Final
from telegram import Update
from telegram.ext import Applicatian, CommandHandler, MessageHandler, filters, ContextTypes
TOKEN: Final s '7395438952:AAH9nmk5X59x2_3700k9vdZpRVRThV0Zxxw"
BOT_USERNAME: Final = '@Sprinklezweedcbdbot'
async def start_comand(update: updates, context: contextTypes, DEFAULT_TYPE):
await update.message.reply_text("Hello! Thankcs for connecting with me us we are going to get back to you!")
async def start_comand(update: updates, context: contextTypes, DEFAULT_TYPE):
await update.message.reply_text("Hello! Thankcs for connecting with me us we are going to get back to you!")
async def start_comand(update: updates, context: contextTypes, DEFAULT_TYPE):
await update.message.reply_text("Hello! Thankcs for connecting with me us we are going to get back to you!")
#Responses
def handle_response(text: str) -> str:
if 'hello' in processed:
return "Hey there!'
if 'how are you* in processed:
return 'I am good!'
if '1 love python' in processed:
return `Remember to subscribe!'
message_type: str m update.message.chat.type
message_type: str m update.message.chat.type
text: str = update.message.text
print(f'User (update.message.chat.id)) in (message_type): "(text)"")
if message_type= 'group':
if B0T_USERNAME in text:
new._text: str " text.replace(BOT_USERNAME, "').strip()
response: str = handle_response(new_text)
else:
return
else:
response; str = handle_response(text)
print('Bot:", response)
await update.message.reply_text(response)
async def error (update: Update, context: ContextTypes.DEFAULT_TYPE):
print(f"Update f(update) caused error (context.error)')
if _name_ '_main_:
app = Application.builder().token(7353192801:AAEwWtHEhA04SzEvYgKT2W4ww6tiEeIuUqY ).build()
#Commands
app.add_handler(CommandHandler('start',start_command))
app.add_handler(CommandHandler('help',help_command))
app.add_handler(CommandHandler('costum',costum_command))
#Messages
app.add_handler(MessageHandler(Filter,Text,handler_message))
#Error
app.add.error.handler(error)
#Pull the bot
print('Pulling....')
app.run_pulling(pull_interval=5)