Skip to content

Commit 1919ab0

Browse files
committed
refactor: replace spaces with tabs for indentation
1 parent 899305c commit 1919ab0

42 files changed

Lines changed: 2807 additions & 2807 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

admin/config.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
module.exports = {
2-
DASHBOARD_MESSAGE_MAX_LIFETIME: 3600, // Time in seconds to send a new dashboard message
3-
PRESENCE_UPDATE_INTERVAL: 600, // Interval in seconds to update the presence
4-
VOICE_CHANNEL_UPDATE_COOLDOWN: 30, // Time in seconds to update the voice channel in database
5-
VOICE_CHANNEL_EMPTY_TIMEOUT: 180, // Time in seconds before leaving the voice channel when it is empty
6-
SUBINTERACTION_COLLECTOR_TIMEOUT: 120, // Time in seconds before collector ends
7-
LIBRARY_MAX_LENGTH: 20, // Max. number of items in library
8-
ITEM_NAME_MAX_LENGTH_DISPLAY: 60, // Max. number of characters to display in song name
9-
QUEUE_MAX_LENGTH: 2000, // Max. number of songs in queue
10-
QUEUE_MAX_LENGTH_DISPLAY: 25, // Max. number of songs to display in queue
11-
DURATION_BAR_MAX_LENGTH_DISPLAY: 20, // Max. number of characters to display in duration bar
12-
MONGO_AUTO_INDEX: false, // Automatic index creation
13-
MONGO_MAX_POOL_SIZE: 10, // Max. number of open sockets
14-
MONGO_SERVER_SELECTION_TIMEOUT_MS: 5000, // Time in milliseconds to find a server to send an operation before failing
15-
MONGO_SOCKET_TIMEOUT_MS: 45000, // Time in milliseconds before killing a socket due to inactivity
16-
MONGO_FAMILY: 4, // Internet protocol version (4: IPv4, 6: IPv6, 0: both)
17-
DISTUBE_LEAVE_ON_FINISH: false, // Leave the voice channel when queue ends
18-
DISTUBE_LEAVE_ON_STOP: false, // Leave the voice channel when queue is stopped
19-
DISTUBE_LEAVE_ON_EMPTY: false, // Leave the voice channel when it is empty
20-
DISTUBE_SEARCH_MAX_RESULTS: 20, // Max. number of search results
21-
DISTUBE_NSFW: true, // Play age-restricted content
22-
DISTUBE_SAVE_PREVIOUS_SONGS: false, // Save previous songs in queue
23-
DISTUBE_CUSTOM_FILTERS: { "8d": "apulsator=hz=0.08", "purebass": "bass=g=20,dynaudnorm=f=200,asubboost", "subboost": "asubboost", "fast": "atempo=1.3", "vibrato": "vibrato=f=6.5", "pulsator": "apulsator=hz=1" } // Custom ffmpeg filters
24-
}
2+
DASHBOARD_MESSAGE_MAX_LIFETIME: 3600, // Time in seconds to send a new dashboard message
3+
PRESENCE_UPDATE_INTERVAL: 600, // Interval in seconds to update the presence
4+
VOICE_CHANNEL_UPDATE_COOLDOWN: 30, // Time in seconds to update the voice channel in database
5+
VOICE_CHANNEL_EMPTY_TIMEOUT: 180, // Time in seconds before leaving the voice channel when it is empty
6+
SUBINTERACTION_COLLECTOR_TIMEOUT: 120, // Time in seconds before collector ends
7+
LIBRARY_MAX_LENGTH: 20, // Max. number of items in library
8+
ITEM_NAME_MAX_LENGTH_DISPLAY: 60, // Max. number of characters to display in song name
9+
QUEUE_MAX_LENGTH: 2000, // Max. number of songs in queue
10+
QUEUE_MAX_LENGTH_DISPLAY: 25, // Max. number of songs to display in queue
11+
DURATION_BAR_MAX_LENGTH_DISPLAY: 20, // Max. number of characters to display in duration bar
12+
MONGO_AUTO_INDEX: false, // Automatic index creation
13+
MONGO_MAX_POOL_SIZE: 10, // Max. number of open sockets
14+
MONGO_SERVER_SELECTION_TIMEOUT_MS: 5000, // Time in milliseconds to find a server to send an operation before failing
15+
MONGO_SOCKET_TIMEOUT_MS: 45000, // Time in milliseconds before killing a socket due to inactivity
16+
MONGO_FAMILY: 4, // Internet protocol version (4: IPv4, 6: IPv6, 0: both)
17+
DISTUBE_LEAVE_ON_FINISH: false, // Leave the voice channel when queue ends
18+
DISTUBE_LEAVE_ON_STOP: false, // Leave the voice channel when queue is stopped
19+
DISTUBE_LEAVE_ON_EMPTY: false, // Leave the voice channel when it is empty
20+
DISTUBE_SEARCH_MAX_RESULTS: 20, // Max. number of search results
21+
DISTUBE_NSFW: true, // Play age-restricted content
22+
DISTUBE_SAVE_PREVIOUS_SONGS: false, // Save previous songs in queue
23+
DISTUBE_CUSTOM_FILTERS: { "8d": "apulsator=hz=0.08", "purebass": "bass=g=20,dynaudnorm=f=200,asubboost", "subboost": "asubboost", "fast": "atempo=1.3", "vibrato": "vibrato=f=6.5", "pulsator": "apulsator=hz=1" } // Custom ffmpeg filters
24+
}

