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 requests
from discord.ext import commands
# Example code from discord.py documentation that I edited for our use, added the change presence function I found within the documentation.
bot = commands.Bot(command_prefix='!', description='A bot to help the user choose a car.')
@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 example code from discord.py documentation that I edited.
# Ai api that roshan got working in terminal and I intergrated into our discord bot using the discord documentation.
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
x = message.content
url = "https://acobot-brainshop-ai-v1.p.rapidapi.com/get"
querystring = {"bid": "178", "key": "", "uid": "mashape", "msg": x}
headers = {
'x-rapidapi-host': "acobot-brainshop-ai-v1.p.rapidapi.com",
'x-rapidapi-key': ""
}
response = requests.request("GET", url, headers=headers, params=querystring)
z=len(response.text)
y = response.text[8:z-2]
await message.channel.send(y)
# End of ai api that roshan coded that I intergrated to discord.
bot.run('')