Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
diff --git a/.gitignore b/.gitignore
index dfb3c41..912e5b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,51 +1,51 @@
start.bat
-
+*pyc
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
diff --git a/main.py b/main.py
index 0b60455..3e85e6c 100644
--- a/main.py
+++ b/main.py
@@ -1,59 +1,66 @@
#Todo: Prevent blank /ask
import sys
import time
import telepot
import group_utilities
-from random import randrange, randint
+from random import randrange, random
#fetching our BOT_TOKEN
BOT_TOKEN = sys.argv[1]
#read phrases for stfu function
stfu_phrases = group_utilities.read_lines('stfu_phrases.txt')
-janrepsonsephrases = group_utilities.read_lines('janresponse.txt')
+response_phrases_y = (group_utilities.read_lines('response_phrases_y.txt'))
+response_phrases_n = (group_utilities.read_lines('response_phrases_n.txt'))
def command_handler(msg, content_type, chat_type, chat_id):
if msg['text'][:len('/stfu')] == '/stfu':
bot.sendMessage(chat_id, stfu_phrases[randrange(len(stfu_phrases))])
if msg['text'][:len('/ask')] == '/ask':
- if len(msg['text']) > 15:
- bot.sendMessage(chat_id, janrepsonsephrases[randrange(len(janrepsonsephrases))], reply_to_message_id=msg['message_id'])
+ if len(msg['text']) > 15: #Is there actually a question or is it just /ask@Jannie_Bot
+ if random() > 0.5: #More
+ bot.sendMessage(chat_id, response_phrases_y[randrange(len(response_phrases_y))], reply_to_message_id=msg['message_id'])
+ else:
+ bot.sendMessage(chat_id, response_phrases_n[randrange(len(response_phrases_n))], reply_to_message_id=msg['message_id'])
+
else:
bot.sendMessage(chat_id, "Give me a question you Heretic", reply_to_message_id=msg['message_id'])
+
+
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':
command_handler(msg, content_type, chat_type, chat_id)
#If the message contains Hendrik, send a complaint message to sender
except KeyError:
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: {} \n Sender: {} \n ".format(msg['text'], msg['from']['first_name'])
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']['first_name'])
#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,
'edited_chat' : edit_handler },
run_forever="Bot Running...")
diff --git a/response_phrases_n.txt b/response_phrases_n.txt
new file mode 100644
index 0000000..8447a6b
--- /dev/null
+++ b/response_phrases_n.txt
@@ -0,0 +1,10 @@
+You know the fucking answer is no, so fuckoff
+Nee
+Nein
+Fuck no
+Nie
+Why the actual fuck?
+Нет
+Never
+Probability of that ever happening is 1 against 314159265359
+нет никакого способа, которым будет происходить
diff --git a/response_phrases_y.txt b/response_phrases_y.txt
new file mode 100644
index 0000000..67edf74
--- /dev/null
+++ b/response_phrases_y.txt
@@ -0,0 +1,10 @@
+Obviously
+You know the answer is yes
+JA
+Fuck yes
+Awe yeah
+да
+Of Course
+It's an obvious yes, you fucking Frank
+This answer is True
+да я так считаю

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jun 16, 12:03 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70170
Default Alt Text
(4 KB)

Event Timeline