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

can't run code #10

Open
yyurodd opened this issue Jul 31, 2023 · 14 comments
Open

can't run code #10

yyurodd opened this issue Jul 31, 2023 · 14 comments

Comments

@yyurodd
Copy link

yyurodd commented Jul 31, 2023

I admit that the problem is most likely in me, but I've been trying to make / find a working bot for 5 hours now and I don't understand what the problem is

Traceback (most recent call last):
File "C:\Users\petuk\Documents\stepik\youtubebot.py", line 29, in
bot = commands.Bot(command_prefix=PREFIX, intents=discord.Intents(voice_states=True, guilds=True, guild_messages=True, message_content=True))
File "C:\Users\petuk\Documents\stepik\venv\lib\site-packages\discord\flags.py", line 402, in init
raise TypeError('%r is not a valid flag name.' % key)
TypeError: 'message_content' is not a valid flag name.

@maxcutlyp
Copy link
Owner

In your Discord developer portal, under the Bot tab in the sidebar, make sure you have "Message Content Intent" ticked on.
image
Otherwise, run pip show discord-py and let me know which version it is. It's possible that you have an outdated library, or that discord updated it quietly and removed/renamed the message_content intent.

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

Message content intent ticked on.
изображение_2023-07-31_061041383

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

okay i just realized i have old discord-py. I just updated it and now i have this
image

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

but i have a .env file with token
image

@maxcutlyp
Copy link
Owner

That's weird. Maybe an issue with dotenv...? Try pip show python-dotenv.

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

image

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

just updated it but i still have this message, that's really weird because code returning this only if token is none but token definitely have a value

@maxcutlyp
Copy link
Owner

So pip show python-dotenv now says that it's on version 1.0.0?

For good measure, it might be worth running a quick pip install --upgrade -r requirements.txt. Also, what version of python are you running?

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

okay just solved the problem with token. out of habit, from old attempts, I also inserted the token into the code itself

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

and now i have new one :(
Traceback (most recent call last):
File "C:\Users\petuk\Documents\dsbot\venv\lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "C:\Users\petuk\Documents\dsbot\youtubebot.py", line 192, in on_command_error
sp.run(['./restart'])
File "C:\Users\petuk\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\petuk\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\petuk\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 не является приложением Win32

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

"не является приложением" is meaning "is not an application". I don't know why it's written in Russian

@yyurodd
Copy link
Author

yyurodd commented Jul 31, 2023

the bot downloaded the video, entered the channel but did not play anything, then what I sent above was displayed

@maxcutlyp
Copy link
Owner

Looks like you need ffmpeg installed. The reason the error message is so cryptic is because the bot has a bash script to restart if it encounters an unknown error (since in production, that tends to fix things) - but Windows has no idea how to run bash, and throws a strange (apparently Russian) error.

To install ffmpeg, check out this guide that someone else linked in #6.

@maxcutlyp
Copy link
Owner

Hey @yyurodd - just wanted to check how you were going with this issue, did installing ffmpeg fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants