1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-13 00:26:53 -05:00

v0.19.0 added quiet mode

This commit is contained in:
Zac Herd 2016-12-03 00:55:49 +00:00
parent f944fad7ea
commit c59eaf0a01

14
bot.py
View File

@ -31,7 +31,7 @@ from secret import token, lfmkey
# CONFIGURATION
# bot version
version = "v0.18.1"
version = "v0.19.0"
# text shown by .help command
helptext = """I am a Discord bot written in Python
@ -64,6 +64,9 @@ if os.path.isfile('hist.json'):
with open('hist.json', 'r') as fp:
history = json.load(fp)
# quiet modes
quiet = {}
# this instance of the Discord client
client = discord.Client()
@ -337,6 +340,13 @@ def on_message(message):
# send response
response = out.decode('utf-8').strip()
elif message.content.startswith('.quiet'):
quiet[message.server.id] = 1
elif message.content.startswith('.loud'):
if message.server.id in quiet:
quiet.pop(message.server.id, None)
# Stuff that happens when message is not a bot command:
else:
# log each message against users
@ -363,7 +373,7 @@ def on_message(message):
yield from client.add_reaction(message, '\N{PERSON WITH FOLDED HANDS}')
# send response to channel if needed:
if response is not '':
if response is not '' and message.server.id not in quiet:
for attempt in range(5):
try:
yield from client.send_message(message.channel, response)