Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
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')