commands/autoplay.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ const { SlashCommandBuilder } = require("discord.js");
22
const languages = require("../utils/languages");
33

44
module.exports = {
5-
data: new SlashCommandBuilder()
6-
.setName("autoplay")
7-
.setDescription(`${languages["en"].COMMAND_AUTOPLAY_DESCRIPTION}`)
8-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_AUTOPLAY_DESCRIPTION}` })
9-
.setDMPermission(false),
10-
run: async (client, interaction, guildData, queue, lang) => {
11-
const { guild, member } = interaction;
5+
data: new SlashCommandBuilder()
6+
.setName("autoplay")
7+
.setDescription(`${languages["en"].COMMAND_AUTOPLAY_DESCRIPTION}`)
8+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_AUTOPLAY_DESCRIPTION}` })
9+
.setDMPermission(false),
10+
run: async (client, interaction, guildData, queue, lang) => {
11+
const { guild, member } = interaction;
1212

13-
if (!queue?.songs[0]) return client.sendErrorNotification(interaction, `${lang.ERROR_SONG_NO_PLAYING}`);
14-
if (!client.checkMemberIsInMyVoiceChannel(guild, member)) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
15-
if (!client.handleCooldown("autoplayCommand", guild.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
16-
await interaction.deferReply().catch((error) => { });
17-
try {
18-
// Toggle autoplay
19-
const autoplay = await client.distube.toggleAutoplay(queue);
20-
// Update dashboard message and send notification
21-
client.updateDashboardMessage(guild, queue, lang);
22-
client.sendNotification(interaction, `${autoplay ? lang.MESSAGE_AUTOPLAY_ENABLED : lang.MESSAGE_AUTOPLAY_DISABLED}`, { editReply: true });
23-
} catch (error) {
24-
const errorMessage = client.getErrorMessage(error.message, lang);
25-
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
26-
}
27-
}
28-
}
13+
if (!queue?.songs[0]) return client.sendErrorNotification(interaction, `${lang.ERROR_SONG_NO_PLAYING}`);
14+
if (!client.checkMemberIsInMyVoiceChannel(guild, member)) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
15+
if (!client.handleCooldown("autoplayCommand", guild.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
16+
await interaction.deferReply().catch((error) => { });
17+
try {
18+
// Toggle autoplay
19+
const autoplay = await client.distube.toggleAutoplay(queue);
20+
// Update dashboard message and send notification
21+
client.updateDashboardMessage(guild, queue, lang);
22+
client.sendNotification(interaction, `${autoplay ? lang.MESSAGE_AUTOPLAY_ENABLED : lang.MESSAGE_AUTOPLAY_DISABLED}`, { editReply: true });
23+
} catch (error) {
24+
const errorMessage = client.getErrorMessage(error.message, lang);
25+
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
26+
}
27+
}
28+
}

commands/filter.js

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,76 @@ const { SlashCommandBuilder } = require("discord.js");
22
const languages = require("../utils/languages");
33

44
module.exports = {
5-
data: new SlashCommandBuilder()
6-
.setName("filter")
7-
.setDescription(`${languages["en"].COMMAND_FILTER_DESCRIPTION}`)
8-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_DESCRIPTION}` })
9-
.setDMPermission(false)
10-
.addSubcommand((subcommand) =>
11-
subcommand
12-
.setName("toggle")
13-
.setDescription(`${languages["en"].COMMAND_FILTER_TOGGLE_DESCRIPTION}`)
14-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_TOGGLE_DESCRIPTION}` })
15-
.addStringOption((option) =>
16-
option
17-
.setName("name")
18-
.setDescription(`${languages["en"].COMMAND_FILTER_TOGGLE_OPTION_NAME}`)
19-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_TOGGLE_OPTION_NAME}` })
20-
.setChoices({ name: "3d", value: "3d" }, { name: "8d", value: "8d" }, { name: "bassboost", value: "bassboost" }, { name: "subboost", value: "subboost" }, { name: "purebass", value: "purebass" }, { name: "nightcore", value: "nightcore" }, { name: "vaporwave", value: "vaporwave" }, { name: "phaser", value: "phaser" }, { name: "tremolo", value: "tremolo" }, { name: "vibrato", value: "vibrato" }, { name: "pulsator", value: "pulsator" }, { name: "earwax", value: "earwax" }, { name: "echo", value: "echo" }, { name: "fast", value: "fast" }, { name: "flanger", value: "flanger" }, { name: "gate", value: "gate" }, { name: "haas", value: "haas" }, { name: "mcompand", value: "mcompand" })
21-
.setRequired(true)
22-
)
23-
)
24-
.addSubcommand((subcommand) =>
25-
subcommand
26-
.setName("reset")
27-
.setDescription(`${languages["en"].COMMAND_FILTER_RESET_DESCRIPTION}`)
28-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_RESET_DESCRIPTION}` })
29-
),
30-
run: async (client, interaction, guildData, queue, lang) => {
31-
const { guild, member, options } = interaction;
32-
const subcommand = options.getSubcommand();
33-
const filters = queue?.filters;
5+
data: new SlashCommandBuilder()
6+
.setName("filter")
7+
.setDescription(`${languages["en"].COMMAND_FILTER_DESCRIPTION}`)
8+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_DESCRIPTION}` })
9+
.setDMPermission(false)
10+
.addSubcommand((subcommand) =>
11+
subcommand
12+
.setName("toggle")
13+
.setDescription(`${languages["en"].COMMAND_FILTER_TOGGLE_DESCRIPTION}`)
14+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_TOGGLE_DESCRIPTION}` })
15+
.addStringOption((option) =>
16+
option
17+
.setName("name")
18+
.setDescription(`${languages["en"].COMMAND_FILTER_TOGGLE_OPTION_NAME}`)
19+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_TOGGLE_OPTION_NAME}` })
20+
.setChoices({ name: "3d", value: "3d" }, { name: "8d", value: "8d" }, { name: "bassboost", value: "bassboost" }, { name: "subboost", value: "subboost" }, { name: "purebass", value: "purebass" }, { name: "nightcore", value: "nightcore" }, { name: "vaporwave", value: "vaporwave" }, { name: "phaser", value: "phaser" }, { name: "tremolo", value: "tremolo" }, { name: "vibrato", value: "vibrato" }, { name: "pulsator", value: "pulsator" }, { name: "earwax", value: "earwax" }, { name: "echo", value: "echo" }, { name: "fast", value: "fast" }, { name: "flanger", value: "flanger" }, { name: "gate", value: "gate" }, { name: "haas", value: "haas" }, { name: "mcompand", value: "mcompand" })
21+
.setRequired(true)
22+
)
23+
)
24+
.addSubcommand((subcommand) =>
25+
subcommand
26+
.setName("reset")
27+
.setDescription(`${languages["en"].COMMAND_FILTER_RESET_DESCRIPTION}`)
28+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FILTER_RESET_DESCRIPTION}` })
29+
),
30+
run: async (client, interaction, guildData, queue, lang) => {
31+
const { guild, member, options } = interaction;
32+
const subcommand = options.getSubcommand();
33+
const filters = queue?.filters;
3434

35-
switch (subcommand) {
36-
case "toggle":
37-
const name = options.getString("name");
38-
if (!queue?.songs[0]) return client.sendErrorNotification(interaction, `${lang.ERROR_SONG_NO_PLAYING}`);
39-
if (!client.checkMemberIsInMyVoiceChannel(guild, member)) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
40-
if (!client.handleCooldown("filterCommand", guild.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
41-
await interaction.deferReply().catch((error) => { });
42-
try {
43-
// Toggle filter
44-
if (filters.has(name)) await filters.remove(name);
45-
else await filters.add(name);
46-
// Resume queue if paused
47-
if (queue.paused) client.distube.resume(queue);
48-
// Update dashboard message and send notification
49-
const filterNames = filters.names.map((filterName, i) => { return `\`${filterName}\`` }).join(", ");
50-
client.updateDashboardMessage(guild, queue, lang);
51-
client.sendNotification(interaction, `${lang.MESSAGE_FILTERS_ACTIVE} ${filterNames || lang.MESSAGE_FILTERS_NONE}`, { editReply: true });
52-
} catch (error) {
53-
const errorMessage = client.getErrorMessage(error.message, lang);
54-
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
55-
}
56-
break;
57-
case "reset":
58-
if (!filters?.size) return client.sendErrorNotification(interaction, `${lang.ERROR_FILTER_NO_ACTIVE}`);
59-
if (!client.checkMemberIsInMyVoiceChannel(guild, member)) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
60-
if (!client.handleCooldown("filterCommand", guild.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
61-
await interaction.deferReply().catch((error) => { });
62-
try {
63-
// Clear filters
64-
await filters.clear();
65-
// Resume queue if paused
66-
if (queue.paused) client.distube.resume(queue);
67-
// Update dashboard message and send notification
68-
client.updateDashboardMessage(guild, queue, lang);
69-
client.sendNotification(interaction, `${lang.MESSAGE_FILTERS_ACTIVE} ${lang.MESSAGE_FILTERS_NONE}`, { editReply: true });
70-
} catch (error) {
71-
const errorMessage = client.getErrorMessage(error.message, lang);
72-
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
73-
}
74-
break;
75-
}
76-
}
77-
}
35+
switch (subcommand) {
36+
case "toggle":
37+
const name = options.getString("name");
38+
if (!queue?.songs[0]) return client.sendErrorNotification(interaction, `${lang.ERROR_SONG_NO_PLAYING}`);
39+
if (!client.checkMemberIsInMyVoiceChannel(guild, member)) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
40+
if (!client.handleCooldown("filterCommand", guild.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
41+
await interaction.deferReply().catch((error) => { });
42+
try {
43+
// Toggle filter
44+
if (filters.has(name)) await filters.remove(name);
45+
else await filters.add(name);
46+
// Resume queue if paused
47+
if (queue.paused) client.distube.resume(queue);
48+
// Update dashboard message and send notification
49+
const filterNames = filters.names.map((filterName, i) => { return `\`${filterName}\`` }).join(", ");
50+
client.updateDashboardMessage(guild, queue, lang);
51+
client.sendNotification(interaction, `${lang.MESSAGE_FILTERS_ACTIVE} ${filterNames || lang.MESSAGE_FILTERS_NONE}`, { editReply: true });
52+
} catch (error) {
53+
const errorMessage = client.getErrorMessage(error.message, lang);
54+
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
55+
}
56+
break;
57+
case "reset":
58+
if (!filters?.size) return client.sendErrorNotification(interaction, `${lang.ERROR_FILTER_NO_ACTIVE}`);
59+
if (!client.checkMemberIsInMyVoiceChannel(guild, member)) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
60+
if (!client.handleCooldown("filterCommand", guild.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
61+
await interaction.deferReply().catch((error) => { });
62+
try {
63+
// Clear filters
64+
await filters.clear();
65+
// Resume queue if paused
66+
if (queue.paused) client.distube.resume(queue);
67+
// Update dashboard message and send notification
68+
client.updateDashboardMessage(guild, queue, lang);
69+
client.sendNotification(interaction, `${lang.MESSAGE_FILTERS_ACTIVE} ${lang.MESSAGE_FILTERS_NONE}`, { editReply: true });
70+
} catch (error) {
71+
const errorMessage = client.getErrorMessage(error.message, lang);
72+
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
73+
}
74+
break;
75+
}
76+
}
77+
}

commands/first.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ const { SlashCommandBuilder } = require("discord.js");
22
const languages = require("../utils/languages");
33

44
module.exports = {
5-
data: new SlashCommandBuilder()
6-
.setName("first")
7-
.setDescription(`${languages["en"].COMMAND_FIRST_DESCRIPTION}`)
8-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FIRST_DESCRIPTION}` })
9-
.setDMPermission(false)
10-
.addStringOption((option) =>
11-
option
12-
.setName("query")
13-
.setDescription(`${languages["en"].COMMAND_FIRST_OPTION_QUERY}`)
14-
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FIRST_OPTION_QUERY}` })
15-
.setRequired(true)
16-
),
17-
run: async (client, interaction, guildData, queue, lang) => {
18-
const { guild, channel, member, options } = interaction;
19-
const query = options.getString("query");
5+
data: new SlashCommandBuilder()
6+
.setName("first")
7+
.setDescription(`${languages["en"].COMMAND_FIRST_DESCRIPTION}`)
8+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FIRST_DESCRIPTION}` })
9+
.setDMPermission(false)
10+
.addStringOption((option) =>
11+
option
12+
.setName("query")
13+
.setDescription(`${languages["en"].COMMAND_FIRST_OPTION_QUERY}`)
14+
.setDescriptionLocalizations({ "fr": `${languages["fr"].COMMAND_FIRST_OPTION_QUERY}` })
15+
.setRequired(true)
16+
),
17+
run: async (client, interaction, guildData, queue, lang) => {
18+
const { guild, channel, member, options } = interaction;
19+
const query = options.getString("query");
2020

21-
if (!member.voice.channel) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_VOICE_CHANNEL}`);
22-
if (!client.checkMemberIsInMyVoiceChannel(guild, member) && queue) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
23-
if (!client.handleCooldown("playQuery", member.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
24-
await interaction.deferReply().catch((error) => { });
25-
try {
26-
// Play or add item to the queue at position 1 using query
27-
await client.distube.play(member.voice.channel, query, { textChannel: channel, member: member, metadata: interaction, position: 1 });
28-
} catch (error) {
29-
const errorMessage = client.getErrorMessage(error.message, lang);
30-
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
31-
}
32-
}
33-
}
21+
if (!member.voice.channel) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_VOICE_CHANNEL}`);
22+
if (!client.checkMemberIsInMyVoiceChannel(guild, member) && queue) return client.sendErrorNotification(interaction, `${lang.ERROR_MEMBER_MUST_JOIN_MY_VOICE_CHANNEL}`);
23+
if (!client.handleCooldown("playQuery", member.id, 2000)) return client.sendErrorNotification(interaction, `${lang.ERROR_ACTION_NOT_POSSIBLE}`);
24+
await interaction.deferReply().catch((error) => { });
25+
try {
26+
// Play or add item to the queue at position 1 using query
27+
await client.distube.play(member.voice.channel, query, { textChannel: channel, member: member, metadata: interaction, position: 1 });
28+
} catch (error) {
29+
const errorMessage = client.getErrorMessage(error.message, lang);
30+
client.sendErrorNotification(interaction, `${errorMessage}`, { editReply: true });
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)