Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugged code? Im not 100% sure... #5846

Closed
jumpy72red opened this issue Sep 23, 2020 · 2 comments
Closed

Bugged code? Im not 100% sure... #5846

jumpy72red opened this issue Sep 23, 2020 · 2 comments
Labels
bug This is a bug with the library. invalid This is not right. question This is a question about the library

Comments

@jumpy72red
Copy link

Summary

I am trying to get a discord bot to work, so I got round a bunch of Linux issues, and finally managed to get everything in place and I get loads of errors.

Reproduction Steps

harry@debian:~/Code/Python$ python3.8 Bot.py
(Screenshots show the python code)

Expected Results

The code to run.

Actual Results

Traceback (most recent call last):
File "Bot.py", line 15, in
client.run(TOKEN)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 678, in run
return future.result()
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 658, in runner
await self.start(*args, **kwargs)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 621, in start
await self.login(*args, bot=bot)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 472, in login
await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'

Screenshot from 2020-09-23 18-27-31
Screenshot from 2020-09-23 18-27-52

Checklist

  • [ x] I have searched the open issues for duplicates.
  • [ x] I have shown the entire traceback, if possible.
  • [ x] I have removed my token from display, if visible.

System Information

harry@debian:~/Code/Python$ python3.8 -m discord -v

  • Python v3.8.5-final
  • discord.py v1.4.1-final
  • aiohttp v3.6.2
  • system info: Linux 4.19.0-10-amd64 Fix issue with author changing type #1 SMP Debian 4.19.132-1 (2020-07-24)
    harry@debian:~/Code/Python$
@jumpy72red jumpy72red added the bug This is a bug with the library. label Sep 23, 2020
@fwrs
Copy link

fwrs commented Sep 23, 2020

This is an error with your code, not with discord.py code. Use the discord server at https://discord.gg/r3sSKJJ for assistance.

@Harmon758
Copy link
Contributor

In the first screenshot, you've leaked a large portion of your token, so you might want to regenerate it now if you haven't already.

In that screenshot, you're attempting to get an environment variable with the name being your token itself. os.getenv returns None by default if an environment variable with that name/key isn't found, and that's what's happening here. TOKEN is None, and that causes subsequent errors when it's passed to Client.run.

You likely need to change your call to os.getenv to use the name/key of the environment variable rather than the value of it.
Otherwise, you can just use the token directly as a string.

As explained though, this is not an issue with discord.py, and for future questions like this, you should join either the official discord.py server or the Discord API server for help, as the README also links.

For code block usage, see https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks.
For task list usage, see https://docs.github.com/en/github/managing-your-work-on-github/about-task-lists.

@dpy-manager-bot dpy-manager-bot added invalid This is not right. question This is a question about the library labels Sep 23, 2020
@Gobot1234 Gobot1234 mentioned this issue Sep 23, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is a bug with the library. invalid This is not right. question This is a question about the library
Projects
None yet
Development

No branches or pull requests

4 participants