FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pyTelegramBotAPI/examples/echo_bot.py at master · KemamanWebTech/pyTelegramBotAPI · GitHub
KemamanWebTech
pyTelegramBotAPI
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pyTelegramBotAPI
/
examples
/
echo_bot.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (18 loc) · 699 Bytes
Breadcrumbs
pyTelegramBotAPI
/
examples
/
echo_bot.py
Copy path
File metadata and controls
28 lines (18 loc) · 699 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
import
telebot
API_TOKEN
=
'<api_token>'
bot
=
telebot
.
TeleBot
(
API_TOKEN
)
# Handle '/start' and '/help'
@
bot
.
message_handler
(
commands
=
[
'help'
,
'start'
])
def
send_welcome
(
message
):
bot
.
reply_to
(
message
,
"""
\
Hi there, I am EchoBot.
I am here to echo your kind words back to you. Just say anything nice and I'll say the exact same thing to you!
\
"""
)
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@
bot
.
message_handler
(
func
=
lambda
message
:
True
)
def
echo_message
(
message
):
bot
.
reply_to
(
message
,
message
.
text
)
bot
.
polling
()
Back
|
FazBrowse Home
|
New Git URL