How does this code not work?

How dees this code not work ?
my replit Link : Join Lucaskng1's "CASINO" - Replit
Screenshot 2022-09-22 at 8.07.43 AM

You shouldn’t post the join link to your Repl, it means literally anyone who sees that link can edit your Repl. This is the link you should use: https://replit.com/@Lucaskng1/CASINO?v=1. Because you posted the join link I was able to directly edit your Repl. Try looking here: Intro to discord.py and here: Quickstart discord bot

For the event, you have to create the function for what it does

right. sorry :sweat_smile: You know how to fix my code ? doesnt seem to be working ?

wut ? :thinking: you mean add a function after @client.event ?

Actually there’s quite a few wrong things about it,
I’ll keep it simple for now

First up, the bot variable needs to be an instance
of the class Client, not just a reference, so:

bot = discord.Client()

Now as that’s out of the way you have placed an empty decorator
at line 5, decorators are meant to… Decorate functions, it’s
basically a function which takes a function as its argument

Well I never done discord.py using the imperative method,
your code should be similar to this:

import discord

bot = discord.Client()

@bot.event
def on_ready():
    print("I am ready!")

bot.run("your-bot-token")

Not sure if this works, but should be
something like it

Although refer to the discord.py docs,
here’s the part about Client.event

2 Likes

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