adding my 8ball code to dragon bot, see #13
This commit is contained in:
parent
e061537758
commit
b5704ff8a4
@ -7,7 +7,7 @@ def get_definition(content):
|
|||||||
|
|
||||||
grabs a definition from urban dictionary
|
grabs a definition from urban dictionary
|
||||||
"""
|
"""
|
||||||
if len(content.split()) > 1:
|
if len(content.split()) > 1:
|
||||||
word = content.split()[1:]
|
word = content.split()[1:]
|
||||||
try:
|
try:
|
||||||
definition = requests.get(
|
definition = requests.get(
|
||||||
@ -18,5 +18,5 @@ def get_definition(content):
|
|||||||
definition = 'No definition found'
|
definition = 'No definition found'
|
||||||
|
|
||||||
return "`{}`\n```{}```".format(' '.join(word), definition)
|
return "`{}`\n```{}```".format(' '.join(word), definition)
|
||||||
else:
|
|
||||||
return help_methods.get_help_message('define')
|
return help_methods.get_help_message('define')
|
||||||
|
@ -3,6 +3,7 @@ import sys
|
|||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import eight_ball
|
||||||
import define_word
|
import define_word
|
||||||
import help_methods
|
import help_methods
|
||||||
import discord
|
import discord
|
||||||
@ -134,6 +135,12 @@ async def on_message(message):
|
|||||||
if client.user.mentioned_in(message):
|
if client.user.mentioned_in(message):
|
||||||
print('fuck u')
|
print('fuck u')
|
||||||
|
|
||||||
|
if message.content.startswith('!8ball'):
|
||||||
|
await client.send_message(
|
||||||
|
message.channel,
|
||||||
|
eight_ball.check_8ball(message.content)
|
||||||
|
)
|
||||||
|
|
||||||
if message.content.startswith('!define'):
|
if message.content.startswith('!define'):
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.channel,
|
message.channel,
|
||||||
|
47
app/eight_ball.py
Normal file
47
app/eight_ball.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import help_methods
|
||||||
|
|
||||||
|
def check_8ball(question):
|
||||||
|
"""
|
||||||
|
check_8ball(question)
|
||||||
|
|
||||||
|
Takes in a question and returns a random answer from an 8ball.
|
||||||
|
To add more responses, simply add it to one of the lists below
|
||||||
|
"""
|
||||||
|
if len(question.split()) > 1:
|
||||||
|
question = question.split()[1:]
|
||||||
|
|
||||||
|
positive_responses = [
|
||||||
|
'As I see it, yes',
|
||||||
|
'It is certain',
|
||||||
|
'It is decidedly so',
|
||||||
|
'Most likely',
|
||||||
|
'Oh for sure brother',
|
||||||
|
'Outlook good',
|
||||||
|
'Signs point to yes',
|
||||||
|
'Without a doubt',
|
||||||
|
'Yes, definitely',
|
||||||
|
'Yes',
|
||||||
|
'You can count on it',
|
||||||
|
]
|
||||||
|
negative_responses = [
|
||||||
|
'Dont count on it',
|
||||||
|
'My sources say no',
|
||||||
|
'My thoughts are.....no',
|
||||||
|
'Outlook not so good',
|
||||||
|
'Very doubtful',
|
||||||
|
]
|
||||||
|
noncommittal_responses = [
|
||||||
|
'Ask again later',
|
||||||
|
'Better not tell you now',
|
||||||
|
'Can\'t answer that right now',
|
||||||
|
'Concentrate and ask again',
|
||||||
|
'Reply hazy try again',
|
||||||
|
]
|
||||||
|
|
||||||
|
responses = positive_responses + negative_responses + noncommittal_responses
|
||||||
|
return random.choice(responses)
|
||||||
|
|
||||||
|
return help_methods.get_help_message('8ball')
|
@ -1,5 +1,17 @@
|
|||||||
def get_help_message(method):
|
def get_help_message(method):
|
||||||
|
"""
|
||||||
|
get_help_message(method)
|
||||||
|
|
||||||
|
Returns the information and usage of each of dragon bot's funtions.
|
||||||
|
When adding a new feature to dragon bot, please add some information about
|
||||||
|
it here
|
||||||
|
"""
|
||||||
|
|
||||||
supported_methods = {
|
supported_methods = {
|
||||||
|
'8ball': [
|
||||||
|
'Ask dragon bot a question and it will give you an 8ball response',
|
||||||
|
'\n\nUsage: !8ball Will I win the lottery tomorrow?'
|
||||||
|
],
|
||||||
'decide': [
|
'decide': [
|
||||||
'Dragon-bot will help make the tough decisions for you',
|
'Dragon-bot will help make the tough decisions for you',
|
||||||
'\n\n!decide option 1 or option 2.\n\nIf thre is only',
|
'\n\n!decide option 1 or option 2.\n\nIf thre is only',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user