Syntax error on Discord.py

Asked 2 years ago, Updated 2 years ago, 129 views

RTa-technology/discord_dice_bot
After running this program, the Heroku deployment was completed, but Discord does not come online (probably the code is incorrect).

Heroku and Github are working together, and Build succeeded on Heroku, so there seems to be no error.However, it doesn't come online, so something seems to be wrong.However, on Github, I was not sure how to determine where the error was occurring.

Instead of editing the code from the previous question and accessing the Google Spread Sheet, we load it from a list.

If the code is incorrect, I'm sorry, but I don't know which part is wrong.

If possible, I would appreciate it if you could let me know which part is wrong.

04/1000:00 Add
Edit to .
Change History

bot
the variables in the
client
changed to

I did.

Results Heroku log shows

 2020-04-09T 14:57:15.856251 + 00:00 app [worker.1]: Traceback (most recent call last):
2020-04-09T14:57:15.856315 + 00:00 app [worker.1]: File"/app/.heroku/python/lib/python 3.6/site-packages/discord/client.py", line 312, in_run_event
2020-04-09T14:57:15.856316 + 00:00 app [worker.1]: wait coro (*args, **kwargs)
2020-04-09T14:57:15.856321 + 00:00 app [worker.1]: File "trpg_bot.py", line512, in on_message
2020-04-09T14:57:15.856322 + 00:00 app [worker.1]: input_msg=bot_startswitch(message).fixed
2020-04-09T14:57:15.856366+00:00 app [worker.1]: AttributeError: 'NoneType' object has no attribute' fixed'
2020-04-09T14:57:21.096405 + 00:00 heroku [worker.1]: State changed from up to down
2020-04-09T14:57:20.879678+00:00 app [api]: Deploy c60fbd16 by user [email protected]
2020-04-09T14:57:20.879678 + 00:00 app [api]: Release v28 created by user [email protected]
2020-04-09T14:57:33.000000+00:00 app [api]: Build succeeded

So I started Bot, but I didn't get any reply.

April 9, 2020 23:49 Add

2020-04-09T12:10:11.727817+00:00 app [woker.1]: File"/app/.heroku/python/lib/python 3.6/site-packages/discord/client.py", line312, in_run_event
2020-04-09T12:10:11.727818 + 00:00 app [woker.1]: wait coro (*args, **kwargs)
2020-04-09T12:10:11.727850 + 00:00 app [woker.1]: File "trpg_bot.py", line 510, in on_message
2020-04-09T12:10:11.727851 + 00:00 app [woker.1]: if client.user!=message.author:
2020-04-09T12:10:11.727906 + 00:00 app [woker.1]: NameError: name 'client' is not defined
2020-04-09T14:42:29.000000+00:00 app [api]: Build started by user [email protected]
2020-04-09 T14:43:02.795195 + 00:00 heroku [woker.1]: State changed from up to down
2020-04-09T14:43:02.717678 + 00:00 app [api]: Deploy1a8e0369 by user [email protected]
2020-04-09T14:43:02.717678 + 00:00 app [api]: Release v23 created by user [email protected]
2020-04-09T14:43:15.000000+00:00 app [api]: Build succeeded

There was an error, so

if client.user
To
if bot.user
by changing to

Corrected.

python discord

2022-09-30 10:26

2 Answers

Sorry for passing by, but as far as the Procfile is concerned,

 woker: python trpg_bot.py

is not walker but worker missing r.

worker: python trpg_bot.py

Heroku's free plan sleeps in 30 minutes, so I'm not sure if this bot will continue to work...

Also, first of all, open View logs from the More: menu on the app page on the Heroku dashboard to see if you are spouting the logs you expect after startup.


2022-09-30 10:26

For python, the variable name 4176.col_keys is syntax error because the first character of the variable name cannot contain a number and cannot contain .(dot).

-- This answer is to post comment from metropolis as a community wiki.


2022-09-30 10:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.