Merged in decide (pull request #23)
moving decide into it s own module Approved-by: Luke Robles <lukelrobles@gmail.com>
This commit is contained in:
commit
79abcc7988
11
app/decide.py
Normal file
11
app/decide.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import random
|
||||||
|
import help_methods
|
||||||
|
|
||||||
|
def get_decide_choice(decide):
|
||||||
|
choices = decide.replace('!decide', '' ).lstrip().split(' or ')
|
||||||
|
if len(choices) > 1:
|
||||||
|
return random.choice(choices)
|
||||||
|
elif '' in choices:
|
||||||
|
return help_methods.get_help_message('decide')
|
||||||
|
else:
|
||||||
|
return random.choice(["yes", "no"])
|
@ -3,6 +3,7 @@ import sys
|
|||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import decide
|
||||||
import eight_ball
|
import eight_ball
|
||||||
import excuse
|
import excuse
|
||||||
import define_word
|
import define_word
|
||||||
@ -174,14 +175,11 @@ async def on_message(message):
|
|||||||
# await client.send_message(message.channel, 'Deleted {} message(s)'.format(len(deleted)))
|
# await client.send_message(message.channel, 'Deleted {} message(s)'.format(len(deleted)))
|
||||||
|
|
||||||
if message.content.startswith('!decide'):
|
if message.content.startswith('!decide'):
|
||||||
choices = message.content.replace('!decide', '').lstrip().split(' or ')
|
await client.send_message(message.channel,
|
||||||
if len(choices) > 1:
|
"{} {}".format(message.author.mention,
|
||||||
####### debug ###########
|
decide_method.get_decide_choice(message.content)))
|
||||||
# await client.send_message(message.channel, "I see {} choices, {}".format(len(choices), 'and '.join(choices)))
|
|
||||||
print("{} has initated a decide between {}".format(message.author, choices))
|
|
||||||
await client.send_message(message.channel, "{} {}".format(message.author.mention, random.choice(choices)))
|
|
||||||
else:
|
|
||||||
await client.send_message(message.channel, "{} {}".format(message.author.mention, random.choice(['yes', 'no'])))
|
|
||||||
|
|
||||||
if message.content.startswith('!cleanup') and message.author.id == '144986109804412928':
|
if message.content.startswith('!cleanup') and message.author.id == '144986109804412928':
|
||||||
def is_bot(m):
|
def is_bot(m):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user