Just-Some-Bots / MusicBot

:musical_note: The original MusicBot for Discord (formerly SexualRhinoceros/MusicBot)
https://just-some-bots.github.io/MusicBot/
MIT License
3.11k stars 2.35k forks source link

Bot acts up due to TypeError #2321

Closed H3wastooshort closed 1 year ago

H3wastooshort commented 1 year ago

What went wrong?

Bot does something like this and goes offline until manually restarted. Happend a few times already

SystemD log after crash:

lines 1-21/21 (END)...skipping...
● dc_mus.service - discord music bot
     Loaded: loaded (/etc/systemd/system/dc_mus.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-12-04 15:11:29 CET; 5h 16min ago
   Main PID: 852080 (bash)
      Tasks: 9 (limit: 1890)
        CPU: 7min 41.182s
     CGroup: /system.slice/dc_mus.service
             ├─852080 bash run.sh
             ├─852096 python run.py
             └─853866 ffmpeg -nostdin -i audio_cache/youtube-JThz8-nYYHs-Nightcore_-_Warriors.webm -f s16le -ar 48000 -ac 2 -loglevel warning -vn pipe:1

Dec 04 18:11:01 lowpower bash[852096]:   File "/mnt/btrfsMirror/discordbots/music/MusicBot/musicbot/bot.py", line 103, in __init__
Dec 04 18:11:01 lowpower bash[852096]:     self.downloader = downloader.Downloader(download_folder="audio_cache")
Dec 04 18:11:01 lowpower bash[852096]:   File "/mnt/btrfsMirror/discordbots/music/MusicBot/musicbot/downloader.py", line 46, in __init__
Dec 04 18:11:01 lowpower bash[852096]:     ytdl_format_options["outtmpl"] = os.path.join(download_folder, otmpl)
Dec 04 18:11:01 lowpower bash[852096]:   File "/usr/lib/python3.9/posixpath.py", line 90, in join
Dec 04 18:11:01 lowpower bash[852096]:     genericpath._check_arg_types('join', a, *p)
Dec 04 18:11:01 lowpower bash[852096]:   File "/usr/lib/python3.9/genericpath.py", line 152, in _check_arg_types
Dec 04 18:11:01 lowpower bash[852096]:     raise TypeError(f'{funcname}() argument must be str, bytes, or '
Dec 04 18:11:01 lowpower bash[852096]: TypeError: join() argument must be str, bytes, or os.PathLike object, not 'dict'
Dec 04 18:11:01 lowpower bash[852096]: [INFO] launcher: All done.

How do we reproduce this?

I'm not sure what exactly causes it, happens randomly while playback, but i think the current playing video was ID JThz8-nYYHs

Am not sure because my friends experienced this

Which version of the bot are you using?

release-151221

Which operating system are you using?

Other

Just checking...

BabyBoySnow commented 1 year ago

I haven't ran into this but I'm on windows, please try updating the bot and see if the issue persist after that.

BabyBoySnow commented 1 year ago

Running into this issue now as well.

DestinyofYeet commented 1 year ago

I debugged the issue a bit. The otmpl variable does indeed change from this string '%(extractor)s-%(id)s-%(title)s.%(ext)s' at startup to this dict {'chapter': '%(title)s-%(section_number)03d-%(section_title)s-[%(id)s].%(ext)s', 'default': 'audio_cache/%(extractor)s-%(id)s-%(title)s.%(ext)s'} when trying to shut down.

Looked a bit further and the value of the outtmpl key in the ytdl_format_options dict seems to change from a string to a dictionary somehow