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
from discord.ext import commands
bot = commands.Bot(command_prefix='!', description='A bot to help the user choose a car.')
# Example code from discord.py documentation that I added the change precence function to.
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
activity = discord.Activity(name='You Pick A Car', type=discord.ActivityType.watching)
await bot.change_presence(activity=activity)
bot.remove_command('help')
# End of modified example code
# Code I created using functions from the discord.py documentation
@bot.event
async def on_message(message):
if "hatchback" == message.content.lower():
await message.channel.send("Okay a hatchback huh? What type of fuel do you want it to use? Petrol, Diesel or Electricity?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "petrol" == message.content.lower():
await message.channel.send("Okay, Petrol it is. Do you want 3 doors or 5?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "3" == message.content.lower():
await message.channel.send("Okay 3 doors, Whats your budget?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
budget = int(x)
if budget <= 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series", file=discord.File('1series3door.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi A1", file=discord.File('a1.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Polo", file=discord.File('polo.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Fiesta", file=discord.File('fiesta.png'))
else:
await message.channel.send("Please choose a make")
elif budget > 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, MERCEDES, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series M Sport", file=discord.File('1series3doorM.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi RS3", file=discord.File('rs3.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Golf", file=discord.File('golf.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Focus", file=discord.File('focus.png'))
elif "mercedes" == message.content.lower():
await message.channel.send("The car for you is the Mercedes A Class", file=discord.File('aclass.png'))
else:
await message.channel.send("Please choose a make")
else:
await message.channel.send("Please type in your budget")
elif "5" == message.content.lower():
await message.channel.send("Okay 5 doors, Whats your budget?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
budget = int(x)
if budget <= 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series", file=discord.File('1series5door.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi A1", file=discord.File('a15door.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Polo", file=discord.File('polo5door.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Fiesta", file=discord.File('fiesta5door.png'))
else:
await message.channel.send("Please choose a make")
elif budget > 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, MERCEDES, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series M Sport", file=discord.File('1series3doorM.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi RS3", file=discord.File('rs35door.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Golf", file=discord.File('golf5door.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Focus", file=discord.File('focus5door.png'))
elif "mercedes" == message.content.lower():
await message.channel.send("The car for you is the Mercedes A Class", file=discord.File('aclass5door.png'))
else:
await message.channel.send("Please choose a make")
else:
await message.channel.send("Please type in your budget.")
elif "diesel" == message.content.lower():
await message.channel.send("Okay, Diesel it is. Do you want 3 doors or 5?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "3" == message.content.lower():
await message.channel.send("Okay 3 doors, Whats your budget?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
budget = int(x)
if budget <= 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series", file=discord.File('1series3door.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi A1", file=discord.File('a1.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Polo", file=discord.File('polo.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Fiesta", file=discord.File('fiesta.png'))
else:
await message.channel.send("Please choose a make")
elif budget > 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, MERCEDES, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series M Sport", file=discord.File('1series3doorM.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi RS3", file=discord.File('rs3.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Golf", file=discord.File('golf.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Focus", file=discord.File('focus.png'))
elif "mercedes" == message.content.lower():
await message.channel.send("The car for you is the Mercedes A Class", file=discord.File('aclass.png'))
else:
await message.channel.send("Please choose a make")
else:
await message.channel.send("Please type in your budget")
elif "5" == message.content.lower():
await message.channel.send("Okay 5 doors, Whats your budget?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
budget = int(x)
if budget <= 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series", file=discord.File('1series3door.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi A1", file=discord.File('a1.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Polo", file=discord.File('polo.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Fiesta", file=discord.File('fiesta.png'))
else:
await message.channel.send("Please choose a make")
elif budget > 20000 :
await message.channel.send("Finally, What make car do you want? BMW, AUDI, MERCEDES, VW or FORD?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW 1 Series M Sport", file=discord.File('1series3doorM.png'))
elif "audi" == message.content.lower():
await message.channel.send("The car for you is a Audi RS3", file=discord.File('rs3.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen Golf", file=discord.File('golf.png'))
elif "ford" == message.content.lower():
await message.channel.send("The car for you is the Ford Focus", file=discord.File('focus.png'))
elif "mercedes" == message.content.lower():
await message.channel.send("The car for you is the Mercedes A Class", file=discord.File('aclass.png'))
else:
await message.channel.send("Please choose a make")
else:
await message.channel.send("Please type in your budget")
else:
await message.channel.send("Please choose how many doors you want.")
elif "electricity" == message.content.lower():
await message.channel.send("Okay, Electricity it is. Do you want 3 doors or 5?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "3" == message.content.lower():
await message.channel.send("Okay 3 doors, What is your budget?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
budget = int(x)
if budget > 20000:
await message.channel.send("Sorry the only 3 door we have is a BMW. Is that okay?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "yes" == message.content.lower():
await message.channel.send("The car for you is a BMW i3", file=discord.File('i3.png'))
elif "no" == message.content.lower():
await message.channel.send("Sorry we dont have a car for you.")
else:
await message.channel.send("Please choose a car make")
if budget < 20000:
await message.channel.send("Sorry we dont have any electric cars under £20,000")
elif "5" == message.content.lower():
await message.channel.send("Okay 5 doors, What is your budget?")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
budget = int(x)
if budget > 20000:
await message.channel.send("Finally, What make car do you want? BMW, MERCEDES or VW")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
if "bmw" == message.content.lower():
await message.channel.send("The car for you is a BMW i3", file=discord.File('i3.png'))
elif "mercedes" == message.content.lower():
await message.channel.send("The car for you is a Mercedes B Class Electric Drive", file=discord.File('bclass.png'))
elif "vw" == message.content.lower():
await message.channel.send("The car for you is a Volkswagen e-Golf", file=discord.File('egolf.png'))
else:
await message.channel.send("Please choose a car make")
if budget < 20000:
await message.channel.send("Sorry we dont have any electric cars under £20,000")
else:
await message.channel.send("Please choose how many doors you want.")
else:
await message.channel.send("Please choose a fuel type")
else:
if message.author == bot.user:
return
else:
await message.channel.send("What type of car do you want?")
bot.run('')
# End of code I created