From 5b26e39cc76bee40d2bd5c2216f2460fe2010d37 Mon Sep 17 00:00:00 2001 From: pocketjawa Date: Thu, 2 Mar 2017 12:21:56 -0500 Subject: [PATCH] Added Magic 8ball and Magic Conch Shell commands --- helpcommand.txt | 4 +++- lists/8ball_responses.txt | 20 ++++++++++++++++++++ pocketbot.py | 20 ++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 lists/8ball_responses.txt diff --git a/helpcommand.txt b/helpcommand.txt index 0322fd7..e6e5772 100644 --- a/helpcommand.txt +++ b/helpcommand.txt @@ -15,4 +15,6 @@ **!earth** or **!earthporn**: Posts a random submission from /r/EarthPorn's top this week **!porn**: Posts a random link from one of the 'porn' subreddits (not actually NSFW) **!kill** or **!restart**: Kill the bot process so that it can automatically restart with the new version (only pocketjawa can use these) -**!joke**: Posts a random joke from /r/Jokes \ No newline at end of file +**!joke**: Posts a random joke from /r/Jokes +**!8ball**: You ask a question, it answeres. Simple! +**!conch** or **!magicconch**: Same as the 8ball command but waaaaay cooler \ No newline at end of file diff --git a/lists/8ball_responses.txt b/lists/8ball_responses.txt new file mode 100644 index 0000000..075de33 --- /dev/null +++ b/lists/8ball_responses.txt @@ -0,0 +1,20 @@ +It is certain +It is decidedly so +Without a doubt +Yes definitely +You may rely on it +As I see it, yes +Most likely +Outlook good +Yes +Signs point to yes +Reply hazy try again +Ask again later +Better not tell you now +Cannot predict now +Concentrate and ask again +Don't count on it +My reply is no +My sources say no +Outlook not so good +Very doubtful \ No newline at end of file diff --git a/pocketbot.py b/pocketbot.py index eea33c4..299c8ca 100644 --- a/pocketbot.py +++ b/pocketbot.py @@ -156,6 +156,26 @@ def on_message(message): jokemsg = jokesr.title + '\n\n' + jokesr.selftext yield from client.send_message(message.channel, jokemsg) + #Magic 8-ball simulator 2017 + elif message.content.lower().startswith('!8ball'): + ball_response_file = open("/srv/discord-pocketbot/lists/8ball_responses.txt", "r") + ball_responses = ball_response_file.read().split('\n') + args = message.content.partition(' ')[2] + if (args is ''): + yield from client.send_message(message.channel, 'Please include a question for me to answer. I\'m not _that_ psychic...') + else: + yield from client.send_message(message.channel, 'The Magic 8-ball says... ' + random.choice(ball_responses)) + + #Magic Conch Shell simulator 2002 (way cooler than that lame "Magic" 8-ball) + elif message.content.lower().startswith('!conch') or message.content.lower().startswith('!magicconch'): + ball_response_file = open("/srv/discord-pocketbot/lists/8ball_responses.txt", "r") + ball_responses = ball_response_file.read().split('\n') + args = message.content.partition(' ')[2] + if (args is ''): + yield from client.send_message(message.channel, 'Please include a question for me to answer. I\'m not _that_ psychic...') + else: + yield from client.send_message(message.channel, 'The Magic Conch Shell says... ' + random.choice(ball_responses)) + client.loop.create_task(ups_check()) client.run(token) \ No newline at end of file