Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Eugene-Chatbot/EugeneDiscord.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
56 lines (49 sloc)
2.35 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
import toby as SP | |
import random as rand | |
import Zomato_Toby | |
import Find_allergens | |
### Start of code copied from: https://discordpy.readthedocs.io/en/latest/quickstart.html | |
client = discord.Client() | |
@client.event | |
async def on_ready(): | |
print('We have logged in as {0.user}'.format(client)) | |
@client.event | |
async def on_message(message): | |
if message.author == client.user: | |
return | |
if message.content.startswith('!hello'): | |
await message.channel.send("Hello, I'm Eugene!") #Changed the responses | |
await message.channel.send("How can I help?") | |
### End of code copied from: https://discordpy.readthedocs.io/en/latest/quickstart.html | |
elif message.content.startswith('!help'): | |
await message.channel.send('What do you need help with?') | |
elif message.content.startswith('!recipe'): | |
if message.content.startswith('!recipe random'): | |
recipe = [] | |
recipe = SP.randomRecipe() | |
if len(recipe) != 0: | |
await message.channel.send('Title: ' + recipe[0]) | |
await message.channel.send('Ingredients: ' + recipe[1]) | |
await message.channel.send('Method: ' + recipe[2]) | |
else: | |
await message.channel.send("I'm very sorry but I don't know any recipes that include " + message.content[8:len(message.content)] + ".") | |
else: | |
recipe = [] | |
recipe = SP.chosenRecipe(message.content) | |
if len(recipe) != 0: | |
await message.channel.send('Title: ' + recipe[0]) | |
await message.channel.send('Ingredients: ' + recipe[1]) | |
await message.channel.send('Method: ' + recipe[2]) | |
else: | |
await message.channel.send("I'm very sorry but I don't know any recipes that include " + message.content[8:len(message.content)] + ".") | |
elif message.content.startswith('!restaurant'): | |
restaurant = message.content.split(" ") | |
await message.channel.send(Zomato_Toby.findCountry(restaurant[1], restaurant[2])) | |
elif message.content.startswith('!thank'): | |
await message.channel.send("I'm just here to help!") | |
elif message.content.startswith('!goodbye'): | |
await message.channel.send('Au revoir.') | |
await client.close() | |
sys.exit() | |
client.run('NjM2NTIzNzU1MDY1MzExMjQ1.XbA2-w.LFi0E8MXkpwxR2Aa15Asy13ZRwc') |