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 #imports discord libary
bot = commands.Bot(command_prefix='!', description='A bot to help the user choose a car.') #sets the commannd prefix for the bot, we arent going to use this but it needs to be here to run
@bot.event
async def on_ready(): #when the bot is ready and connected to discord it runs the following code
print('Logged in as') #prints to shell NOT discord
print(bot.user.name)
print(bot.user.id)
activity = discord.Activity(name='You Pick A Car', type=discord.ActivityType.watching) #sets the activity within discord to watching you pick a car
await bot.change_presence(activity=activity) #changed the presence
bot.remove_command('help') #removes the preset help command as we wont use it
@bot.event
async def on_message(message): #runs the below code when there is a message in discord
if "car" == message.content.lower(): #sets the message content to all lowercase to make it understandable and checks to see if car is the message content
await message.channel.send("You want a car") #sends this message to the discord channel where the message was
await message.channel.send("This is a car", file=discord.File('a1.png'))
bot.run('') #runs the bot using the long token given.