Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/main.py b/main.py
index 1b22af3..5c8ee37 100644
--- a/main.py
+++ b/main.py
@@ -1,64 +1,64 @@
import sys
import time
import telepot
import datetime
import commandhandler
import group_utilities
import random
#Cooldown length in seconds
cooldown_sec = 10
#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 the message contains a bot command, go tell command_handler
try:
if msg['entities'][0]['type'] == 'bot_command':
commandhandler.handler(msg, cooldown_sec, bot)
#If the message contains Hendrik, send a complaint message to sender
except KeyError:
if "hendrik" in (msg['text'].lower()):
bot.sendMessage(chat_id, 'THAT WITCH NAME IS NOT TO BE SPOKEN!', reply_to_message_id=msg['message_id'])
group_utilities.logger('hendrik', msg, False, 0, 0)
- if ' lumber' in (msg['text'].lower()) or 'lumber' == msg['text'].lower()[:len('lumber')-1]:
+ if ' lumber' in (msg['text'].lower()) or 'lumber' == msg['text'].lower()[:len('lumber')]:
if random.randint(0,1) == 1:
bot.sendMessage(chat_id, "LUMBER IS ETERNAL")
else:
bot.sendMessage(chat_id, 'THERE ARE NO BRAKES ON THE LUMBER TRAIN')
-
- if ' apple' in (msg['text'].lower()) or 'apple' == msg['text'].lower()[:len('apple')-1]:
+
+ if ' apple' in (msg['text'].lower()) or 'apple' == msg['text'].lower()[:len('apple')]:
bot.sendMessage(chat_id, "FUCK APPLE")
if 'kak dela' in (msg['text'].lower()):
bot.sendMessage(chat_id, "Harsho Spasiba", reply_to_message_id=msg['message_id'])
def edit_handler(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
try:
if msg['entities'][0]['type'] == 'bot_command':
bot.sendMessage(chat_id, "Voetsek, don't edit your commands.", reply_to_message_id=msg['message_id'])
except:
if content_type == 'text':
if "hendrik" in (msg['text'].lower()):
bot.sendMessage(chat_id, 'THAT WITCH NAME IS NOT TO BE SPOKEN! DO NOT TRY EDIT YOUR WITCHCRAFT INTO YOUR MESSAGES IN AN ATTEMPT TO EVADE ME!', reply_to_message_id=msg['message_id'])
group_utilities.logger('hendrik', msg, True, 0, 0)
def callback_query_handler(msg):
pass
#make our bot and feed it the tokenhend
bot = telepot.Bot(BOT_TOKEN)
#fetch messages and keep script looped
while 1:
bot.message_loop({'chat' : chat_handler,
'edited_chat' : edit_handler,
'callback_query' : callback_query_handler},
run_forever="Bot Running...")

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jun 17, 9:25 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70569
Default Alt Text
(2 KB)

Event Timeline