Simple musicbot based on LexBot and discord-player.
| Command | Description |
|---|---|
-play |
Plays a song or a playlist. |
-pause |
Pauses the current playlist. |
-resume |
Resumes the current playlist. |
-shuffle |
Shuffles the current playlist. |
-skip |
Skips the current song. |
-stop |
Displays the full queue. |
-queue |
Stops the current playlist. |
Each commit in main leads into a docker images in the github container registry.
You can pull the image via
docker pull ghcr.io/ottrone/goofy.ts:latestand run the bot via
docker run --env-file .env -d --restart unless-stopped ghcr.io/ottrone/goofy.ts:latestRemember to rename the example.env file to .env before and enter your token.
-
Install all dependencies via
npm installafter cloning the repo. -
Rename the
example.envfile to.envand add your Discord bot token and Guild-ID for slash commands. (not necessary for global slash commands)
TOKEN=
GUILD=
.env is part of the .gitignore file so changes won't be committed.
| Command | Description |
|---|---|
npm run prebuild |
Extract version from package.json. |
npm run build |
Build the typescript code. |
npm run lint |
Runs the linter on the code. |
npm run start |
Runs the bot from the built JavaScript. |
npm run debug |
Debug the TypeScript in watch mode. |
To add new commands add a .ts file in /commands/ or any subdirectory of /commands/.
The command implements the Command interface with the following required properties:
export = {
name: '',
category: '',
description: '',
run: ({ }: CallbackOptions) => {
// do stuff
}
} as Command;Check the CallbackOptions interface for possible properties.
member is available for every CommandType. message and args are only available for NORMAL commands aka !commands while interaction is only available for SLASH commands.
Its mandatory to define the type if it's supposed to be SLASH command only
Example:
import { Command, CommandType } from '../interfaces/command';
import { CallbackOptions } from '../interfaces/CallbackOptions';
export = {
name: 'ping',
type: CommandType.SLASH,
category: 'LexBot',
description: 'Sends back pong',
run: ({ interaction }: CallbackOptions) => {
if (!interaction) return;
interaction.reply('Pong!');
},
} as Command;Is the type set to SLASH or BOTH it will be added dynamically to the Discord command list. (Remember to set up a proper run function for it)