I have a problem when trying to send the Cool Meter message, what is the issue? Also on line 12 the syntax says that you can't add a + b (a + b being an example) so when I run it , the script automatically says an error. In fact I tried just putting the contents on line 12 inside on the message function but the error still happened.
import discord
import os
import random
import time
import requests
import json
client = discord.Client()
Numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]
RandomNumber = random.choice(Numbers) + str"% Cool."
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]["q"] + " -"+json_data[0]["a"]
return(quote)
#On Ready Event.
@client.event
async def on_ready():
print("Bot Ready.")
time.sleep(1)
print("Logged In As: {0.user}".format(client))
#If The Bot Recieves A Message Event.
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith(":quote"):
quote = get_quote()
await message.channel.send(quote)
elif message.content.startswith(":coolmeter"):
await message.channel.send(RandomNumber)
client.run(os.getenv("Token"))