GithubHelp home page GithubHelp logo

daanisaanwezig / discord-radio Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 3.0 144 KB

Bring back the music to Discord

License: GNU General Public License v3.0

TypeScript 100.00%
hacktoberfest hacktoberfest2021

discord-radio's Introduction

Daanisaanwezig

Hi there, I am Daan.

A full-stack webdeveloper currently studying (web)design. I'm always open for a challenge, new project or a hackathon, so expect to see me during events like Hacktoberfest or GameJam.

discord-radio's People

Contributors

adryan30 avatar croustys avatar daanisaanwezig avatar danielknerr avatar n-shar-ma avatar stijnvdkolk avatar victoria-dr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

discord-radio's Issues

Search music that can be used freely by users

The issue

The bot should be supplied with multiple playlists with songs of different genres so that the end user doesn't need to source their songs themselves.
The music has to be copyright free because broadcasting copyrighted music is against the laws and can cause problems especially when done in bigger servers.

Requirements

The songs should be copyright free without the need to mention the artist, track name or label it is released under.
Each genre should have at least 10 track and I would recommend some of the following genres to be sourced:

  • Dubstep
  • Deep house/tropical house music or music with a more relaxed vibe like lounge music
  • Rock music or other not fully electronically produced music
  • Trap

Keep in mind that the genres mentioned above should be used as guidelines, feel free to add more genres or add more tracks.

New command: /nowplaying

Feature request

Add a /nowplaying command that shows the song that is currently playing, this could be pulled from the status of the bot which is already displaying the song it is playing at that moment.
A command like this can be useful when the bot is not displayed high up in the member list and thus making it more difficult to see the status of the bot.

Incorrect identification of folders

Current behavior

The bot only uses fs.existsSync as a check before accessing folders:

if (!fs.existsSync(this.musicFolder)) {
return await interaction.reply( "I couldn't find the music folder, are you sure it exists?" )
}

This is incorrect, because fs.existsSync only checks if the path exists, but not if the path refers to a folder. No checks are done when accessing the contents of the music folder:

