nlitz88 / ratbot Goto Github PK
View Code? Open in Web Editor NEWDiscord music bot
Discord music bot
Here are a few improvements that would be nice to see that are featured in other bots
Just think about different situations where this makes sense and try to add it. I already added it for playing new songs I think.
The skip function of the bot works sometimes but then throws an error other times. Not exactly sure what causes the issue, or why it occurs only sometimes.
When the bot is paused and someone sends another play
command (with a link or not), the bot will just resume playback. However, whether the bot is playing or not, if I send the bot a play command with a link or song name, I expect that song I just specified to be added to the queue.
While the current behavior isn't inherently wrong, it makes the bot a bit harder to use. I'd say change the behavior to always add a specified song to the queue, whether it's paused or not. Maybe use play to unpause only if the user doesn't provide a link (however, even this could be ambiguous).
OR, always use play as an unpause button like it currently is, but also enqueue the new song if one is specified! This might be the best of both worlds.
I think the most explicit, least ambiguous behavior is to just force users to user resume
to unpause playback, but maybe people aren't accustomed to that.
Basically, when you run a play <song>
command when not connected to a voice channel, the bot doesn't respond telling you to first connect to a voice channel. Instead, it just silently fails.
On the command line, however, it does output the exception:
[2022-12-23 03:33:54] [ERROR ] discord.ext.commands.bot: Ignoring exception in command play
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
ret = await coro(*args, **kwargs)
File "/app/music_cog.py", line 64, in play
voice_channel = ctx.author.voice.channel
AttributeError: 'NoneType' object has no attribute 'channel'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1349, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
Need to add command that toggles repeat on/off
It'd be nice to have a much smaller, much more concise setup guide as a quick reference. Right now, the readme provides long-winded explanations every step of the way--but a lot of that can get lost on users (people don't like to read).
So, consider creating a smaller, more to-the-point Getting Started or Quick Start section at the top of the readme that just lists bulleted steps to getting a bot up and running, without having to understand much behind it.
Add support for:
While I'm not 800% sure what the current implementation is doing, it seems like the bot is just sending over audio it's streaming from YouTube. This works okay, but after a bit of testing, it's performing very poorly. It's jitters, hesitates, and sounds pretty bad.
What I'd like to investigate is using YouTube-dl to actually download the files, store them on disk, then stream the data from file. While this may mean slightly higher response times for those with slower download speeds, the users will be able to configure an LRU (least recently used) music-cache directory. Thus, for songs that have already been selected, the request latency will be significantly reduced, as it'll forgo the download and play directly from disk.
I'm able to queue up and play a song, and then pause it. I can then also resume the song. HOWEVER, when I go to pause playback again, it doesn't work. The bot doesn't report any error in its output, but it doesn't pause.
People will most likely be running this bot on a home network on some sort of VPS in their name. While it may not matter in the grand scheme of things, giving the owner the option to block song requests for inhumane YouTube content is probably a good idea. I.e., maybe add an environment variable that the owner can set that would switch on some sort of NSFW/NSFL/profanity filter for the kinds of requests that users make.
A lot of the music bot's we've used in the past have their prefix listed in their status--ratbot should also set a status that provides a friendly summary of how to use it.
Additionally, while this is a separate issue, it'd be nice in the future to have an API in the future with a web interface that would allow the user to configure the prefix from there. OR, in the meantime, just allow them to configure it in the command line. Just some food for thought.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.