Question:
Why isn’t my bot responding? I followed a tutorial online but it didn’t work, it’s not throwing an error so I don’t know what’s gone wrong.
Repl link:
https://replit.com/@ColoredHue/discordbot#bot.py
I have already made a secret called token.
I cannot run it on my side because the Secret will not execute in the program. What does it look like on your side?
It looks like this:
Is there anything happening on the Discord server?
No, the bot is offline.
Could you turn it on?
You might have to use Always-On though.
You mean run the program?
I’ve already retried that if that’s what you’re asking.
Hey @ColoredHue !
Are you sure the code is 100% correct, as in exactly what the tutorial said?
Could it be that there was nothing in the channel? Then nothing is printed?
main.py
import bot
if __name__ == '__main__':
while 1:
bot.run_discord_bot()
Won’t it spam ‘ran’ then?
Yeah. If you don’t want that, remove print("ran")
This didn’t fix the problem…
you accidently indented the last line in your bot.py
file so the function call of client.run(TOKEN)
is now only going to be run on the on_message
even, merely unindent this so it runs
the difficulty you’re encountering originates from an indentation issue in your code, more specifically within client.run(TOKEN)
. it should be placed at the beginning of the line, rather than midway - this adjustment should rectify your problem.
The problem arose due to an unintentional indentation on client.run(TOKEN)
, this prevented the bot from initiating correctly. for functionality, client.run(TOKEN)
needs to be situated at the line’s onset, devoid of any indentation. implementing this change will definitively resolve the issue at hand.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.