const promise = new Promise<String[]>((resolve, reject) => {
let tracklist = []
fs.readdir( `../music/${station}`, ( err, files ) => {
if ( err ) console.log( err )

This issue results in three bugs:

  1. a crash with an ENOTDIR error if the music "folder" is actually a file
  2. an ENOTDIR error (without crashing) without a proper error-message when trying to play a station that exists, but isn't a folder
  3. listing everything (including files) in the music folder when executing /stations

Expected behavior

The bot should (in the order of the bugs listed above):

  1. not crash, but instead tell the user that the music folder is missing.
  2. not generate an error
  3. only list folders inside the music folder as stations

How to reproduce this bug

Bug 1 can be reproduced by:

  • replacing the music folder with a file named music
  • executing the /stations command

Bugs 2 and 3 can be reproduced by:

  • adding a file test to the music folder
  • executing /stations
  • executing /play station:test

Bug: Switch station button crashes bot when it is being pressed by someone not in a voice channel

Current behavior

When the person pressing the switch station button is not in a voice channel it crashes the bot.

Expected behavior

The bot should notify the user that you have to be in a voice channel when running the command.

How to reproduce this bug

Run the play command to switch radio station to get the prompt with the button, leave the channel and press the button.

Note: This issue also hooks into #28 since it also regards the usage of buttons in this case by people who did not run the command.

Station name length

As discussed in the comments of PR #17, station names that are too long can cause compatibility issues with the Discord API.

While most operating systems limit the name of a folder to 255 characters, Discord usually imposes stricter limits on the length of fields. By browsing the Discord API it appears that 100 characters is a common limit. To ensure compatibility (now and in the future) we should limit the length a station name is allowed to be (preferably with some buffer so we can add additional data into the field).

I imagine that most users would use short names for their playlists, so a limit like 50 characters shouldn't interfere with the user-experience.

Status stays after running stop command

Current behavior

After running the stop command the bot still displays the name of the track it was playing as its status.

Expected behavior

The status gets cleared, optionally there could be a default status that can be specified in the configuration file.

How to reproduce this bug

You can reproduce this bug by starting it using the /start command and stopping it again after using the /stop command.

Add volume normalization

Feature request

At the moment songs just get played, Discord has a built in option to change the volume when playing the next song, this should be used to play all songs at the same volume to avoid fluctuations and preventing users from needing to manually adjust the volume each time.

Bug: nowplaying command doesn't work as expected after stopping music

Current Behaviour

image

After stopping the music, and then running the /nowplaying command, it shows the last played (and now stopped) track as the one being currently playing

Expected Behaviour

The bot should reply to the /nowplaying command saying there is no song currently being played

How to Reproduce the Bug

Run the following commands in order:

  • /play {station}
  • /stop
  • /nowplaying

Add how-to-host.md

Feature request

Currently there is no text tutorial on how to host the bot, a file should be added that explains all the steps needed to host the bot yourself, it should also mention the need of external programs like Node.js.
This file should be located in the root directory and be pointed to in the README.md.

Adding a how-to-host.md will make it easier for other people to host the bot without much knowledge about Discord bots or development in Node.js.

Add the option to change radio station

Feature request

Right now when the bot is playing music in the channel you are in and you want to change the radio station by running /play [radio-station] you get a message saying I am already playing music in your channel., while this does work as intended I would like that message to be extended with a button asking if you would like to switch to the specified radio station instead.

This would make using the bot easier because you no longer need to stop the bot first to play a different radio station.

*Note: this feature should use the new button feature added to Discord, not a emoji reaction.

Add support for multiple radio stations (playlists)

Feature request

Currently only music in the music folder gets played, this should be changed so that you can create sub folders in that folder that will act as playlists.
When no radio station gets selected it should ask which one you want to play from and preferably show a list of all the available radio stations.

Bug: Uppercase in station name on Ubuntu doesn't work when running the play command

Current behavior

When having a station name with a upper case in the name like Test for example, it will not be recognized when running the /play command on Ubuntu, on Windows (10) however it does work.

Expected behavior

It should still recognize the folder and start playing the song.

How to reproduce this bug

Run the bot on Ubuntu desktop (tested on version: 18.04.6 LTS) and create a radio station with a uppercase in the folder name.
Once the bot is online try to run /play [name of that station with a uppercase] and get a response that it can not find the radio station.

New command: /stations

Feature request

Add a /stations command that displays all radio stations that are available, this should be automatically generated by checking for sub folders in the music folder.
This is useful for when not all radio stations are known allowing the user to get a list of all of them.

Bug: Everyone can use the switch station button

Current behavior

When using the play command to switch stations someone else who has not ran the command can press the button.

Expected behavior

The person that did not use the command should either not be able to press the button or see the message that has the button attached to it.

How to reproduce this bug

Run the play command to switch the station and use a different Discord account to press the button.

Bug: Stations command can crash the bot

Current behavior

When there are too many stations and the list of all stations exceeds 4096 the bot crashes with a invalid form body error for the embed.

Expected behavior

It should not be able to crash, instead it could warn on startup or don't show all stations to stay under the character limit.
Other solutions are more than welcome to be discussed in the comments.

How to reproduce this bug

Create a lot of stations in the music folder with long names so that the combined characters in the names of the stations exceed 4096 and run the /stations command.

This issue also partially hooks into #20 since it also regards the character limit of stations and could add to preventing to exceed the character limit.

Bug: switching to a new radio station can result in the status changing to playing no music

Current behavior

When switching radio stations using the play command the status can get changed to no music!.

Expected behavior

It should display the song that is currently being played.

How to reproduce the bug

When using the play command multiple times in a row there is a chance that instead of the current song playing it displays no music! as the status. The problem is most likely caused by firing the change status function twice and relying on one being executed later than the other.

Button to switch station stays clickable after using it

Current behavior

Right now when using the play command when the bot is already playing music it asks you if you would like to switch stations, when using the button the button stays and can still be used, this should not be possible.

Wanted behavior

When the button is pressed the button should be removed and the radio station that has been switched to should be displayed.

Create a logo for the bot

Feature request

Right now there is no logo provided for people who want to host this bot their selves, this means that they either have to create a logo by them selves or have to stick to the default Discord profile picture.

The logo should be simple yet clearly indicate that the bot is a music Discord bot, how this is implemented in the logo is up to the person creating it.

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.