Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F132870
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/main.py b/main.py
index 99ec8f3..3f15637 100644
--- a/main.py
+++ b/main.py
@@ -1,21 +1,34 @@
import sys
import time
import telepot
#fetching our BOT_TOKEN
BOT_TOKEN = sys.argv[1]
+
+
def chat_handler(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
if content_type == 'text':
if "hendrik" in (msg['text'].lower()):
bot.sendMessage(chat_id, 'Who the fuck is Hendrik?', reply_to_message_id=msg['message_id'])
print "Trigger Phrase Detected: \n Message Text: {}".format(msg['text'])
+def edit_handler(msg):
+ content_type, chat_type, chat_id = telepot.glance(msg)
+
+ if content_type == 'text':
+ if "hendrik" in (msg['text'].lower()):
+ bot.sendMessage(chat_id, 'Your sneaky edits do not work on me. Who the fuck is Hendrik?', reply_to_message_id=msg['message_id'])
+
+ print "Trigger Phrase Detected (EDITED MESSAGE): \n Message Text: {} \n Sender: {} \n ".format(msg['text'], msg['from'])
+
+
#make our bot and feed it the token
bot = telepot.Bot(BOT_TOKEN)
#fetch messages and keep script looped
-bot.message_loop({'chat' :chat_handler},
+bot.message_loop({'chat' : chat_handler,
+ 'edited_chat' : edit_handler },
run_forever="Bot Running...")
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jun 16, 1:05 AM (2 w, 21 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69842
Default Alt Text
(1 KB)
Attached To
Mode
R41 JanBot
Attached
Detach File
Event Timeline