mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 06:28:54 +00:00
feat!: Moved source into /src folder
This commit is contained in:
1 parent
6d182c627a
commit
ee274feb2b
20 files changed
+63
-37
No files matched your search
@@ -2,3 +2,5 @@
|
||||
/config.json
|
||||
/.env
|
||||
/app-*.log
|
||||
/logs
|
||||
/logs/app-*.log
|
||||
+4
-4
@@ -19,10 +19,10 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node ./index.js",
|
||||
"start-pretty": "node ./index.js | pino-pretty",
|
||||
"deploy": "node ./deploy-commands.js && node ./deploy-system-commands.js",
|
||||
"deploy-pretty": "node ./deploy-commands.js | pino-pretty && node ./deploy-system-commands.js | pino-pretty",
|
||||
"start": "node ./src/index.js",
|
||||
"start-pretty": "node ./src/index.js | pino-pretty",
|
||||
"deploy": "node ./src/deploy-commands.js && node ./src/deploy-system-commands.js",
|
||||
"deploy-pretty": "node ./src/deploy-commands.js | pino-pretty && node ./src/deploy-system-commands.js | pino-pretty",
|
||||
"eslint": "eslint ./"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const {
|
||||
@@ -12,7 +13,7 @@ const {
|
||||
embedIcons,
|
||||
filterList,
|
||||
filterThreadAmount
|
||||
} = require('../config.json');
|
||||
} = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,6 +1,7 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons, botInfo } = require('../config.json');
|
||||
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons } = require('../config.json');
|
||||
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons, botInfo } = require('../config.json');
|
||||
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
||||
@@ -5,7 +6,7 @@ const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
progressBarOptions
|
||||
} = require('../config.json');
|
||||
} = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons } = require('../config.json');
|
||||
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useMainPlayer, useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
@@ -6,7 +7,7 @@ const {
|
||||
embedIcons,
|
||||
playerOptions,
|
||||
botInfo
|
||||
} = require('../config.json');
|
||||
} = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
@@ -5,7 +6,7 @@ const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
progressBarOptions
|
||||
} = require('../config.json');
|
||||
} = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons } = require('../config.json');
|
||||
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons } = require('../config.json');
|
||||
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons } = require('../config.json');
|
||||
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,7 +1,8 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedColors, embedIcons } = require('../config.json');
|
||||
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,15 +1,16 @@
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const logger = require('./services/logger.js');
|
||||
const logger = require(path.resolve('./src/services/logger.js'));
|
||||
const { REST, Routes } = require('discord.js');
|
||||
require('dotenv').config();
|
||||
|
||||
const commands = [];
|
||||
const commandFiles = fs
|
||||
.readdirSync('./commands')
|
||||
.readdirSync(path.resolve('./src/commands'))
|
||||
.filter((file) => file.endsWith('.js'));
|
||||
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands/${file}`);
|
||||
const command = require(path.resolve(`./src/commands/${file}`));
|
||||
commands.push(command.data.toJSON());
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const logger = require('./services/logger.js');
|
||||
const logger = require(path.resolve('./src/services/logger.js'));
|
||||
const { REST, Routes } = require('discord.js');
|
||||
const { systemServerGuildIds } = require('./config.json');
|
||||
const { systemServerGuildIds } = require(path.resolve('./config.json'));
|
||||
require('dotenv').config();
|
||||
|
||||
const systemCommands = [];
|
||||
const systemCommandFiles = fs
|
||||
.readdirSync('./system-commands')
|
||||
.readdirSync(path.resolve('./src/system-commands'))
|
||||
.filter((file) => file.endsWith('.js'));
|
||||
|
||||
for (const file of systemCommandFiles) {
|
||||
const systemCommand = require(`./system-commands/${file}`);
|
||||
const systemCommand = require(path.resolve(`./src/system-commands/${file}`));
|
||||
systemCommands.push(systemCommand.data.toJSON());
|
||||
}
|
||||
|
||||
+13
-8
@@ -1,10 +1,13 @@
|
||||
const fs = require('node:fs');
|
||||
const path = require('path');
|
||||
const Discord = require('discord.js');
|
||||
const logger = require('./services/logger.js');
|
||||
const logger = require(path.resolve('./src/services/logger.js'));
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { Player, onBeforeCreateStream } = require('discord-player');
|
||||
const { stream } = require('yt-stream');
|
||||
const { embedColors, embedIcons, botInfo } = require('./config.json');
|
||||
const { embedColors, embedIcons, botInfo } = require(path.resolve(
|
||||
'./config.json'
|
||||
));
|
||||
require('dotenv').config();
|
||||
|
||||
// Setup required permissions for the bot to work
|
||||
@@ -19,18 +22,20 @@ const client = new Discord.Client({
|
||||
// todo: extract this logic to a separate file
|
||||
client.commands = new Discord.Collection();
|
||||
const commandFiles = fs
|
||||
.readdirSync('./commands')
|
||||
.readdirSync(path.resolve('./src/commands'))
|
||||
.filter((file) => file.endsWith('.js'));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands/${file}`);
|
||||
const command = require(path.resolve(`./src/commands/${file}`));
|
||||
client.commands.set(command.data.name, command);
|
||||
}
|
||||
|
||||
const systemCommandFiles = fs
|
||||
.readdirSync('./system-commands')
|
||||
.readdirSync(path.resolve('./src/system-commands'))
|
||||
.filter((file) => file.endsWith('.js'));
|
||||
for (const file of systemCommandFiles) {
|
||||
const systemCommand = require(`./system-commands/${file}`);
|
||||
const systemCommand = require(path.resolve(
|
||||
`./src/system-commands/${file}`
|
||||
));
|
||||
client.commands.set(systemCommand.data.name, systemCommand);
|
||||
}
|
||||
|
||||
@@ -64,11 +69,11 @@ onBeforeCreateStream(async (track) => {
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
player.on('debug', (message) => {
|
||||
logger.debug(`player debug event: ${message}`);
|
||||
logger.debug(message);
|
||||
});
|
||||
|
||||
player.events.on('debug', (message) => {
|
||||
logger.trace(`player queue debug event: ${message}`);
|
||||
logger.trace(message);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ const transport = pino.transport({
|
||||
target: 'pino/file',
|
||||
level: process.env.MINIMUM_LOG_LEVEL,
|
||||
options: {
|
||||
destination: './app-all.log',
|
||||
destination: './logs/app-all.log',
|
||||
mkdir: true,
|
||||
sync: false,
|
||||
minLength: 4096
|
||||
}
|
||||
@@ -16,7 +17,8 @@ const transport = pino.transport({
|
||||
target: 'pino/file',
|
||||
level: 'info',
|
||||
options: {
|
||||
destination: './app-info.log',
|
||||
destination: './logs/app-info.log',
|
||||
mkdir: true,
|
||||
sync: false,
|
||||
minLength: 4096
|
||||
}
|
||||
@@ -25,7 +27,8 @@ const transport = pino.transport({
|
||||
target: 'pino/file',
|
||||
level: 'error',
|
||||
options: {
|
||||
destination: './app-error.log',
|
||||
destination: './logs/app-error.log',
|
||||
mkdir: true,
|
||||
sync: false
|
||||
}
|
||||
},
|
||||
@@ -1,10 +1,11 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
systemServerGuildIds
|
||||
} = require('../config.json');
|
||||
} = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { useQueue } = require('discord-player');
|
||||
@@ -5,9 +6,9 @@ const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
systemServerGuildIds
|
||||
} = require('../config.json');
|
||||
} = require(path.resolve('./config.json'));
|
||||
const osu = require('node-os-utils');
|
||||
const packageJson = require('../package.json');
|
||||
const packageJson = require(path.resolve('./package.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
Reference in new issue
Block a user