Why this is happening my discord bot isnt working

Hi @KaitoAM, welcome to the community!

Can you please provide more information and a link to your Repl?

https://replit.com/@KaitoAM/WithinRepl?s=app
Thats u mean?

1 Like

I don’t seem to know what your problem is but i noticed some things:

  1. Are you using the intents from discord? (Since 2021 you have to use intents)

  2. At the bottom of your code you are using:

try:
    keep_alive.keep_alive()
    bot.run(os.getenv("TOKEN"))
except:
    os.system("kill 1")
    keep_alive.keep_alive()
    bot.run(os.getenv("TOKEN"))

I don’t know if getenv still works but you should use the secret function from replit.

  1. Give more details about your problem, what are you trying to do? Does your code stop running after you type a command?
1 Like

os.environ["TOKEN"] and os.environ.get("TOKEN") are also ways to get the environment variables in Python.

2 Likes

I keep seeing this specific line. It comes from a no longer working package. You can’t ping your Repl from the inside to keep it alive.

2 Likes

Then what to do what should I place
Im trying to do an 24/7 hour discord bot

My goal from this code is
Make a discord bot work 24/7
And I use SECRET for the token

Shall I delete this line or what
Or tell me the correct form of it

1 Like