change/configure channels in single command config set_channel

This commit is contained in:
SowinskiBraeden committed 2023-10-25 09:37:58 -07:00
1 parent 3b74f48710
commit fcab94ea09
2 files changed
+22 -89

No files matched your search

+21 -88
View File
@@ -51,60 +51,31 @@ module.exports = {
] ]
}, },
{ {
name: "killfeed_channel", name: "set_channel",
description: "Set the Killfeed Channel", description: "Set one of the desired channels",
value: "killfeed_channel", value: "set_channel",
type: CommandOptions.SubCommand, type: CommandOptions.SubCommand,
options: [{ options:[
name: "channel", {
description: "The channel to configure", name: "channel_type",
value: "channel", description: "Select the channel type",
type: CommandOptions.Channel, value: "channel_type",
channel_types: [0], // Restrict to text channel type: CommandOptions.String,
choices: [
{ name: 'Killfeed', value: 'killfeedChannel' }, { name: 'Admin Logs', value: 'connectionLogsChannel' },
{ name: 'Welcome', value: 'welcomeChannel' }, { name: 'Online Players', value: 'activePlayersChannel' },
],
required: true, required: true,
}]
}, },
{ {
name: "admin_logs_channel",
description: "Set the Admin Logs Channel",
value: "admin_logs_channel",
type: CommandOptions.SubCommand,
options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: CommandOptions.Channel, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}]
}, },
{ ]
name: "welcome_channel",
description: "Set the channel for users to gain access",
value: "welcome_channel",
type: CommandOptions.SubCommand,
options: [{
name: "channel",
description: "The channel to configure",
value: "channel",
type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel
required: true,
}]
},
{
name: "active_players_channel",
description: "Set the channel for active players update",
value: "active_players_channel",
type: CommandOptions.SubCommand,
options: [{
name: "channel",
description: "The channel to configure",
value: "channel",
type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel
required: true,
}]
}, },
{ {
name: "linked_gt_role", name: "linked_gt_role",
@@ -547,18 +518,19 @@ module.exports = {
return interaction.send({ embeds: [settingsEmbed] }); return interaction.send({ embeds: [settingsEmbed] });
case 'killfeed_channel': case 'set_channel':
const killfeedChannel = args[0].options[0].value; const channelType = args[0].options[0].value;
const channel = args[0].options[1].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.killfeedChannel": killfeedChannel}}, (err, res) => { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {[`server.${channelType}`]: channel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
const successSetKillfeedChannelEmbed = new EmbedBuilder() const successSetChannelEmbed = new EmbedBuilder()
.setDescription(`Successfully added <#${killfeedChannel}> as the Killfeed Channel.`) .setDescription(`Successfully set <#${channel}> as the ${channelType} channel.`)
.setColor(client.config.Colors.Green); .setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successSetKillfeedChannelEmbed] }); return interaction.send({ embeds: [successSetChannelEmbed] });
case 'show_killfeed_coords': case 'show_killfeed_coords':
const showKillfeedCoordsConfiguration = args[0].options[0].value ? 1 : 0; const showKillfeedCoordsConfiguration = args[0].options[0].value ? 1 : 0;
@@ -573,45 +545,6 @@ module.exports = {
return interaction.send({ embeds: [successConfigureShowKillfeedCoords] }); return interaction.send({ embeds: [successConfigureShowKillfeedCoords] });
case 'admin_logs_channel':
const adminLogsChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.connectionLogsChannel": adminLogsChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err);
});
const successAdminLogsChannelEmbed = new EmbedBuilder()
.setDescription(`Successfully set <#${adminLogsChannel}> as the Admin Logs Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successAdminLogsChannelEmbed] });
case 'welcome_channel':
const welcomeChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.welcomeChannel": welcomeChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err);
});
const successWelcomeChannelEmbed = new EmbedBuilder()
.setDescription(`Successfully set <#${welcomeChannel}> as the Welcome Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successWelcomeChannelEmbed] });
case 'active_players_channel':
const acticePlayersChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.activePlayersChannel": acticePlayersChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err);
});
const successActivePlayersChannelEmbed = new EmbedBuilder()
.setDescription(`Successfully set <#${acticePlayersChannel}> as the Active Players Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successActivePlayersChannelEmbed] });
case 'linked_gt_role': case 'linked_gt_role':
const linked_gt_role = args[0].options[0].value; const linked_gt_role = args[0].options[0].value;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "11.2.5", "version": "11.3.0",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {