Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wlstp8473
/
telegram_Messenger_Chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
wlstp8473
2021-05-16 00:26:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
55648aa26dbcd5a88af3a1bf268165e1f7f5d4ac
55648aa2
1 parent
72caaa6c
respond.py
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
respond.py
respond.py
0 → 100644
View file @
55648aa
# https://blog.psangwoo.com/coding/2018/01/09/python-telegram-bot-3.html
from
telegram.ext
import
Updater
,
MessageHandler
,
Filters
updater
=
Updater
(
token
=
"1721885449:AAHDGMbjSJfhXxML6nfSCpfiU7SghpL_vOE"
)
updater
=
Updater
(
token
=
"1721885449:AAHDGMbjSJfhXxML6nfSCpfiU7SghpL_vOE"
,
use_context
=
True
)
dispatcher
=
updater
.
dispatcher
updater
.
start_polling
()
#def greet_user(`update: Update, context: CallbackContext`):
def
handler
(
update
,
context
):
text
=
update
.
message
.
text
chat_id
=
update
.
message
.
chat_id
if
"모해"
in
text
:
update
.
message
.
reply_text
(
"진세 생각 ❤"
)
elif
'ㅎㅎ'
in
text
:
update
.
message
.
reply_text
(
"ㅎㅎ"
)
elif
'밥 먹었어?'
in
text
:
update
.
message
.
reply_text
(
"나 아직 못 먹었어 ㅠㅠ, 진세는 밥 먹었어?"
)
elif
'먹었어'
in
text
:
update
.
message
.
reply_text
(
"우왕 뭐 먹었어?"
)
elif
'안 먹었엉'
in
text
:
update
.
message
.
reply_text
(
"헐헐 어쩌다?, 같이 뭐라도 먹을래?"
)
elif
'같이 먹자'
in
text
:
update
.
message
.
reply_text
(
"웅웅 집앞으로 나와"
)
elif
'사랑해'
in
text
:
update
.
message
.
reply_text
(
"내가 더 사랑해 ❤"
)
elif
'잘자'
in
text
:
update
.
message
.
reply_text
(
"웅웅, 진세 너두 잘자 ㅎㅎ"
)
else
:
update
.
message
.
reply_text
(
"응?"
)
echo_handler
=
MessageHandler
(
Filters
.
text
,
handler
)
#업데이터를 통해서 필터된 텍스트가 """핸들러로 전달됨"""
dispatcher
.
add_handler
(
echo_handler
)
Please
register
or
login
to post a comment