I have been developing a Discord bot and it was functioning properly until I introduced the !random
feature. Now, however, I’m encountering a syntax error. Here’s the relevant portion of my code:
import discord
import asyncio
import random
import time
client = discord.Client()
@client.event
async def on_ready():
print('---------------------')
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('---------------------')
@client.event
async def on_message(message):
if message.content.lower().startswith('!check'):
await client.send_message(message.channel, 'Check successful')
if message.content.lower().startswith('!flipcoin'):
result = random.randint(1, 2)
if result == 1:
await client.add_reaction(message, '🪙')
else:
await client.add_reaction(message, '🪙')
if message.content.lower().startswith('!randomize'):
await client.send_message(message.channel, random.randint(0, 100))
client.run('your token validated multiple times')
I receive the following error message:
File "C:/Users/Woodpecker/Desktop/1010/Python/Reddit_Bot/Woodpecker's_bot.py", line 33
client.run('token')
^
SyntaxError: invalid syntax