mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
Merge branch 'mariusbegby:main' into main
This commit is contained in:
42 files changed
+690
-436
No files matched your search
@@ -0,0 +1,23 @@
|
|||||||
|
name: Add contributors
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-contributors:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: BobAnkh/add-contributors@master
|
||||||
|
with:
|
||||||
|
CONTRIBUTOR: '### Contributors'
|
||||||
|
COLUMN_PER_ROW: '10'
|
||||||
|
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
IMG_WIDTH: '50'
|
||||||
|
FONT_SIZE: '14'
|
||||||
|
PATH: '/README.md'
|
||||||
|
COMMIT_MESSAGE: 'docs(README): update contributors'
|
||||||
|
AVATAR_SHAPE: 'round'
|
||||||
|
IGNORED_CONTRIBUTORS: 'apps/github-actions, apps/dependabot'
|
||||||
|
BRANCH: 'main'
|
||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/config.json
|
|
||||||
/src/config.js
|
|
||||||
/.env
|
/.env
|
||||||
/app-*.log
|
/config/*.js
|
||||||
|
!/config/default.js
|
||||||
/logs
|
/logs
|
||||||
/logs/app-*.log
|
/logs/app-*.log
|
||||||
/cookies.json
|
/cookies.json
|
||||||
|
|||||||
@@ -1,5 +1,87 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [4.0.1](https://github.com/mariusbegby/cadence-discord-bot/compare/v4.0.0...v4.0.1) (2023-08-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Miscellaneous
|
||||||
|
|
||||||
|
* Update README.md ([88d0019](https://github.com/mariusbegby/cadence-discord-bot/commit/88d00190365f6e09f005e26ef9076ad2370dd306))
|
||||||
|
|
||||||
|
## [4.0.0](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.7.4...v4.0.0) (2023-08-19)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* Added new config system with config npm package
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Added new config system with config npm package ([2da7cb3](https://github.com/mariusbegby/cadence-discord-bot/commit/2da7cb360a0bdccd44888f460c0778a465e25079))
|
||||||
|
|
||||||
|
## [3.7.4](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.7.3...v3.7.4) (2023-08-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Minor changes and bug fixes
|
||||||
|
|
||||||
|
* adjustments to error and permission handling ([6bcc489](https://github.com/mariusbegby/cadence-discord-bot/commit/6bcc489e840d9fa69fdaa1de002e2134ddf931b8))
|
||||||
|
|
||||||
|
## [3.7.3](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.7.2...v3.7.3) (2023-08-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Minor changes and bug fixes
|
||||||
|
|
||||||
|
* check if interaction has timed out or can be replied to ([c0894d2](https://github.com/mariusbegby/cadence-discord-bot/commit/c0894d214a60290947e800a09e1747dda2702cce))
|
||||||
|
|
||||||
|
## [3.7.2](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.7.1...v3.7.2) (2023-08-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Minor changes and bug fixes
|
||||||
|
|
||||||
|
* update mediaplex to latest version ([6b48491](https://github.com/mariusbegby/cadence-discord-bot/commit/6b484919768b3477e91c002db5fc2f45cdf4436a))
|
||||||
|
|
||||||
|
## [3.7.1](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.7.0...v3.7.1) (2023-08-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Minor changes and bug fixes
|
||||||
|
|
||||||
|
* remove unused import ([3e6dc6e](https://github.com/mariusbegby/cadence-discord-bot/commit/3e6dc6e926ddfda3ce70c0b3a5725c9d0d957e80))
|
||||||
|
|
||||||
|
## [3.7.0](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.6.5...v3.7.0) (2023-08-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Change from yt-stream to @distube/ytdl-core for streaming audio ([fa15af5](https://github.com/mariusbegby/cadence-discord-bot/commit/fa15af5b1445c6c7ec5f2ea68cbefa5fe5c2b190))
|
||||||
|
|
||||||
|
## [3.6.5](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.6.4...v3.6.5) (2023-08-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Minor changes and bug fixes
|
||||||
|
|
||||||
|
* Updated dependencies, use discord-player new dev versions ([c04b3c9](https://github.com/mariusbegby/cadence-discord-bot/commit/c04b3c944cc5aaf39e320b3ce8358bc7f9f5c6d2))
|
||||||
|
|
||||||
|
## [3.6.4](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.6.3...v3.6.4) (2023-08-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Minor changes and bug fixes
|
||||||
|
|
||||||
|
* Updated dependencies ([7b8f86b](https://github.com/mariusbegby/cadence-discord-bot/commit/7b8f86bd1d933ab98acce719303e390a01312f91))
|
||||||
|
|
||||||
|
|
||||||
|
### Miscellaneous
|
||||||
|
|
||||||
|
* **deps:** bump discord.js from 14.11.0 to 14.12.1 ([f799c95](https://github.com/mariusbegby/cadence-discord-bot/commit/f799c955a9c8cc2d1800375e08de7110b6bab5ec))
|
||||||
|
* **deps:** bump pino from 8.14.2 to 8.15.0 ([39a3362](https://github.com/mariusbegby/cadence-discord-bot/commit/39a336248e098a00c3323ee4319ad725fdbb8f6b))
|
||||||
|
|
||||||
|
## [3.6.3](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.6.2...v3.6.3) (2023-08-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Miscellaneous
|
||||||
|
|
||||||
|
* add workflow for auto adding contributors to readme ([fa7146e](https://github.com/mariusbegby/cadence-discord-bot/commit/fa7146ea98defc4615d598be96697ed9bbb1ec47))
|
||||||
|
* **deps-dev:** bump eslint from 8.45.0 to 8.46.0 ([50587b5](https://github.com/mariusbegby/cadence-discord-bot/commit/50587b533956b0ab218d78603c62ca8f099b9fbc))
|
||||||
|
* **deps:** bump pino from 8.14.1 to 8.14.2 ([493e374](https://github.com/mariusbegby/cadence-discord-bot/commit/493e374a9d1c5d5e3f6fcbe466cc6ea2ac6f9eea))
|
||||||
|
|
||||||
## [3.6.2](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.6.1...v3.6.2) (2023-07-30)
|
## [3.6.2](https://github.com/mariusbegby/cadence-discord-bot/compare/v3.6.1...v3.6.2) (2023-07-30)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://discord.com/oauth2/authorize?client_id=1125742835946237992&permissions=0&scope=bot%20applications.commands">
|
<a href="https://discord.com/oauth2/authorize?client_id=1125742835946237992&permissions=0&scope=bot%20applications.commands">
|
||||||
<img src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&label=Add%20bot&labelColor=1b1c1d&logo=discord&logoColor=white&color=4c73df" alt="Add Cadence Discord bot"></a>
|
<img src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&label=Add%20bot&labelColor=1b1c1d&logo=discord&logoColor=white&color=4c73df" alt="Add Cadence Discord bot"></a>
|
||||||
<a href="https://discord.gg/cadence">
|
<a href="https://discord.gg/t6Bm8wPpXB">
|
||||||
<img src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&label=Support%20Server&labelColor=1b1c1d&logo=discord&logoColor=white&color=4c73df" alt="Cadence Discord support server"></a>
|
<img src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&label=Support%20Server&labelColor=1b1c1d&logo=discord&logoColor=white&color=4c73df" alt="Cadence Discord support server"></a>
|
||||||
<a href="https://github.com/mariusbegby/cadence-discord-bot/releases">
|
<a href="https://github.com/mariusbegby/cadence-discord-bot/releases">
|
||||||
<img src="https://img.shields.io/github/package-json/v/mariusbegby/cadence-discord-bot/main?style=for-the-badge&label=Version&labelColor=1b1c1d&logo=github&logoColor=white&color=4c73df" alt="Cadence bot release"></a>
|
<img src="https://img.shields.io/github/package-json/v/mariusbegby/cadence-discord-bot/main?style=for-the-badge&label=Version&labelColor=1b1c1d&logo=github&logoColor=white&color=4c73df" alt="Cadence bot release"></a>
|
||||||
@@ -26,33 +26,61 @@
|
|||||||
|
|
||||||
To add the bot to your Discord server, click [here](https://discord.com/oauth2/authorize?client_id=1125742835946237992&permissions=0&scope=bot%20applications.commands). This will invite the bot to your Discord server.
|
To add the bot to your Discord server, click [here](https://discord.com/oauth2/authorize?client_id=1125742835946237992&permissions=0&scope=bot%20applications.commands). This will invite the bot to your Discord server.
|
||||||
|
|
||||||
Once the bot has joined your Discord server, there is no additional configuration. Execute the **`/help`** command to view a list of commands to use.
|
Once the bot has joined your Discord server, there is no additional setup needed. Execute the **`/help`** command to view a list of commands to use.
|
||||||
|
|
||||||
## Hosting the bot yourself 🔓
|
## Hosting the bot yourself 🔓
|
||||||
|
|
||||||
This bot is open-source, and if you want to host it yourself, you can do so by following the steps below.
|
**⚠️ Migrating from V3 to V4 (config update) and later**
|
||||||
|
|
||||||
|
`v4.0.0` brings a new configuration system. To migrate your old configuration, copy your config file in `./src/config.js` to `./config/local.js`. This will override the new default config file stored in `/config/default.js`. No additional actions are required, and if configurable options are missing in your `./config/local.js` file, the bot will automatically use the default values from `./config/default.js`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**This bot is open-source, and if you want to host it yourself, here's how you can do it:**
|
||||||
|
|
||||||
1. Install [Node.js](https://nodejs.org/en/download/) v18.16 LTS.
|
1. Install [Node.js](https://nodejs.org/en/download/) v18.16 LTS.
|
||||||
2. Install [FFmpeg](https://ffmpeg.org/download.html) latest release build.
|
2. Install [FFmpeg](https://ffmpeg.org/download.html) latest release build.
|
||||||
3. After cloning this repository, install dependencies with `npm install`. If you get an error, try using `npm install --legacy-peer-deps` instead, which should resolve the issue.
|
3. Clone this repository and install its dependencies using `npm install`. If you encounter any errors, try use `npm install --legacy-peer-deps`.
|
||||||
4. Create and configure the `config.js` document in `/src/config.js` which contains configurable options and customization for the bot. See the `/src/config_example.js` for an example.
|
4. Setup your `.env` file in the root directory to configure bot token `DISCORD_BOT_TOKEN` and client id `DISCORD_APPLICATION_ID`. You obtain these from the [Discord developer portal](https://discord.com/developers/applications). The `.env.example` file provides an example configuration.
|
||||||
5. Setup your `.env` file in the root directory to configure bot `token` and `clientId`, which you get from [Discord developer portal](https://discord.com/developers/applications). See the `.env.example` file in root directory to see example.
|
5. To make the commands accessible on Discord servers, deploy slash commands using `npm run deploy`.
|
||||||
6. Deploy slash commands via Discord API by running `npm run deploy`. This is required to make the commands accessible for Discord servers.
|
6. Start the bot using `npm start`. If set up correctly, the bot should now be online and operational. You will need to invite it to a server, see [Adding your bot to servers](https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links) article for help.
|
||||||
7. Run `npm start` to start the bot. If everything is configured and setup correctly, the bot should be online and ready to use. You will need to invite the bot to a server, see [Adding your bot to servers](https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links) article for help.
|
|
||||||
|
|
||||||
### Additional information:
|
### Additional information:
|
||||||
|
|
||||||
|
- If you want to override default config options, create a file `/config/local.js`. The options defined in this file will override the default configurable options in `/config/default.js`. See `/config/default.js` for all available options. You do not need to copy the whole `/config/default.js` file, only the options you want to override.
|
||||||
- You can use `npm run deploy-pretty` and `npm run start-pretty` to get formatted, colorized output to console instead of JSON format. For this to work, you need the npm package `pino-pretty` installed, `npm install pino-pretty -g` to install it globally.
|
- You can use `npm run deploy-pretty` and `npm run start-pretty` to get formatted, colorized output to console instead of JSON format. For this to work, you need the npm package `pino-pretty` installed, `npm install pino-pretty -g` to install it globally.
|
||||||
- Logs are stored in `/logs` directory, you can configure the logging level to file and console under `loggerOptions` in `/src/config.js`.
|
- Logs are stored in `/logs` directory, you can configure the logging level to file and console in the configuration file.
|
||||||
- For production use, I recommend using something like `pm2` to manage the process and automatically restart it if it crashes. Here's a simple setup for `pm2`:
|
- For production use, we recommend using a process manager like `pm2` or similar to automatically restart it the process crashes. Here is a simple setup for `pm2`:
|
||||||
- Install `pm2` globally: `npm install pm2 -g`.
|
- Install `pm2` globally: `npm install pm2 -g`.
|
||||||
- Start the bot with `pm2 start ./src/index.js --name "Cadence"`.
|
- In repository root directory, start the bot with `pm2 start ./src/index.js --name "Cadence"`.
|
||||||
- Save the process list with `pm2 save`.
|
- Save the process list with `pm2 save`.
|
||||||
- To view logs with pino-pretty, run `pm2 logs 0 --out --raw | pino-pretty`. _Note: Does not work well in Windows PowerShell, use command prompt (cmd) to view logs with `pino-pretty` using same command if you are using `pm2`_.
|
- To view logs with `pino-pretty`, run `pm2 logs 0 --out --raw | pino-pretty`. _Note: Does not work well in Windows PowerShell, use command prompt (cmd) to view logs with `pino-pretty` using same command if you are using `pm2`_.
|
||||||
|
|
||||||
## Get help and support 🛟
|
## Get help and support 🛟
|
||||||
|
|
||||||
If you experience any issues, please open an issue on this repository or join the [Discord support server](https://discord.gg/cadence) for the Cadence bot.
|
Encounter an issue? Open an issue in this repository or join our [Discord support server](https://discord.gg/t6Bm8wPpXB) for assistance.
|
||||||
|
|
||||||
## Credits and acknowledgments 🎉
|
## Credits and acknowledgments 🎉
|
||||||
|
|
||||||
This project is made possible by using [discord.js](https://github.com/discordjs/discord.js/) and [discord-player](https://github.com/Androz2091/discord-player).
|
This project is made possible by using [discord.js](https://github.com/discordjs/discord.js/) and [discord-player](https://github.com/Androz2091/discord-player). A special thanks to [@skdhg](https://github.com/skdhg) for his work on [discord-player](https://github.com/Androz2091/discord-player), [mediaplex](https://github.com/androzdev/mediaplex) and for providing feedback and help during development of this bot.
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="word-wrap: break-word; width: 75.0; height: 75.0">
|
||||||
|
<a href=https://github.com/mariusbegby>
|
||||||
|
<img src=https://avatars.githubusercontent.com/u/25694918?v=4 width="50;" style="border-radius:50%;align-items:center;justify-content:center;overflow:hidden;padding-top:10px" alt=Marius Begby/>
|
||||||
|
<br />
|
||||||
|
<sub style="font-size:14px"><b>Marius Begby</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="word-wrap: break-word; width: 75.0; height: 75.0">
|
||||||
|
<a href=https://github.com/sloraris>
|
||||||
|
<img src=https://avatars.githubusercontent.com/u/97694636?v=4 width="50;" style="border-radius:50%;align-items:center;justify-content:center;overflow:hidden;padding-top:10px" alt=Parker Owings/>
|
||||||
|
<br />
|
||||||
|
<sub style="font-size:14px"><b>Parker Owings</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -1,17 +1,15 @@
|
|||||||
const { ActivityType, PresenceUpdateStatus } = require('discord.js');
|
const { ActivityType, PresenceUpdateStatus } = require('discord.js');
|
||||||
// Description: Config file for Cadence Discord bot.
|
// Description: Config file for Cadence Discord bot.
|
||||||
|
|
||||||
// General options for information about the bot.
|
// General metadata about the bot displayed in certain embeds.
|
||||||
module.exports.botOptions = {
|
module.exports.botOptions = {
|
||||||
name: 'Cadence',
|
name: 'Cadence',
|
||||||
websiteUrl: 'Unknown',
|
botInviteUrl: '',
|
||||||
botInviteUrl: 'Unknown',
|
serverInviteUrl: ''
|
||||||
serverInviteUrl: 'Unknown'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sharding options for the bot.
|
// Configuration for bot sharding. Refers to splitting a Discord bot into multiple processes.
|
||||||
// See https://old.discordjs.dev/#/docs/discord.js/main/typedef/ShardingManagerOptions for valid options.
|
// For more information, refer to Discord.js sharding documentation: https://discordjs.guide/sharding/
|
||||||
// Do not change if you don't know what you are doing.
|
|
||||||
module.exports.shardingOptions = {
|
module.exports.shardingOptions = {
|
||||||
totalShards: 'auto',
|
totalShards: 'auto',
|
||||||
shardList: 'auto',
|
shardList: 'auto',
|
||||||
@@ -19,24 +17,24 @@ module.exports.shardingOptions = {
|
|||||||
respawn: true
|
respawn: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Logging options for the bot, can set logging level to file and console separately.
|
// Configuration for logging bot actions.
|
||||||
|
// You can set logging level to file and console separately.
|
||||||
module.exports.loggerOptions = {
|
module.exports.loggerOptions = {
|
||||||
minimumLogLevel: 'debug',
|
minimumLogLevel: 'debug',
|
||||||
minimumLogLevelConsole: 'info'
|
minimumLogLevelConsole: 'info'
|
||||||
};
|
};
|
||||||
|
|
||||||
// systemGuildIds: Array of guild ids where system commands should be available.
|
// Options for identifying specific system command.
|
||||||
// systemMessageChannelId: Channel id where system messages should be sent, such as error events.
|
|
||||||
// systemUserId: User id of the system administrator, used for pining on certain system messages.
|
|
||||||
module.exports.systemOptions = {
|
module.exports.systemOptions = {
|
||||||
systemGuildIds: ['Guild id where system commands can be used'],
|
// List of guild IDs where system commands can be executed. e.g. ['123456789012345678', '123456789012345678']
|
||||||
systemMessageChannelId: 'Channel id where system messages will be sent',
|
systemGuildIds: [],
|
||||||
systemUserId: 'User id of the system administrator which will receive pings on certain system messages'
|
// Channel for sending system messages, such as bot errors and disconnect events. e.g. '123456789012345678'
|
||||||
|
systemMessageChannelId: '',
|
||||||
|
// Bot administrator user ID for specific notifications through mentions in system channel. e.g. '123456789012345678'
|
||||||
|
systemUserId: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// Options for presence/activity status. You can change from watching to listening, playing, etc.
|
// Configuration for the bot's presence and activity status.
|
||||||
// See https://discord-api-types.dev/api/discord-api-types-v10/enum/ActivityType for valid activity types.
|
|
||||||
// See https://discord-api-types.dev/api/discord-api-types-v10/enum/PresenceUpdateStatus for valid presence status.
|
|
||||||
module.exports.presenceStatusOptions = {
|
module.exports.presenceStatusOptions = {
|
||||||
status: PresenceUpdateStatus.Online,
|
status: PresenceUpdateStatus.Online,
|
||||||
activities: [
|
activities: [
|
||||||
@@ -47,7 +45,8 @@ module.exports.presenceStatusOptions = {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Options for embed messages, like colors and custom emojis.
|
// Configurations for visual embed messages.
|
||||||
|
// Includes design elements like colors and custom emojis/symbols.
|
||||||
module.exports.embedOptions = {
|
module.exports.embedOptions = {
|
||||||
colors: {
|
colors: {
|
||||||
success: '#23A55A',
|
success: '#23A55A',
|
||||||
@@ -101,14 +100,14 @@ module.exports.embedOptions = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Options for the discord-player player.
|
// Configuration for the audio player. Includes behavior upon various events and UI components.
|
||||||
module.exports.playerOptions = {
|
module.exports.playerOptions = {
|
||||||
leaveOnEmpty: true,
|
leaveOnEmpty: true,
|
||||||
leaveOnEmptyCooldown: 300_000,
|
leaveOnEmptyCooldown: 1_800_000,
|
||||||
leaveOnEnd: true,
|
leaveOnEnd: true,
|
||||||
leaveOnEndCooldown: 300_000,
|
leaveonEndCooldown: 1_800_000,
|
||||||
leaveOnStop: true,
|
leaveOnStop: true,
|
||||||
leaveOnStopCooldown: 300_000,
|
leaveOnStopCooldown: 1_800_000,
|
||||||
defaultVolume: 50,
|
defaultVolume: 50,
|
||||||
maxQueueSize: 10_000,
|
maxQueueSize: 10_000,
|
||||||
maxHistorySize: 100,
|
maxHistorySize: 100,
|
||||||
@@ -124,7 +123,7 @@ module.exports.playerOptions = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Options to be used by the ffmpeg, and available ffmpeg filters shown in filter commands.
|
// Configuration for ffmpeg filters for audio processing.
|
||||||
module.exports.ffmpegFilterOptions = {
|
module.exports.ffmpegFilterOptions = {
|
||||||
threadAmount: '2',
|
threadAmount: '2',
|
||||||
availableFilters: [
|
availableFilters: [
|
||||||
@@ -185,7 +184,8 @@ module.exports.ffmpegFilterOptions = {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Options for load testing the bot. If enabled, the bot will join the specified channels and play specified track source.
|
// Configuration for load testing. Enables the bot to simulate certain behaviors for testing purposes.
|
||||||
|
// If enabled, the bot will join the specified channels and play specified track.
|
||||||
module.exports.loadTestOptions = {
|
module.exports.loadTestOptions = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
trackUrl: 'https://www.youtube.com/watch?v=tTR4D9h3zAE',
|
trackUrl: 'https://www.youtube.com/watch?v=tTR4D9h3zAE',
|
||||||
Generated
+347
-317
File diff suppressed because it is too large.
Load diff
+12
-11
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cadence-discord-bot",
|
"name": "cadence-discord-bot",
|
||||||
"version": "3.6.2",
|
"version": "4.0.1",
|
||||||
"description": "A free Discord music and audio bot.",
|
"description": "A free Discord music and audio bot.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -26,20 +26,21 @@
|
|||||||
"eslint": "eslint ./"
|
"eslint": "eslint ./"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discord-player/extractor": "^4.4.1",
|
"@discord-player/extractor": "^4.4.2-dev.1",
|
||||||
"@discordjs/opus": "^0.9.0",
|
"@discord-player/opus": "^0.1.1",
|
||||||
"@discordjs/rest": "^1.7.1",
|
"@discordjs/rest": "^2.0.0",
|
||||||
"@discordjs/voice": "^0.16.0",
|
"@distube/ytdl-core": "^4.11.17",
|
||||||
"discord-player": "^6.6.2",
|
"config": "^3.3.9",
|
||||||
"discord.js": "^14.11.0",
|
"discord-player": "^6.6.3-dev.0",
|
||||||
|
"discord-voip": "^0.1.2",
|
||||||
|
"discord.js": "^14.12.1",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"mediaplex": "^0.0.1",
|
"mediaplex": "^0.0.4",
|
||||||
"node-os-utils": "^1.3.7",
|
"node-os-utils": "^1.3.7",
|
||||||
"pino": "^8.14.1",
|
"pino": "^8.15.0"
|
||||||
"yt-stream": "^1.4.8"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.45.0",
|
"eslint": "^8.47.0",
|
||||||
"prettier-eslint": "^15.0.1"
|
"prettier-eslint": "^15.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { embedOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -25,14 +27,21 @@ module.exports = {
|
|||||||
|
|
||||||
const commandListString = commandList.join('\n');
|
const commandListString = commandList.join('\n');
|
||||||
|
|
||||||
|
const supportServerString = botOptions.serverInviteUrl
|
||||||
|
? `${embedOptions.icons.support} **Support server**\nJoin the support server for help or to suggest improvements: \n**${botOptions.serverInviteUrl}**\n\n`
|
||||||
|
: '';
|
||||||
|
const addBotString = botOptions.botInviteUrl
|
||||||
|
? `${embedOptions.icons.bot} **Enjoying ${botOptions.name}?**\nAdd me to another server: \n**[Click me!](${botOptions.botInviteUrl})**`
|
||||||
|
: '';
|
||||||
|
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.rule} **List of commands**\n` +
|
`${embedOptions.icons.rule} **List of commands**\n` +
|
||||||
`${commandListString}\n\n` +
|
`${commandListString}\n\n` +
|
||||||
`${embedOptions.icons.support} **Support server**\nJoin the support server for help or to suggest improvements: \n**${botOptions.serverInviteUrl}**\n\n` +
|
supportServerString +
|
||||||
`${embedOptions.icons.bot} **Enjoying ${botOptions.name}?**\nAdd me to another server: \n**[Click me!](${botOptions.botInviteUrl})**`
|
addBotString
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { getUptimeFormatted } = require('../../utils/system/getUptimeFormatted');
|
const { getUptimeFormatted } = require('../../utils/system/getUptimeFormatted');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const osu = require('node-os-utils');
|
const osu = require('node-os-utils');
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, ffmpegFilterOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const ffmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const { useQueue } = require('discord-player');
|
const { useQueue } = require('discord-player');
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, playerOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const playerOptions = config.get('playerOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, playerOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
|
const playerOptions = config.get('playerOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { cannotJoinVoiceOrTalk } = require('../../utils/validation/permissionValidator');
|
const { cannotJoinVoiceOrTalk } = require('../../utils/validation/permissionValidator');
|
||||||
const { transformQuery } = require('../../utils/validation/searchQueryValidator');
|
const { transformQuery } = require('../../utils/validation/searchQueryValidator');
|
||||||
@@ -97,6 +100,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* seems to be supported with @distube/ytdl-core, keeping it commented out to test functionality
|
||||||
if (
|
if (
|
||||||
searchResult.tracks[0].raw.live &&
|
searchResult.tracks[0].raw.live &&
|
||||||
searchResult.tracks[0].raw.duration === 0 &&
|
searchResult.tracks[0].raw.duration === 0 &&
|
||||||
@@ -116,6 +120,7 @@ module.exports = {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
queue = useQueue(interaction.guild.id);
|
queue = useQueue(interaction.guild.id);
|
||||||
let queueSize = queue?.size ?? 0;
|
let queueSize = queue?.size ?? 0;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, playerOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const playerOptions = config.get('playerOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const { useQueue } = require('discord-player');
|
const { useQueue } = require('discord-player');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueIsEmpty } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueIsEmpty } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist, queueNoCurrentTrack } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const { useQueue } = require('discord-player');
|
const { useQueue } = require('discord-player');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
const { queueDoesNotExist } = require('../../utils/validation/queueValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
const { notValidGuildId } = require('../../utils/validation/systemCommandValidator');
|
||||||
const { getUptimeFormatted } = require('../../utils/system/getUptimeFormatted');
|
const { getUptimeFormatted } = require('../../utils/system/getUptimeFormatted');
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
@@ -36,9 +37,9 @@ module.exports = {
|
|||||||
const cpuCores = await osu.cpu.count();
|
const cpuCores = await osu.cpu.count();
|
||||||
const platform = await osu.os.platform();
|
const platform = await osu.os.platform();
|
||||||
const discordJsVersion = dependencies['discord.js'];
|
const discordJsVersion = dependencies['discord.js'];
|
||||||
const opusVersion = dependencies['@discordjs/opus'];
|
const opusVersion = dependencies['@discord-player/opus'];
|
||||||
const restVersion = dependencies['@discordjs/rest'];
|
const restVersion = dependencies['@discordjs/rest'];
|
||||||
const voiceVersion = dependencies['@discordjs/voice'];
|
const voiceVersion = dependencies['discord-voip'];
|
||||||
const discordPlayerVersion = dependencies['discord-player'];
|
const discordPlayerVersion = dependencies['discord-player'];
|
||||||
const extractorVersion = dependencies['@discord-player/extractor'];
|
const extractorVersion = dependencies['@discord-player/extractor'];
|
||||||
const mediaplexVersion = dependencies['mediaplex'];
|
const mediaplexVersion = dependencies['mediaplex'];
|
||||||
@@ -99,11 +100,11 @@ module.exports = {
|
|||||||
|
|
||||||
const dependenciesString =
|
const dependenciesString =
|
||||||
`**${discordJsVersion}** discord.js\n` +
|
`**${discordJsVersion}** discord.js\n` +
|
||||||
`**┗ ${opusVersion}** @discordjs/opus\n` +
|
|
||||||
`**┗ ${restVersion}** @discordjs/rest\n` +
|
`**┗ ${restVersion}** @discordjs/rest\n` +
|
||||||
`**┗ ${voiceVersion}** @discordjs/voice\n` +
|
|
||||||
`**${discordPlayerVersion}** discord-player\n` +
|
`**${discordPlayerVersion}** discord-player\n` +
|
||||||
|
`**┗ ${opusVersion}** @discord-player/opus\n` +
|
||||||
`**┗ ${extractorVersion}** @discord-player/extractor\n` +
|
`**┗ ${extractorVersion}** @discord-player/extractor\n` +
|
||||||
|
`**${voiceVersion}** discord-voip\n` +
|
||||||
`**${mediaplexVersion}** mediaplex`;
|
`**${mediaplexVersion}** mediaplex`;
|
||||||
|
|
||||||
const discordStatusString = `**${client.ws.ping} ms** Discord API latency`;
|
const discordStatusString = `**${client.ws.ping} ms** Discord API latency`;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, systemOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, systemOptions, presenceStatusOptions, loadTestOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
|
const presenceStatusOptions = config.get('presenceStatusOptions');
|
||||||
|
const loadTestOptions = config.get('loadTestOptions');
|
||||||
const { postBotStats } = require('../../utils/other/postBotStats.js');
|
const { postBotStats } = require('../../utils/other/postBotStats.js');
|
||||||
const { startLoadTest } = require('../../utils/other/startLoadTest');
|
const { startLoadTest } = require('../../utils/other/startLoadTest');
|
||||||
const { Events, EmbedBuilder } = require('discord.js');
|
const { Events, EmbedBuilder } = require('discord.js');
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, systemOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
const { cannotSendMessageInChannel } = require('../../utils/validation/permissionValidator');
|
const { cannotSendMessageInChannel } = require('../../utils/validation/permissionValidator');
|
||||||
const { Events, EmbedBuilder } = require('discord.js');
|
const { Events, EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
@@ -16,57 +18,62 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.isAutocomplete()) {
|
if (interaction.isAutocomplete()) {
|
||||||
|
logger.debug(`[Shard ${interaction.guild.shardId}] Autocomplete created.`);
|
||||||
try {
|
try {
|
||||||
await command.autocomplete({ interaction, client });
|
await command.autocomplete({ interaction, client });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message === 'Unknown interaction') {
|
if (
|
||||||
|
error.message === 'Unknown interaction' ||
|
||||||
|
error.message === 'Interaction has already been acknowledged.'
|
||||||
|
) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`[Shard ${interaction.guild.shardId}] Autocomplete failed to be responded to, providing a response took too long.`
|
`[Shard ${interaction.guild.shardId}] Autocomplete failed to be responded to, unknown interaction or already acknowledged.`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
logger.warn(error, `[Shard ${interaction.guild.shardId}] Autocomplete failed to execute.`);
|
logger.warn(error, `[Shard ${interaction.guild.shardId}] Autocomplete failed to execute.`);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (interaction.isChatInputCommand()) {
|
} else if (interaction.isChatInputCommand()) {
|
||||||
|
logger.debug(`[Shard ${interaction.guild.shardId}] Interaction created.`);
|
||||||
try {
|
try {
|
||||||
|
await interaction.deferReply();
|
||||||
|
|
||||||
|
// causing issues with unknown interaction error?
|
||||||
if (await cannotSendMessageInChannel(interaction)) {
|
if (await cannotSendMessageInChannel(interaction)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const inputTime = new Date();
|
|
||||||
|
|
||||||
await interaction.deferReply();
|
const inputTime = new Date();
|
||||||
await command.execute({ interaction, client });
|
await command.execute({ interaction, client });
|
||||||
|
|
||||||
const outputTime = new Date();
|
const outputTime = new Date();
|
||||||
const executionTime = outputTime - inputTime;
|
const executionTime = outputTime - inputTime;
|
||||||
|
|
||||||
if (executionTime > 20000) {
|
|
||||||
logger.warn(
|
|
||||||
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' took ${executionTime} ms to execute.`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.`
|
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.`
|
||||||
);
|
);
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.warn(
|
||||||
error,
|
error,
|
||||||
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' failed to execute.`
|
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' throwed an unhandled error and might have failed to execute properly.`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!interaction.deferred || !interaction.replied) {
|
||||||
|
logger.warn(
|
||||||
|
`[Shard ${interaction.guild.shardId}] Interaction was not deferred or replied to, and an error was thrown.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (interaction.replied) {
|
if (interaction.replied) {
|
||||||
await interaction.followUp({
|
// If the interaction has already been replied to, most likely command executed successfully or error is already handled.
|
||||||
embeds: [
|
return;
|
||||||
new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to execute this command.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
|
||||||
)
|
|
||||||
.setColor(embedOptions.colors.error)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
} else if (interaction.deferred) {
|
} else if (interaction.deferred) {
|
||||||
|
logger.info(
|
||||||
|
`[Shard ${interaction.guild.shardId}] Interaction was deferred, editing reply and sending Uh-oh message.`
|
||||||
|
);
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
@@ -77,6 +84,9 @@ module.exports = {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
logger.info(
|
||||||
|
`[Shard ${interaction.guild.shardId}] Interaction was not deferred or replied, sending new reply with Uh-oh message.`
|
||||||
|
);
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
@@ -88,6 +98,11 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.warn(
|
||||||
|
interaction,
|
||||||
|
`[Shard ${interaction.guild.shardId}] Interaction created but was not a chat input or autocomplete interaction.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, systemOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
// Emitted when the player queue encounters error (general error with queue)
|
// Emitted when the player queue encounters error (general error with queue)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, systemOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
// Emitted when the player encounters an error while streaming audio track
|
// Emitted when the player encounters an error while streaming audio track
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions, systemOptions, botOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const botOptions = config.get('botOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
// Emitted when the audio player fails to load the stream for a track
|
// Emitted when the audio player fails to load the stream for a track
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const { shardingOptions } = require('./config');
|
const shardingOptions = require('config').get('shardingOptions');
|
||||||
const logger = require('./services/logger');
|
const logger = require('./services/logger');
|
||||||
const { ShardingManager, ShardEvents } = require('discord.js');
|
const { ShardingManager, ShardEvents } = require('discord.js');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const pino = require('pino');
|
const pino = require('pino');
|
||||||
const { loggerOptions } = require('../config');
|
const config = require('config');
|
||||||
|
const loggerOptions = config.get('loggerOptions');
|
||||||
|
|
||||||
const targets = [
|
const targets = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ const logger = require('../services/logger');
|
|||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const { REST, Routes } = require('discord.js');
|
const { REST, Routes } = require('discord.js');
|
||||||
const { systemOptions } = require('../config');
|
const config = require('config');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
|
|
||||||
const slashCommands = [];
|
const slashCommands = [];
|
||||||
const systemCommands = [];
|
const systemCommands = [];
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { Player, onBeforeCreateStream } = require('discord-player');
|
const { Player } = require('discord-player');
|
||||||
const { stream } = require('yt-stream');
|
|
||||||
|
|
||||||
exports.createPlayer = async (client) => {
|
exports.createPlayer = async (client) => {
|
||||||
try {
|
try {
|
||||||
@@ -23,6 +22,7 @@ exports.createPlayer = async (client) => {
|
|||||||
// primarily to be able to use it in broadcastEval and other sharding methods
|
// primarily to be able to use it in broadcastEval and other sharding methods
|
||||||
global.player = player;
|
global.player = player;
|
||||||
|
|
||||||
|
/* Seems to not be needed with @distube/ytdl-core, long duration videos work fine, keeping commented for now
|
||||||
onBeforeCreateStream(async (track) => {
|
onBeforeCreateStream(async (track) => {
|
||||||
if (track.source === 'youtube') {
|
if (track.source === 'youtube') {
|
||||||
return (
|
return (
|
||||||
@@ -37,6 +37,7 @@ exports.createPlayer = async (client) => {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
await player.extractors.loadDefault();
|
await player.extractors.loadDefault();
|
||||||
logger.trace(`[Shard ${client.shard.ids[0]}] discord-player loaded dependencies:\n${player.scanDeps()}`);
|
logger.trace(`[Shard ${client.shard.ids[0]}] discord-player loaded dependencies:\n${player.scanDeps()}`);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { loadTestOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const loadTestOptions = config.get('loadTestOptions');
|
||||||
|
|
||||||
exports.startLoadTest = async (client) => {
|
exports.startLoadTest = async (client) => {
|
||||||
if (!loadTestOptions.enabled) {
|
if (!loadTestOptions.enabled) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
exports.cannotJoinVoiceOrTalk = async (interaction) => {
|
exports.cannotJoinVoiceOrTalk = async (interaction) => {
|
||||||
@@ -30,8 +31,15 @@ exports.cannotSendMessageInChannel = async (interaction) => {
|
|||||||
|
|
||||||
// only checks if channel is viewable, as bot will have permission to send interaction replies if channel is viewable
|
// only checks if channel is viewable, as bot will have permission to send interaction replies if channel is viewable
|
||||||
if (!channel.viewable) {
|
if (!channel.viewable) {
|
||||||
|
logger.info(
|
||||||
|
`User tried to use command ${interaction.commandName} but the bot had no permission to send reply in text channel.`
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
// we can still send ephemeral replies in channels we can't view, so sending message to user instead
|
// we can still send ephemeral replies in channels we can't view, so sending message to user instead
|
||||||
|
if (!interaction.deferred && !interaction.replied) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
}
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
@@ -42,10 +50,18 @@ exports.cannotSendMessageInChannel = async (interaction) => {
|
|||||||
],
|
],
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
logger.debug(
|
if(error.message == 'The reply to this interaction has already been sent or deferred.') {
|
||||||
`User tried to use command ${interaction.commandName} but the bot had no permission to send reply in text channel.`
|
logger.warn('Error while sending ephemereal message about insufficient permissions to send message in channel.');
|
||||||
|
logger.debug(error);
|
||||||
|
} else {
|
||||||
|
logger.error(
|
||||||
|
error,
|
||||||
|
'Failed to send ephemeral reply to user in channel that bot cannot view/send message in.'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
exports.queueDoesNotExist = async (interaction, queue) => {
|
exports.queueDoesNotExist = async (interaction, queue) => {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
const { embedOptions, systemOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
|
const systemOptions = config.get('systemOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
exports.notValidGuildId = async (interaction) => {
|
exports.notValidGuildId = async (interaction) => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const logger = require('../../services/logger');
|
const logger = require('../../services/logger');
|
||||||
const { embedOptions } = require('../../config');
|
const config = require('config');
|
||||||
|
const embedOptions = config.get('embedOptions');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
exports.notInVoiceChannel = async (interaction) => {
|
exports.notInVoiceChannel = async (interaction) => {
|
||||||
|
|||||||
Reference in new issue
Block a user