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
bot = commands.Bot(command_prefix='!', description='A bot to help the user choose a car.')
# Example from discord.py documentation that I added the change precence function
@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 from discord.py
# Text similarity api from Roshan that i intergrated to discord.
@bot.event
async def on_message(message):
if message.author == bot.user:
return
else:
url = "https://text-similarity-calculator.p.rapidapi.com/stringcalculator.php"
x = "Im looking for a brand new family car"
y = message.content
querystring = {"ftext": x, "stext": y}
headers = {
'x-rapidapi-host': "text-similarity-calculator.p.rapidapi.com",
'x-rapidapi-key': ""
}
response = requests.request("GET", url, headers=headers, params=querystring)
z = len(response.text)
y = response.text[498:z - 2]
await message.channel.send(y)
# End of text similarty api from Roshan that I intergrated
bot.run('')