Discord Bot, using Py on Replit

Issue: I copied this right from the Replit Page, I followed the instructions and still it wont work. I did put in the DISCORD_BOT_SECRET as a variable along with my bot token.

What exactly is the issue here?

Error: Traceback (most recent call last):
File “main.py”, line 6, in
NameError: name ‘client’ is not defined


import os
import discord


async def on_ready():
    print("I'm in")

async def on_message(message):
    if message.author != client.user:
        await message.channel.send(message.content[::-1])

my_secret = os.environ['DISCORD_BOT_SECRET']

I believe you need to assign your discord.Client() call to a client variable.

1 Like

i was so lost n theres not much information on the subjectXD

hey! how exactly did you go about assigning to a client variable? I seem to be a bit overwhelemed/lost as well :sweat_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.