refactor/declare command option types

This commit is contained in:
SowinskiBraeden committed 2023-09-10 00:41:45 -07:00
1 parent 28737c5756
commit ab2b59ff11
18 files changed
+170 -128

No files matched your search

+34 -21
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js'); const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const bitfieldCalculator = require('discord-bitfield-calculator'); const bitfieldCalculator = require('discord-bitfield-calculator');
const { BanPlayer, UnbanPlayer, RestartServer, CheckServerStatus } = require('../util/NitradoAPI'); const { BanPlayer, UnbanPlayer, RestartServer, CheckServerStatus } = require('../util/NitradoAPI');
const { Armbands } = require('../config/armbandsdb.js'); const { Armbands } = require('../config/armbandsdb.js');
@@ -17,92 +18,92 @@ module.exports = {
name: "gamertag-link", name: "gamertag-link",
description: "link a gamertag for a user", description: "link a gamertag for a user",
value: "gamertag-link", value: "gamertag-link",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "user", name: "user",
description: "User to link gamertag to", description: "User to link gamertag to",
value: "user", value: "user",
type: 6, type: CommandOptions.User,
required: true, required: true,
}, },
{ {
name: "gamertag", name: "gamertag",
description: "Gamertag of player", description: "Gamertag of player",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, { }, {
name: "gamertag-unlink", name: "gamertag-unlink",
description: "unlink a gamertag for a user", description: "unlink a gamertag for a user",
value: "gamertag-unlink", value: "gamertag-unlink",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "user", name: "user",
description: "User to link gamertag to", description: "User to link gamertag to",
value: "user", value: "user",
type: 6, type: CommandOptions.User,
required: true, required: true,
}] }]
}, { }, {
name: "claim-armband", name: "claim-armband",
description: "Claim an armband for a faction", description: "Claim an armband for a faction",
value: "claim-armband", value: "claim-armband",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "faction_role", name: "faction_role",
description: "Claim an armband for this faction role.", description: "Claim an armband for this faction role.",
value: "faction_role", value: "faction_role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}] }]
}, { }, {
name: "bounty-clear", name: "bounty-clear",
description: "clear a bounty off a player", description: "clear a bounty off a player",
value: "bounty-clear", value: "bounty-clear",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "Gamertag of player", description: "Gamertag of player",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, { }, {
name: "ban-player", name: "ban-player",
description: "Ban a player from the DayZ server", description: "Ban a player from the DayZ server",
value: "ban-player", value: "ban-player",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "gamertag of the player to ban.", description: "gamertag of the player to ban.",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, { }, {
name: "unban-player", name: "unban-player",
description: "Unban a player from the DayZ server", description: "Unban a player from the DayZ server",
value: "unban-player", value: "unban-player",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "gamertag of the player to unban.", description: "gamertag of the player to unban.",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, { }, {
name: "add-money", name: "add-money",
description: "Add money to user", description: "Add money to user",
value: "add", value: "add",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "amount", name: "amount",
description: "The amount to add to balance", description: "The amount to add to balance",
value: "amount", value: "amount",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
@@ -110,7 +111,7 @@ module.exports = {
name: "to", name: "to",
description: "User to alter balance", description: "User to alter balance",
value: "to", value: "to",
type: 6, type: CommandOptions.User,
required: true, required: true,
}, },
] ]
@@ -119,13 +120,13 @@ module.exports = {
name: "remove-money", name: "remove-money",
description: "Remove or remove money from a user", description: "Remove or remove money from a user",
value: "remove", value: "remove",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "amount", name: "amount",
description: "The amount to add to balance", description: "The amount to add to balance",
value: "amount", value: "amount",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
@@ -133,7 +134,7 @@ module.exports = {
name: "from", name: "from",
description: "User to alter balance", description: "User to alter balance",
value: "from", value: "from",
type: 6, type: CommandOptions.User,
required: true, required: true,
}, },
] ]
@@ -141,12 +142,24 @@ module.exports = {
name: "restart", name: "restart",
description: "Restart the DayZ Server", description: "Restart the DayZ Server",
value: "restart", value: "restart",
type: 1, type: CommandOptions.SubCommand,
}, { }, {
name: "auto-restart", name: "auto-restart",
description: "Enable/Disable periodic server checks and restart if stopped.", description: "Enable/Disable periodic server checks and restart if stopped.",
value: "auto-restart", value: "auto-restart",
type: 1, type: CommandOptions.SubCommand,
}, {
name: "combat-log-timer",
description: "Set the number of minutes to elapse for a player to not combat log. (Set to 0 to disbable combat logging detection)",
value: "combat-log-timer",
type: CommandOptions.SubCommand,
options: [{
name: "minutes",
description: "Minutes to qualify combat log",
value: 5,
type: CommandOptions.Integer, // Integer
}]
}], }],
SlashCommand: { SlashCommand: {
/** /**
+25 -24
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js'); const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const bitfieldCalculator = require('discord-bitfield-calculator'); const bitfieldCalculator = require('discord-bitfield-calculator');
module.exports = { module.exports = {
@@ -16,13 +17,13 @@ module.exports = {
name: "create", name: "create",
description: "Create a new Zone Ping Alarm", description: "Create a new Zone Ping Alarm",
value: "create", value: "create",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "x-coord", name: "x-coord",
description: "X Coordinate of the origin", description: "X Coordinate of the origin",
value: "x-coord", value: "x-coord",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
@@ -30,7 +31,7 @@ module.exports = {
name: "y-coord", name: "y-coord",
description: "Y Coordinate of the origin", description: "Y Coordinate of the origin",
value: "y-coord", value: "y-coord",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
@@ -38,7 +39,7 @@ module.exports = {
name: "radius", name: "radius",
description: "Radius of Zone Alarm", description: "Radius of Zone Alarm",
value: "radius", value: "radius",
type: 10, type: CommandOptions.Float,
min_value: 25.00, min_value: 25.00,
required: true, required: true,
}, },
@@ -46,14 +47,14 @@ module.exports = {
name: "name", name: "name",
description: "Zone Alarm Name", description: "Zone Alarm Name",
value: "name", value: "name",
type: 3, type: CommandOptions.String,
required: true, required: true,
}, },
{ {
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}, },
@@ -61,21 +62,21 @@ module.exports = {
name: "role", name: "role",
description: "Role to Ping on Zone Alarm", description: "Role to Ping on Zone Alarm",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}, },
{ {
name: "emp-exempt", name: "emp-exempt",
description: "Is this Alarm Exempt to EMP Attacks?", description: "Is this Alarm Exempt to EMP Attacks?",
value: false, value: false,
type: 5, type: CommandOptions.Boolean,
required: false, required: false,
}, },
{ {
name: "show-player-coords", name: "show-player-coords",
description: "Show a players coords when in the zone", description: "Show a players coords when in the zone",
value: true, value: true,
type: 5, type: CommandOptions.Boolean,
required: false, required: false,
} }
] ]
@@ -84,18 +85,18 @@ module.exports = {
name: "delete", name: "delete",
description: "Delete a Zone Alarm", description: "Delete a Zone Alarm",
value: "delete", value: "delete",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "add-player", name: "add-player",
description: "Add Player to be Ignored in a Zone Alarm Pings", description: "Add Player to be Ignored in a Zone Alarm Pings",
value: "add-player", value: "add-player",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "Gamertag of Player to Ignore", description: "Gamertag of Player to Ignore",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, },
@@ -103,12 +104,12 @@ module.exports = {
name: "remove-player", name: "remove-player",
description: "Remove a Player from being Ignored in a Zone Alarm Pings", description: "Remove a Player from being Ignored in a Zone Alarm Pings",
value: "remove-player", value: "remove-player",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "Gamertag of Player to Ignore", description: "Gamertag of Player to Ignore",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, },
@@ -116,24 +117,24 @@ module.exports = {
name: "disable", name: "disable",
description: "Disable an Zone Alarm", description: "Disable an Zone Alarm",
value: "disable", value: "disable",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "enable", name: "enable",
description: "Enable an Zone Alarm", description: "Enable an Zone Alarm",
value: "enable", value: "enable",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "set-rule", name: "set-rule",
description: "Add a Rule to an Alarm", description: "Add a Rule to an Alarm",
value: "set-rule", value: "set-rule",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "rule", name: "rule",
description: "Rule to Add to an Alarm", description: "Rule to Add to an Alarm",
value: "rule", value: "rule",
type: 3, type: CommandOptions.String,
required: true, required: true,
choices: [ choices: [
{ name: 'Ban on Entry', value: 'ban_on_entry' }, { name: 'Ban on Entry', value: 'ban_on_entry' },
@@ -145,18 +146,18 @@ module.exports = {
name: "remove-rule", name: "remove-rule",
description: "Remove a Rule from an Alarm", description: "Remove a Rule from an Alarm",
value: "remove-rule", value: "remove-rule",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "rename", name: "rename",
description: "Rename an Alarm", description: "Rename an Alarm",
value: "rename", value: "rename",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "name", name: "name",
description: "New Alarm Name", description: "New Alarm Name",
value: "name", value: "name",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, },
@@ -164,12 +165,12 @@ module.exports = {
name: "move-origin", name: "move-origin",
description: "Move an alarms origin to new coordinates", description: "Move an alarms origin to new coordinates",
value: "move-origin", value: "move-origin",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "x-coord", name: "x-coord",
description: "X Coordinate of the origin", description: "X Coordinate of the origin",
value: "x-coord", value: "x-coord",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
@@ -177,7 +178,7 @@ module.exports = {
name: "y-coord", name: "y-coord",
description: "Y Coordinate of the origin", description: "Y Coordinate of the origin",
value: "y-coord", value: "y-coord",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}] }]
+6 -5
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const { User, addUser } = require('../structures/user'); const { User, addUser } = require('../structures/user');
module.exports = { module.exports = {
@@ -16,12 +17,12 @@ module.exports = {
name: "balance", name: "balance",
description: "View your bank balance and count your cash", description: "View your bank balance and count your cash",
value: "balance", value: "balance",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "user", name: "user",
description: "User to view ballance", description: "User to view ballance",
value: "user", value: "user",
type: 6, type: CommandOptions.User,
required: false, required: false,
}] }]
}, },
@@ -29,20 +30,20 @@ module.exports = {
name: "transfer", name: "transfer",
description: "Transfer directly to users bank", description: "Transfer directly to users bank",
value: "transfer", value: "transfer",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "user", name: "user",
description: "User to transfer to", description: "User to transfer to",
value: "user", value: "user",
type: 6, type: CommandOptions.User,
required: true, required: true,
}, },
{ {
name: "amount", name: "amount",
description: "The amount to transfer", description: "The amount to transfer",
value: "amount", value: "amount",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
+7 -6
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
module.exports = { module.exports = {
name: "bounty", name: "bounty",
@@ -14,37 +15,37 @@ module.exports = {
name: "set", name: "set",
description: "Set a bounty on a player", description: "Set a bounty on a player",
value: "set", value: "set",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "Gamertag of player for bounty", description: "Gamertag of player for bounty",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}, { }, {
name: "value", name: "value",
description: "Amount of the bounty", description: "Amount of the bounty",
value: "value", value: "value",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true required: true
}, { }, {
name: "anonymous", name: "anonymous",
description: "Make this bounty anonymous", description: "Make this bounty anonymous",
value: false, value: false,
type: 5, type: CommandOptions.Boolean,
required: false required: false
}] }]
}, { }, {
name: "pay", name: "pay",
description: "Pay off your bounty (double price)", description: "Pay off your bounty (double price)",
value: "pay", value: "pay",
type: 1, type: CommandOptions.SubCommand,
}, { }, {
name: "view", name: "view",
description: "View all active bounties", description: "View all active bounties",
value: "view", value: "view",
type: 1, type: CommandOptions.SubCommand,
}], }],
SlashCommand: { SlashCommand: {
/** /**
+2 -1
View File
@@ -1,4 +1,5 @@
const { ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js'); const { ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const { Armbands } = require('../config/armbandsdb.js'); const { Armbands } = require('../config/armbandsdb.js');
module.exports = { module.exports = {
@@ -15,7 +16,7 @@ module.exports = {
name: "faction_role", name: "faction_role",
description: "Claim an armband for this faction role.", description: "Claim an armband for this faction role.",
value: "faction_role", value: "faction_role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}], }],
SlashCommand: { SlashCommand: {
+44 -43
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const bitfieldCalculator = require('discord-bitfield-calculator'); const bitfieldCalculator = require('discord-bitfield-calculator');
module.exports = { module.exports = {
@@ -16,18 +17,18 @@ module.exports = {
name: "allowed_channels", name: "allowed_channels",
description: "Set channels you're allowed to use the bot in", description: "Set channels you're allowed to use the bot in",
value: "allowed_channels", value: "allowed_channels",
type: 2, type: CommandOptions.SubCommandGroup,
options: [ options: [
{ {
name: "add", name: "add",
description: "Add channel", description: "Add channel",
value: "add", value: "add",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -36,12 +37,12 @@ module.exports = {
name: "remove", name: "remove",
description: "Remove channel", description: "Remove channel",
value: "remove", value: "remove",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -52,12 +53,12 @@ module.exports = {
name: "killfeed_channel", name: "killfeed_channel",
description: "Set the Killfeed Channel", description: "Set the Killfeed Channel",
value: "killfeed_channel", value: "killfeed_channel",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -66,12 +67,12 @@ module.exports = {
name: "admin_logs_channel", name: "admin_logs_channel",
description: "Set the Admin Logs Channel", description: "Set the Admin Logs Channel",
value: "admin_logs_channel", value: "admin_logs_channel",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -80,12 +81,12 @@ module.exports = {
name: "welcome_channel", name: "welcome_channel",
description: "Set the channel for users to gain access", description: "Set the channel for users to gain access",
value: "welcome_channel", value: "welcome_channel",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -94,12 +95,12 @@ module.exports = {
name: "active_players_channel", name: "active_players_channel",
description: "Set the channel for active players update", description: "Set the channel for active players update",
value: "active_players_channel", value: "active_players_channel",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "channel", name: "channel",
description: "The channel to configure", description: "The channel to configure",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -108,12 +109,12 @@ module.exports = {
name: "linked_gt_role", name: "linked_gt_role",
description: "Access Role to give to users", description: "Access Role to give to users",
value: "linked_gt_role", value: "linked_gt_role",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "role", name: "role",
description: "Role to configure", description: "Role to configure",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}] }]
}, },
@@ -121,12 +122,12 @@ module.exports = {
name: "member_role", name: "member_role",
description: "Role to give users when they join.", description: "Role to give users when they join.",
value: "member_role", value: "member_role",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "role", name: "role",
description: "Role to configure", description: "Role to configure",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}] }]
}, },
@@ -134,13 +135,13 @@ module.exports = {
name: "bot_admin_role", name: "bot_admin_role",
description: "Set/remove bot admin role", description: "Set/remove bot admin role",
value: "bot_admin_role", value: "bot_admin_role",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "action", name: "action",
description: "Add or remove a role from the exclude list.", description: "Add or remove a role from the exclude list.",
value: "action", value: "action",
type: 3, type: CommandOptions.String,
choices: [ choices: [
{ name: 'add', value: 'add' }, { name: 'remove', value: 'remove' }, { name: 'add', value: 'add' }, { name: 'remove', value: 'remove' },
], ],
@@ -150,7 +151,7 @@ module.exports = {
name: "role", name: "role",
description: "Role to configure", description: "Role to configure",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}, },
] ]
@@ -159,12 +160,12 @@ module.exports = {
name: "admin_role", name: "admin_role",
description: "Discord Server's dedicated admin role", description: "Discord Server's dedicated admin role",
value: "admin_role", value: "admin_role",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "role", name: "role",
description: "Role to configure", description: "Role to configure",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}] }]
}, },
@@ -172,13 +173,13 @@ module.exports = {
name: "exclude", name: "exclude",
description: "Exclude roles from users to use to claim a flag.", description: "Exclude roles from users to use to claim a flag.",
value: "exclude", value: "exclude",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "action", name: "action",
description: "Add or remove a role from the exclude list.", description: "Add or remove a role from the exclude list.",
value: "action", value: "action",
type: 3, type: CommandOptions.String,
choices: [ choices: [
{ name: 'add', value: 'add' }, { name: 'remove', value: 'remove' }, { name: 'add', value: 'add' }, { name: 'remove', value: 'remove' },
], ],
@@ -188,7 +189,7 @@ module.exports = {
name: "role", name: "role",
description: "The role to manage", description: "The role to manage",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}, },
] ]
@@ -197,24 +198,24 @@ module.exports = {
name: "reset", name: "reset",
description: "Restore all settings to default configurations", description: "Restore all settings to default configurations",
value: "reset", value: "reset",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "view", name: "view",
description: "View current settings configuration", description: "View current settings configuration",
value: "view", value: "view",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "starting_balance", name: "starting_balance",
description: "Set the starting balance", description: "Set the starting balance",
value: "starting_balance", value: "starting_balance",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "amount", name: "amount",
description: "The amount to set the starting balance", description: "The amount to set the starting balance",
value: "amount", value: "amount",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}] }]
@@ -223,12 +224,12 @@ module.exports = {
name: "uav-price", name: "uav-price",
description: "Configure the price of a UAV", description: "Configure the price of a UAV",
value: "uav-price", value: "uav-price",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "amount", name: "amount",
description: "The amount to set the UAV price", description: "The amount to set the UAV price",
value: "amount", value: "amount",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}] }]
@@ -237,12 +238,12 @@ module.exports = {
name: "emp-price", name: "emp-price",
description: "Configure the price of an EMP", description: "Configure the price of an EMP",
value: "emp-price", value: "emp-price",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "amount", name: "amount",
description: "The amount to set the EMP price", description: "The amount to set the EMP price",
value: "amount", value: "amount",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}] }]
@@ -251,26 +252,26 @@ module.exports = {
name: "income_role", name: "income_role",
description: "Add/update a role to earn income on /collect-income command", description: "Add/update a role to earn income on /collect-income command",
value: "set_income_role", value: "set_income_role",
type: 2, type: CommandOptions.SubCommandGroup,
options: [ options: [
{ {
name: "set", name: "set",
description: "Set role", description: "Set role",
value: "set", value: "set",
type: 1, type: CommandOptions.SubCommand,
options: [ options: [
{ {
name: "role", name: "role",
description: "Role to set", description: "Role to set",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}, },
{ {
name: "amount", name: "amount",
description: "The amount to collect", description: "The amount to collect",
value: 120.00, value: 120.00,
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
} }
@@ -280,12 +281,12 @@ module.exports = {
name: "remove", name: "remove",
description: "Remove role", description: "Remove role",
value: "remove", value: "remove",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "role", name: "role",
description: "Role to remove", description: "Role to remove",
value: "role", value: "role",
type: 8, type: CommandOptions.Role,
required: true, required: true,
}] }]
}, },
@@ -295,12 +296,12 @@ module.exports = {
name: "income_limiter", name: "income_limiter",
description: "Change the number of hours to wait before collecting income", description: "Change the number of hours to wait before collecting income",
value: "income_limiter", value: "income_limiter",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "hours", name: "hours",
description: "Number of hours till income can be collected", description: "Number of hours till income can be collected",
value: 168.00, // 1 week value: 168.00, // 1 week
type: 10, type: CommandOptions.Float,
required: true, required: true,
}] }]
}, },
@@ -308,12 +309,12 @@ module.exports = {
name: "show_killfeed_coords", name: "show_killfeed_coords",
description: "Show the coordinates of the killer or victim in the killfeed channel.", description: "Show the coordinates of the killer or victim in the killfeed channel.",
value: "show_killfeed_coords", value: "show_killfeed_coords",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "configuration", name: "configuration",
description: "True or False", description: "True or False",
value: false, value: false,
type: 5, type: CommandOptions.Boolean,
required: true, required: true,
}] }]
} }
+7 -6
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js'); const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const bitfieldCalculator = require('discord-bitfield-calculator'); const bitfieldCalculator = require('discord-bitfield-calculator');
module.exports = { module.exports = {
@@ -15,19 +16,19 @@ module.exports = {
name: "player-track", name: "player-track",
description: "track a player and announce location", description: "track a player and announce location",
value: "player-track", value: "player-track",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "Gamertag of player", description: "Gamertag of player",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}, },
{ {
name: "time", name: "time",
description: "duration of tracking", description: "duration of tracking",
value: "time", value: "time",
type: 4, type: CommandOptions.Integer,
required: true, required: true,
choices: [ choices: [
{ name: '30-minutes', value: 30 }, { name: '60-minutes', value: 60 }, { name: '90-minutes', value: 90 }, { name: '120-minutes', value: 120 }, { name: '30-minutes', value: 30 }, { name: '60-minutes', value: 60 }, { name: '90-minutes', value: 90 }, { name: '120-minutes', value: 120 },
@@ -37,14 +38,14 @@ module.exports = {
name: "event-name", name: "event-name",
description: "name of the event", description: "name of the event",
value: "event-name", value: "event-name",
type: 3, type: CommandOptions.String,
required: true, required: true,
}, },
{ {
name: "channel", name: "channel",
description: "channel to host event", description: "channel to host event",
value: "channel", value: "channel",
type: 7, type: CommandOptions.Channel,
channel_types: [0], // Restrict to text channel channel_types: [0], // Restrict to text channel
required: true, required: true,
}] }]
@@ -52,7 +53,7 @@ module.exports = {
name: "delete", name: "delete",
description: "delete an active event", description: "delete an active event",
value: "delete", value: "delete",
type: 1 type: CommandOptions.SubCommand
}], }],
SlashCommand: { SlashCommand: {
/** /**
+2 -1
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const { Armbands } = require('../config/armbandsdb.js'); const { Armbands } = require('../config/armbandsdb.js');
module.exports = { module.exports = {
@@ -15,7 +16,7 @@ module.exports = {
name: "faction_role", name: "faction_role",
description: "View a specific faction's armband by role", description: "View a specific faction's armband by role",
value: "faction_role", value: "faction_role",
type: 8, type: CommandOptions.Role,
required: false, required: false,
}], }],
SlashCommand: { SlashCommand: {
+2 -1
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
module.exports = { module.exports = {
name: "gamertag-link", name: "gamertag-link",
@@ -14,7 +15,7 @@ module.exports = {
name: "gamertag", name: "gamertag",
description: "Gamertag of player", description: "Gamertag of player",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}], }],
SlashCommand: { SlashCommand: {
+6 -5
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require("discord.js"); const { EmbedBuilder } = require("discord.js");
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
module.exports = { module.exports = {
name: "help", name: "help",
@@ -15,12 +16,12 @@ module.exports = {
name: "commands", name: "commands",
description: "List all commands", description: "List all commands",
value: "commands", value: "commands",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "command", name: "command",
description: "Get information on a specific command", description: "Get information on a specific command",
value: "command", value: "command",
type: 3, type: CommandOptions.String,
required: false, required: false,
}] }]
}, },
@@ -28,19 +29,19 @@ module.exports = {
name: "support", name: "support",
description: "Get support for Applicatz", description: "Get support for Applicatz",
value: "support", value: "support",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "credits", name: "credits",
description: "DayZR Bot Credits", description: "DayZR Bot Credits",
value: "credits", value: "credits",
type: 1, type: CommandOptions.SubCommand,
}, },
{ {
name: "stats", name: "stats",
description: "Current Bot Statistics", description: "Current Bot Statistics",
value: "stats", value: "stats",
type: 1, type: CommandOptions.SubCommand,
} }
], ],
SlashCommand: { SlashCommand: {
+3 -2
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
module.exports = { module.exports = {
name: "leaderboard", name: "leaderboard",
@@ -14,7 +15,7 @@ module.exports = {
name: "category", name: "category",
description: "Leaderboard Category", description: "Leaderboard Category",
value: "category", value: "category",
type: 3, type: CommandOptions.String,
required: true, required: true,
choices: [ choices: [
{ name: "money", value: "money" }, { name: "money", value: "money" },
@@ -33,7 +34,7 @@ module.exports = {
name: "limit", name: "limit",
description: "leaderboard limit", description: "leaderboard limit",
value: "limit", value: "limit",
type: 4, type: CommandOptions.Integer,
min_value: 1, min_value: 1,
max_value: 25, max_value: 25,
required: true, required: true,
+5 -4
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
module.exports = { module.exports = {
name: "lookup", name: "lookup",
@@ -14,24 +15,24 @@ module.exports = {
name: "discord", name: "discord",
description: "Find a Discord user from a Gamertag", description: "Find a Discord user from a Gamertag",
value: "discord", value: "discord",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "gamertag", name: "gamertag",
description: "Gamertag of player", description: "Gamertag of player",
value: "gamertag", value: "gamertag",
type: 3, type: CommandOptions.String,
required: true, required: true,
}] }]
}, { }, {
name: "gamertag", name: "gamertag",
description: "Find a Gamertag from a Discord user", description: "Find a Gamertag from a Discord user",
value: "gamertag", value: "gamertag",
type: 1, type: CommandOptions.SubCommand,
options: [{ options: [{
name: "user", name: "user",
description: "Discord User", description: "Discord User",
value: "user", value: "user",
type: 6, type: CommandOptions.User,
required: true, required: true,
}] }]
}], }],
+4 -3
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
module.exports = { module.exports = {
name: "player-stats", name: "player-stats",
@@ -14,7 +15,7 @@ module.exports = {
name: "category", name: "category",
description: "Leaderboard Category", description: "Leaderboard Category",
value: "category", value: "category",
type: 3, type: CommandOptions.String,
required: true, required: true,
choices: [ choices: [
{ name: "money", value: "money" }, { name: "money", value: "money" },
@@ -33,12 +34,12 @@ module.exports = {
name: "discord", name: "discord",
description: "discord user to lookup stats", description: "discord user to lookup stats",
value: "discord", value: "discord",
type: 6, type: CommandOptions.User,
required: false, required: false,
}, { }, {
name: "gamertag", name: "gamertag",
description: "gamertag to lookup stats", description: "gamertag to lookup stats",
type: 3, type: CommandOptions.String,
required: false, required: false,
}], }],
SlashCommand: { SlashCommand: {
+3 -2
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const { User, addUser } = require('../structures/user') const { User, addUser } = require('../structures/user')
module.exports = { module.exports = {
@@ -16,7 +17,7 @@ module.exports = {
name: "x-coord", name: "x-coord",
description: "X Coordinate of the origin", description: "X Coordinate of the origin",
value: "x-coord", value: "x-coord",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
@@ -24,7 +25,7 @@ module.exports = {
name: "y-coord", name: "y-coord",
description: "Y Coordinate of the origin", description: "Y Coordinate of the origin",
value: "y-coord", value: "y-coord",
type: 10, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, },
+2 -1
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
const { addUser } = require('../structures/user'); const { addUser } = require('../structures/user');
const bitfieldCalculator = require('discord-bitfield-calculator'); const bitfieldCalculator = require('discord-bitfield-calculator');
@@ -16,7 +17,7 @@ module.exports = {
name: "user", name: "user",
description: "User to reset", description: "User to reset",
value: "user", value: "user",
type: 6, type: CommandOptions.User,
required: true, required: true,
}], }],
SlashCommand: { SlashCommand: {
+1 -1
View File
@@ -27,7 +27,7 @@ module.exports = {
mongoURI: process.env.mongoURI || "mongodb://localhost:27017", mongoURI: process.env.mongoURI || "mongodb://localhost:27017",
dbo: process.env.dbo || "knoldus", dbo: process.env.dbo || "knoldus",
Presence: { Presence: {
type: 3, // Watching, Playing = 0, Streaming = 1, Listening = 2, Custom = 4, Competing = 5 type: CommandOptions.String, // Watching, Playing = 0, Streaming = 1, Listening = 2, Custom = 4, Competing = 5
name: "DayZ Logs", // What message you want after type name: "DayZ Logs", // What message you want after type
status: "online", // You can show either "idle", "dnd", "online", or "offline" status: "online", // You can show either "idle", "dnd", "online", or "offline"
}, },
+2 -2
View File
@@ -78,7 +78,7 @@ class DayzRBot extends Client {
return await rest.post(Routes.interactionCallback(interaction.id, interaction.token), { return await rest.post(Routes.interactionCallback(interaction.id, interaction.token), {
body: { body: {
type: 4, type: CommandOptions.Integer,
data: message, data: message,
} }
}); });
@@ -391,7 +391,7 @@ class DayzRBot extends Client {
autoRestart: 0, autoRestart: 0,
allowedChannels: [], allowedChannels: [],
killfeedChannel: "", killfeedChannel: "",
showKillfeedCoords: false, showKillfeedCoords: 0,
connectionLogsChannel: "", connectionLogsChannel: "",
activePlayersChannel: "", activePlayersChannel: "",
welcomeChannel: "", welcomeChannel: "",
+15
View File
@@ -0,0 +1,15 @@
module.exports = {
CommandOptionTypes: {
SubCommand: 1,
SubCommandGroup: 2,
String: 3,
Integer: 4,
Boolean: 5,
User: 6,
Channel: 7,
Role: 8,
Mentionable: 9,
Float: 10, // AKA Number in Discord's Documentation
Attachment: 11,
}
};