GithubHelp home page GithubHelp logo

krutyi-4el / dandelionmusic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from raptor123471/dingolingo

41.0 3.0 16.0 23.63 MB

Discord music bot written in Python that supports YouTube, SoundCloud, Spotify, Bandcamp, Twitter and custom files

License: GNU General Public License v3.0

Python 99.11% Procfile 0.02% Dockerfile 0.87%
discord music spotify youtube

dandelionmusic's Introduction

DandelionMusic

A Discord music bot written in Python with support for Youtube, SoundCloud, Spotify, Bandcamp, Twitter, and custom files.

Keep in mind:

What's Coming?

  • See TODO in Projects tab

Prerequisites:

API Keys

Obtained keys must be entered into config.json (or set as environment variables)

Requirements (skip this if you've decided to use pre-built exe)

  • Installation of Python 3.8+

Install dependencies:

pip install -r requirements.txt
Windows

Download ffmpeg and put it into a folder in PATH.

If ffmpeg is not found, the script will try to download it automatically.

Other platforms

Install ffmpeg and libopus packages.

Installing - Self hosting

  1. Download release if available, alternatively download repository zip
  2. Complete Prerequisites
  3. Start run.py in project root (or the exe)
  4. See configuration options in config.json (more info at https://github.com/solaluset/DandelionMusic/wiki/Configuration)

Button play plugin:

  • Set emoji with the setting command to enable this feature
  • Emote must be available for bot
  • Needs Manage Message permissions

Custom Cookies:

  • Extract cookies.txt from you browser using your preferred method
  • Overwrite the existing cookies.txt in /config/cookies/
  • (Optional) Set a custom cookies.txt location by modifying COOKIE_PATH in config.py

Docker image

You can find pre-built Docker image at https://hub.docker.com/repository/docker/solaluset/dandelion-music/

See https://github.com/solaluset/DandelionMusic/wiki/Configuration for description of environment variables.

Commands:

Music

After the bot has joined your server, use d!help to display help and command information.

d!p [link/video title/key words/playlist-link/soundcloud link/spotify link/bandcamp link/twitter link]
  • Plays the audio of supported website
    • A link to the video (https://ww...)
    • The title of a video ex. (Gennifer Flowers - Fever Dolls)
    • A link to a YouTube playlist
  • If a song is playing, it will be added to queue

Playlist Commands

d!skip / d!s
  • Skips the current song and plays next in queue.
d!q
  • Show the list of songs in queue
d!shuffle / d!sh
  • Shuffle the queue
d!l / d!loop [all/single/off]
  • Loops the entire queue by default. d!loop single loops current track.
d!mv / d!move
  • Move song position in queue

Audio Commands

d!pause
  • Pauses the current song.
d!resume
  • Resumes the paused song.
d!prev
  • Goes back one song and plays the last song again.
d!np
  • Shows more details about the current song.
d!volume / d!vol
  • Adjust the volume 1-100%
  • Pass no arguments for current volume
d!remove / d!rm
  • Removes a song from the queue (defaults to last song)
d!stop / d!st
  • Stops the current song and clears the playqueue.

General

d!settings / d!setting / d!set
  • No Arguments: Lists server settings
  • Arguments: (setting) (value)
  • Omit the value to reset a setting
  • Example: d!setting start_voice_channel ChannelName
  • Administrators and DJs only
d!c
  • Connects the bot to the user's voice channel
d!dc
  • Disconnects the bot from the current voice channel
d!history
  • Shows you the titles of the X last played songs. Configurable in config.json

Utility

d!reset / d!rs
  • Resets the player. May recover the bot after unexpected problems.
d!ping
  • Test bot connectivity
d!addbot
  • Displays information on how to add the bot to another server of yours.
d!shutdown
  • Stops the bot completely. May be useful after you move the bot to background. Works only for bot owner.
  • Note that unlike other commands, this one doesn't have a slash variant. This allows it to be hidden.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Acknowledgements

https://github.com/adriansteffan/DiscordJockey

dandelionmusic's People

Contributors

solaluset avatar raptor123471 avatar dependabot[bot] avatar github-actions[bot] avatar mfatikk avatar lk2322 avatar derp4si avatar djpiper28 avatar pandabweer avatar rafaelsolvargas avatar

Stargazers

 avatar Fernando Alves avatar Joshua Brookes avatar  avatar  avatar Riccardo Pambianco avatar Han avatar Kiet avatar Can SEFEROGLU avatar Alberto Salvadore avatar Jonatas avatar Mattari avatar  avatar  avatar  avatar Lumix avatar  avatar  avatar Vladislav Mikhaylyuck avatar Daniel avatar Wasiul Islam Sakif avatar NIGHTCREW avatar Nazri avatar  avatar  avatar Pond (satorn) avatar Kaleb avatar  avatar Mustafa Can Elmacı avatar John Stampe avatar Tailan S.Vieira avatar João Vítor avatar  avatar  avatar leapbtw avatar  avatar  avatar tobokegao avatar Christopher Coss avatar King Sombra avatar Rome avatar

Watchers

 avatar Rome avatar  avatar

dandelionmusic's Issues

Use yt-dlp IEs to identify links

linkutils.identify_url and linkutils.identify_playlist should be reworked to use info extractors from yt-dlp where possible.

This will make detection more precise and may allow more sites to be supported.

module 'asyncio' has no attribute 'Runner'

Hi,
If i start the docker with:

version: '3'
services:
  bot:
    container_name: Plattenspieler
    image: krutyi4el/dandelion-music:master
    restart: always
    volumes:
      - /mnt/docker/plattenspieler/cookies:/app/config/cookies
    environment:
      - BOT_TOKEN=SOME_TOKEN
      - BOT_PREFIX=-
      - SPOTIFY_SECRET=SOME_TOKEN
      - SPOTIFY_ID=SOME_TOKEN
      - DATABASE_URL=sqlite:///settings.db

The following Error get's thrown and it ends in a restartloop:

   input("Press Enter to exit... ")
EOFError: EOF when reading a line
You can close this window and the bot will run in the background
To stop the bot, press Ctrl+C
Can't grab subprocess id, something is wrong!
The output is:
Traceback (most recent call last):
  File "/app/run.py", line 11, in <module>
    runpy.run_module("musicbot", run_name="__main__")
  File "/usr/local/lib/python3.10/runpy.py", line 227, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/musicbot/__main__.py", line 11, in <module>
    from musicbot.bot import MusicBot
  File "/app/musicbot/bot.py", line 13, in <module>
    from musicbot.audiocontroller import AudioController
  File "/app/musicbot/audiocontroller.py", line 10, in <module>
    from musicbot import linkutils, utils, loader
  File "/app/musicbot/loader.py", line 13, in <module>
    _runner = asyncio.Runner()
AttributeError: module 'asyncio' has no attribute 'Runner'. Did you mean: 'runners'?
Press Enter to exit... Traceback (most recent call last):
  File "/app/run.py", line 104, in <module>
    input("Press Enter to exit... ")
EOFError: EOF when reading a line
You can close this window and the bot will run in the background
To stop the bot, press Ctrl+C
Can't grab subprocess id, something is wrong!
The output is:
Traceback (most recent call last):
  File "/app/run.py", line 11, in <module>
    runpy.run_module("musicbot", run_name="__main__")
  File "/usr/local/lib/python3.10/runpy.py", line 227, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/musicbot/__main__.py", line 11, in <module>
    from musicbot.bot import MusicBot
  File "/app/musicbot/bot.py", line 13, in <module>
    from musicbot.audiocontroller import AudioController
  File "/app/musicbot/audiocontroller.py", line 10, in <module>
    from musicbot import linkutils, utils, loader
  File "/app/musicbot/loader.py", line 13, in <module>
    _runner = asyncio.Runner()
AttributeError: module 'asyncio' has no attribute 'Runner'. Did you mean: 'runners'?
Press Enter to exit... Traceback (most recent call last):
  File "/app/run.py", line 104, in <module>
    input("Press Enter to exit... ")
EOFError: EOF when reading a line
You can close this window and the bot will run in the background
To stop the bot, press Ctrl+C
Can't grab subprocess id, something is wrong!
The output is:
Traceback (most recent call last):
  File "/app/run.py", line 11, in <module>
    runpy.run_module("musicbot", run_name="__main__")
  File "/usr/local/lib/python3.10/runpy.py", line 227, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/musicbot/__main__.py", line 11, in <module>
    from musicbot.bot import MusicBot
  File "/app/musicbot/bot.py", line 13, in <module>
    from musicbot.audiocontroller import AudioController
  File "/app/musicbot/audiocontroller.py", line 10, in <module>
    from musicbot import linkutils, utils, loader
  File "/app/musicbot/loader.py", line 13, in <module>
    _runner = asyncio.Runner()
AttributeError: module 'asyncio' has no attribute 'Runner'. Did you mean: 'runners'?
Press Enter to exit... Traceback (most recent call last):
  File "/app/run.py", line 104, in <module>
    input("Press Enter to exit... ")
EOFError: EOF when reading a line
You can close this window and the bot will run in the background
To stop the bot, press Ctrl+C
Can't grab subprocess id, something is wrong!
The output is:
Traceback (most recent call last):
  File "/app/run.py", line 11, in <module>
    runpy.run_module("musicbot", run_name="__main__")
  File "/usr/local/lib/python3.10/runpy.py", line 227, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/musicbot/__main__.py", line 11, in <module>
    from musicbot.bot import MusicBot
  File "/app/musicbot/bot.py", line 13, in <module>
    from musicbot.audiocontroller import AudioController
  File "/app/musicbot/audiocontroller.py", line 10, in <module>
    from musicbot import linkutils, utils, loader
  File "/app/musicbot/loader.py", line 13, in <module>
    _runner = asyncio.Runner()
AttributeError: module 'asyncio' has no attribute 'Runner'. Did you mean: 'runners'?
Press Enter to exit... Traceback (most recent call last):
  File "/app/run.py", line 104, in <module>
    input("Press Enter to exit... ")
EOFError: EOF when reading a line
You can close this window and the bot will run in the background
To stop the bot, press Ctrl+C

Not playing music

I've modified the bot a bit, but not necessarily on the music plugin, just added other cogs.
The thing is, when I try to play music, for the first few times, it just connects to the VC but does nothing else (No errors in terminal, no response in discord). After more tries, it gives this error:
image
It says that the bot is not connected to voice, which it IS connected to.
image
Clearly its in the music channel.

No idea what causes this, can anyone help me with this?

yt-dlp needs to be updated in requirements.txt

yt-dlp needs to be updated in requirements.txt

currently causing crashes, when queuing up playlists
I didnt test anything else, but I did confirm that changing the version to 2023.2.17 does fix this issue.
I'm unable to make the change myself, my sourcetree is wack.

ModuleNotFoundError: No module named 'config'

After upgrading from version 1.4.1 to 1.5.2, I've been encountering this issue:

Traceback (most recent call last):
File "/musicbot/__main__.py", line 7, in <module>
from config import config
ModuleNotFoundError: No module named 'config'

Seems related to #35, but I don't follow the discussion. It there some kind of additional configuration that needs to be performed?

Some additional information:
I've historically hosted an instance of this bot w/ Pebblehost. but 1.4.1 spontaneously started encountering another issue, #30, which prompted the update. I configured the service to target /musicbot/__main__.py, as the /run.py breaks the console.

Module Not Found jsonc

I cant find a way to fix it, I tried pip install jsonc but it didnt work and i cant find anything on google

Player buttons

this is an enhancement.

Hi thx for keeping Dingolingo alive <3

I tested around with discord.ui elements, cause its way more convenient than always typing ^^

this is the current result:
image

it pops up automaticly after executing the play command and regenerating itself after using any button so it always is the last thing typed.
image

If using the "stop" button it disconnects and deleting the controller entirely.
image

At the moment it isn't deleted if the bot disconnects after 600s.
In addition if using the play command again the controller gets generated again. (thats ezz to fix but i have to figure out how i want to do it)
image

try it urself ^^ i just added it to the music.py... (should work)

music.zip

Adding a check for button callbacks

Hello, not much of an issue but more like a feature request.

Could it be possible to add some form of check on playback button presses so that they only work if the user is connected to the same voice channel as the bot is currently on?
As of now the buttons do their function even if pressed by someone who is not connected to any voice channel which can become an issue on less moderated servers.

Thank you for your work.

Spotify links do not work

Hi,
when i try to play
An age restricted song
this errormessage appears

Error: Unsupported site or age restricted content. To enable age restricted content check the documentation/wiki.

My question is now wich cookies from wich site are needed? I tried to use my spotify cookies but that didnt help...
I exported them using "Get cookies.txt LOCALLY".

After running the play command, the bot simply duplicates itself and doesn't play

Managed to connect the bot with the token, successfully in the server. Running help/settings command work normally, but after trying to play a song, the bot starts again and nothing happens and now there are 2 bots running which will result in duplicate actions after typing the help command or such.

After trying to run play again when 2 or more bots are running this error pops out directly into discord chat by the bot itself:

Command raised an exception: RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if name == 'main':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I'm not sure what I'm doing wrong, seems like I setup everything correctly but I must have missed something, can't seem to find the reason why the bot just runs twice instead of playing the music.

ModuleNotFoundError: No module named 'config'

Config doesn't work. I have downloaded requirements.txt and ran it using pip but anything related to dirs doesnt work; from musicbot.bot etc nothing works. Majorly from config import config doesnt work

Got error after install requirements

When install requirements, i got this erro

ERROR: Could not build wheels for aiohttp, which is required to install pyproject.toml-based projects

I changed aiohttp version to 3.8.2 then install complete. But when run run.py, i got this error

D:_Working\BackEnd\DandelionMusic-master>run.py
Traceback (most recent call last):
File "D:_Working\BackEnd\DandelionMusic-master\run.py", line 4, in
from discord.ext import commands
File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands_init_.py", line 18, in
from .flags import *
File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\flags.py", line 71, in
@DataClass
^^^^^^^^^
File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1220, in dataclass
return wrap(cls)
^^^^^^^^^
File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1210, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'discord.utils._MissingSentinel'> for field name is not allowed: use default_factory

Im newbie to Python so i dont know how to fix it though im google this morning :(

Slash Commands

Would you ever make the music commands use slash command inputs? I remember asking Raptor this a lot but sadly IDK if he's working on DingoLingo anymore. :/

The queue button doesnt work

when i press the queue button i get an error in html format :
Ignoring exception in view for item <MusicButton style=<ButtonStyle.secondary: 2> url=None disabled=False label=None emoji= row=1>:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.11/site-packages/discord/ui/view.py", line 414, in _scheduled_task
await item.callback(interaction)
File "/home/container/musicbot/audiocontroller.py", line 53, in callback
await res
File "/home/container/musicbot/audiocontroller.py", line 238, in queue_callback
await ctx.send(
File "/home/container/musicbot/bot.py", line 173, in send
res = await self.respond(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/ext/bridge/context.py", line 93, in respond
return await self._respond(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/ext/bridge/context.py", line 146, in respond
return await self.get_super("respond")(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/commands/context.py", line 286, in respond
return await self.followup.send(*args, **kwargs) # self.send_followup
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/webhook/async
.py", line 1745, in send
data = await adapter.execute_webhook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/webhook/async
.py", line 198, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0):

</script> <script>(function(){var js = "window['__CF$cv$params']={r:'7d404e615d874172',m:'ypjoy3c68GKMmG5NqSwGab0iUfd83ytNqezzkxVxQ8U-1686218619-0-AYpY58ZY/PPZ6ko6DFT3Z8sdD0vN43D+W5rD4lgK+EsW'};_cpo=document.createElement('script');_cpo.nonce='',_cpo.src='/cdn-cgi/challenge-platform/scripts/invisible.js',document.getElementsByTagName('head')[0].appendChild(_cpo);";var _0xh = document.createElement('iframe');_0xh.height = 1;_0xh.width = 1;_0xh.style.position = 'absolute';_0xh.style.top = 0;_0xh.style.left = 0;_0xh.style.border = 'none';_0xh.style.visibility = 'hidden';document.body.appendChild(_0xh);function handler() {var _0xi = _0xh.contentDocument || _0xh.contentWindow.document;if (_0xi) {var _0xj = _0xi.createElement('script');_0xj.nonce = '';_0xj.innerHTML = js;_0xi.getElementsByTagName('head')[0].appendChild(_0xj);}}if (document.readyState !== 'loading') {handler();} else if (window.addEventListener) {document.addEventListener('DOMContentLoaded', handler);} else {var prev = document.onreadystatechange || function () {};document.onreadystatechange = function (e) {prev(e);if (document.readyState !== 'loading') {document.onreadystatechange = prev;handler();}};}})();</script> The CD emoji button doesnt work either. The play pause shuffle skip loop stop work fine

Hardwareacceleration?

Hey idk if thats possible, but i am using the bot in a simple python docker on my nas. If i add bigger playlists (55songs+) it often happens that the bot is crashing. My question is now if its somehow possible to use hardware exceleration for the transcoding. In jellyfin f.e it works via a DEVICE variable. But thats just a thought that i just had...

Cannot play music

[youtube] 9fMi070Fulw: Downloading webpage
[youtube] 9fMi070Fulw: Downloading android player API JSON
Playing https://www.youtube.com/watch?v=9fMi070Fulw
Ignoring exception in command play:
Traceback (most recent call last):
File "C:\python\lib\site-packages\discord\ext\commands\core.py", line 184, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\lokey\OneDrive\桌面\DandelionMusic-master\musicbot\commands\music.py", line 43, in _play_song
song = await audiocontroller.process_song(track)
File "C:\Users\lokey\OneDrive\桌面\DandelionMusic-master\musicbot\audiocontroller.py", line 206, in process_song
await self.play_song(song)
File "C:\Users\lokey\OneDrive\桌面\DandelionMusic-master\musicbot\audiocontroller.py", line 143, in play_song
discord.FFmpegPCMAudio(
File "C:\python\lib\site-packages\discord\player.py", line 314, in init
super().init(source, executable=executable, args=args, **subprocess_kwargs)
File "C:\python\lib\site-packages\discord\player.py", line 174, in init
self._process: subprocess.Popen = self._spawn_process(args, **kwargs)
File "C:\python\lib\site-packages\discord\player.py", line 191, in _spawn_process
raise ClientException(f"{executable} was not found.") from None
discord.errors.ClientException: ffmpeg was not found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\python\lib\site-packages\discord\ext\commands\bot.py", line 344, in invoke
await ctx.command.invoke(ctx)
File "C:\python\lib\site-packages\discord\ext\commands\core.py", line 951, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\python\lib\site-packages\discord\ext\commands\core.py", line 193, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
Exception ignored in: <function AudioSource.del at 0x00000236DFC134C0>
Traceback (most recent call last):
File "C:\python\lib\site-packages\discord\player.py", line 127, in del
self.cleanup()
File "C:\python\lib\site-packages\discord\player.py", line 247, in cleanup
self._kill_process()
File "C:\python\lib\site-packages\discord\player.py", line 198, in _kill_process
proc = self._process
AttributeError: 'FFmpegPCMAudio' object has no attribute '_process'

Issue on playing songs

Hi! From this morning the bot doesn't want to reproduce music.. when you give to him the command play with the song name, it will appear on discord that the bot is writing but nothing happens... the bot just join the vocal channel.

This is the error on the terminal:

`Startup Complete
Task was destroyed but it is pending!
task: <Task pending name='pycord: on_message' coro=<Client._run_event() running at /usr/local/lib/python3.8/dist-packages/discord/client.py:378> wait_for=<Future pending cb=[BaseSelectorEventLoop._sock_read_done(8)(), <TaskWakeupMethWrapper object at 0x7ff316c16310>()]>>
Playing megaride
Ignoring exception in command play:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 178, in wrapped
ret = await coro(*args, **kwargs)
File "/root/DingoLingo/musicbot/commands/music.py", line 43, in _play_song
song = await audiocontroller.process_song(track)
File "/root/DingoLingo/musicbot/audiocontroller.py", line 400, in process_song
await self.play_song(song)
File "/root/DingoLingo/musicbot/audiocontroller.py", line 338, in play_song
self.guild.voice_client.play(
File "/usr/local/lib/python3.8/dist-packages/discord/voice_client.py", line 658, in play
raise ClientException("Not connected to voice.")
discord.errors.ClientException: Not connected to voice.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", line 347, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 950, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 187, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: Not connected to voice.
`

Add latest tag in docker hub

Can you please add the :latest tag in docker? Thak you! (i'm using casaOS but for a bug in the last release i can only pull with the tag "latest". Thank you!

Bot disconnects even if vc_timeout is False

Hey,

I wanted to let the bot play 24/7, I just realised the config settings don't work for the VC_timeout, or I misunderstood the setting. At least the bot disconnects after 10 minutes when no one is in the channel.
My current settings:
Note: I tried changing the values in the config.json and in the config.py itself + I tried to set "vc_timeout" via command on discord to false.


// seconds
  "VC_TIMEOUT": 600,
  // default template setting for VC timeout
  // true = yes, timeout; false = no timeout
  "VC_TIMEOUT_DEFAULT": false,
  // allow or disallow editing the vc_timeout guild setting
  "ALLOW_VC_TIMEOUT_EDIT": true,

Changing the VC_TIMEOUT to a different value indeed changes the time til it disconnects when no one is in the channel.

Docker doesn't start

Hi,
if i try to use the newest docker container it throws:

Traceback (most recent call last):
  File "/app/run.py", line 92, in <module>
    input("Press Enter to exit... ")
EOFError: EOF when reading a line
You can close this window and the bot will run in the background
To stop the bot, press Ctrl+C
Can't grab subprocess id, something is wrong!
The output is:
Traceback (most recent call last):
  File "/app/run.py", line 11, in <module>
    runpy.run_module("musicbot", run_name="__main__")
  File "/usr/local/lib/python3.10/runpy.py", line 227, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/musicbot/__main__.py", line 32, in <module>
    bot = MusicBot(
  File "/app/musicbot/bot.py", line 26, in __init__
    self.db_engine = create_async_engine(config.DATABASE)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/ext/asyncio/engine.py", line 85, in create_async_engine
    sync_engine = _create_engine(url, **kw)
  File "<string>", line 2, in create_engine
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 277, in warned
    return fn(*args, **kwargs)  # type: ignore[no-any-return]
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 547, in create_engine
    u = _url.make_url(url)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 838, in make_url
    return _parse_url(name_or_url)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 898, in _parse_url
    raise exc.ArgumentError(
sqlalchemy.exc.ArgumentError: Could not parse SQLAlchemy URL from string ''
Press Enter to exit... 

i only used the variables:
- BOT_TOKEN=
- BOT_PREFIX=-
- SPOTIFY_SECRET=
- SPOTIFY_ID=

it seems to me like the image is broken...
thx for your help.

Opus

Guys this is not really an issue with the bot but rather about me. I'm trying to change the host service these days and im currently trying a nix based service. I added pkgs.ffmpeg in the packages list in the nix.dev file, and it worked just fine, so i did the same thing for opus and added pkgs.libopus as well, but for some reason it kept saying opus was not found, even though ffmpeg was found when installed in the same file. am i missing something here? ty, sorry for the lack of detail the server crashed and i cant rlly provide the error details until its back up i will try to when it is tho ty.

Please help me with this error I dont know what it means

Traceback (most recent call last):
File "/home/container/run.py", line 106, in
main()
File "/home/container/run.py", line 20, in main
runpy.run_module("musicbot", run_name="main")
File "/usr/local/lib/python3.9/runpy.py", line 228, in run_module
return _run_code(code, {}, init_globals, run_name, mod_spec)
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/container/musicbot/main.py", line 65, in
bot.run(config.BOT_TOKEN, reconnect=True)
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 766, in run
return future.result()
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 745, in runner
await self.start(*args, **kwargs)
File "/home/container/musicbot/bot.py", line 52, in start
return await super().start(*args, **kwargs)
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 708, in start
await self.login(token)
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 562, in login
data = await self.http.static_login(token.strip())
File "/home/container/.local/lib/python3.9/site-packages/discord/http.py", line 420, in static_login
data = await self.request(Route("GET", "/users/@me"))
File "/home/container/.local/lib/python3.9/site-packages/discord/http.py", line 326, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.
/usr/local/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 5 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '

Error: No Bot Token

Hello,

I'm having some issues while running the bot. I've double checked my configs and got everything installed but i can't still start it, this error displays every time i try to run the bot.

Error: No bot token!

There's in fact a VALID bot token on the config.py

Common question about connection (websocket) flow handling

Hey,
this prolly don't belong in the issues tab but I wasn't able to find any discussionn tab or similar to ask.

As I'm using the bot for quite a while now I noticed that it reconnects itself properly and won't stop streaming the audio.
I'm currently trying to set up a little bot for a livestream as well but noticed with the help of the logger that the websocket connection randomly gets closed from time to time.
It seems this is the common discord connection flow so nothing you can really do about it but when the connection closes my bot obv leaves the voice channel and doesn't reconnect and resume playing.

My idea was to write an error handler with the on_error event but just wanted to quickly ask how you managed to get rid off that "issue". I guess you should've encountered the same while developing your bot.

Any hint is kindly appreciated.

run.py start error

Getting errors while running py.

Traceback (most recent call last): File "run.py", line 7, in <module> from musicbot.bot import MusicBot File "/home/DandelionMusic/musicbot/bot.py", line 4, in <module> from discord.ext import bridge File "/usr/local/lib/python3.8/dist-packages/discord/ext/bridge/__init__.py", line 26, in <module> from .bot import * File "/usr/local/lib/python3.8/dist-packages/discord/ext/bridge/bot.py", line 32, in <module> from .context import BridgeApplicationContext, BridgeExtContext File "/usr/local/lib/python3.8/dist-packages/discord/ext/bridge/context.py", line 28, in <module> from discord.commands import ApplicationContext File "/usr/local/lib/python3.8/dist-packages/discord/commands/__init__.py", line 26, in <module> from .context import * File "/usr/local/lib/python3.8/dist-packages/discord/commands/context.py", line 69, in <module> class ApplicationContext(discord.abc.Messageable): File "/usr/local/lib/python3.8/dist-packages/discord/commands/context.py", line 337, in ApplicationContext @discord.utils.copy_doc(Interaction.edit_original_message) AttributeError: type object 'Interaction' has no attribute 'edit_original_message'

can you check this error?

[tls @ 0x55b56c8b1040] Error in the pull function.
WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
WARNING: [youtube] HTTP Error 400: Bad Request. Retrying (1/3)...
WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
WARNING: [youtube] HTTP Error 400: Bad Request. Retrying (2/3)...
WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
WARNING: [youtube] HTTP Error 400: Bad Request. Retrying (3/3)...
WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
WARNING: [youtube] Unable to download API page: HTTP Error 400: Bad Request (caused by <HTTPError 400: Bad Request>); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U

Bad sound quality

The sound quality is very poor now. Any fixes? The audio is distorted and not stereo at all.

Looped song stops playing when URL expires

When a song played from YouTube stays in cache for a long time, its URL expires and attempting to play it will produce the error:

[https @ 0x55b83548e740] HTTP error 403 Forbidden
<long raw URL here>: Server returned 403 Forbidden (access denied)

To reproduce

Make a song play on loop and wait several hours until URL expires and stops playing.

Possible solution

Check the error argument of next_song (and refresh the URL if needed):

https://github.com/Krutyi-4el/DandelionMusic/blob/94534434aaccde216df00fa636b9bf42e2980816/musicbot/audiocontroller.py#L271

Error on installing requirements

I'm getting the following output w/ error message when running pip -r install requirements.txt

Collecting py-cord[voice]
  Using cached https://github.com/Krutyi-4el/pycord/archive/9c5af3d15e3011ff1e29b55e3b1063391d0455d6.zip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Processing ./config
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /tmp/tmpkndosm0d_in_process.py get_requires_for_build_wheel /tmp/tmpojyl_ksp
       cwd: /tmp/pip-req-build-hsxj3org
  Complete output (17 lines):
  Traceback (most recent call last):
    File "/tmp/tmpkndosm0d_in_process.py", line 280, in <module>
      main()
    File "/tmp/tmpkndosm0d_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpkndosm0d_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-uf3fq3sp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-uf3fq3sp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-uf3fq3sp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 484, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/tmp/pip-build-env-uf3fq3sp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
      exec(code, locals())
    File "<string>", line 16, in <module>
  ModuleNotFoundError: No module named 'config.config'
  ----------------------------------------
WARNING: Discarding file:///root/Dandelion-Bot/DandelionMusic/config. Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpkndosm0d_in_process.py get_requires_for_build_wheel /tmp/tmpojyl_ksp Check the logs for full command output.
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpkndosm0d_in_process.py get_requires_for_build_wheel /tmp/tmpojyl_ksp Check the logs for full command output.

I already tried installing the config module, but that seems to already exist:

Requirement already satisfied: config in /usr/local/lib/python3.9/dist-packages (0.5.1)

any ideas what I might be missing?

Bot token

Hey, there is an issue with the token. Even when you add the token to config or bot.py directly you still get the error no bot token.

Error when requirements.txt tries to install py-cord[voice]

Hello, I'm having a problem when it comes to installing the requirements. When it gets to the py-cord[voice] installation it throws this error

Defaulting to user installation because normal site-packages is not writeable
Collecting py-cord[voice]
  Using cached https://github.com/Krutyi-4el/pycord/archive/9c5af3d15e3011ff1e29b55e3b1063391d0455d6.zip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
  WARNING: Generating metadata for package py-cord produced metadata for project name unknown. Fix your #egg=py-cord fragments.
Discarding https://github.com/Krutyi-4el/pycord/archive/9c5af3d15e3011ff1e29b55e3b1063391d0455d6.zip#egg=py-cord: Requested unknown from https://github.com/Krutyi-4el/pycord/archive/9c5af3d15e3011ff1e29b55e3b1063391d0455d6.zip#egg=py-cord (from -r requirements.txt (line 1)) has inconsistent name: filename has 'py-cord', but metadata has 'unknown'
ERROR: Could not find a version that satisfies the requirement py-cord (unavailable) (from versions: 1.7.3, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0b4, 2.0.0b5, 2.0.0b6, 2.0.0b7, 2.0.0rc1, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1)
ERROR: No matching distribution found for py-cord (unavailable)

I'm not quite sure how to go about fixing this, so any help would be greatly appreciated.

Musicbot failed on startup when i hosted

i had the following error when i started the bot
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/discord/http.py", line 418, in static_login
data = await self.request(Route("GET", "/users/@me"))
File "/home/container/.local/lib/python3.9/site-packages/discord/http.py", line 371, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/musicbot/main.py", line 65, in
bot.run(config.BOT_TOKEN, reconnect=True)
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 765, in run
return future.result()
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 744, in runner
await self.start(*args, **kwargs)
File "/home/container/musicbot/bot.py", line 52, in start
return await super().start(*args, **kwargs)
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 707, in start
await self.login(token)
File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 561, in login
data = await self.http.static_login(token.strip())
File "/home/container/.local/lib/python3.9/site-packages/discord/http.py", line 422, in static_login
raise LoginFailure("Improper token has been passed.") from exc
discord.errors.LoginFailure: Improper token has been passed.
Set the correct token in config.json
/usr/local/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 5 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '

Bot tries to download then breaks on unavailable video

i've been having this problem for many many months now across many updates and can't come across any solution when researching and tinkering with the code myself.

the most common reason for this error seems to be that a video is too long or is unavailable (deleted/private/other). it's recognizing that the video is unavailable, but continues trying to download it instead of removing or skipping over it. my thought was that some type of error handler or filter for these types of videos could help, but i'm not sure where it would go in the code.

This is an excerpt from one of my error logs: VideoUnavailable-log.txt. I used this playlist specifically because I know it has an unavailable video in it.

[as a sidenote, i've been trying to figure out where the options for yt-dl in the source for this are but haven't been able to find them. there's an option for something similar to this, but I forgot what and don't think it would help anyways.]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.