welcome users, gamertag link, other general modifications

This commit is contained in:
SowinskiBraeden committed 2023-03-20 13:47:37 -07:00
1 parent d55096e7e1
commit 972c16557a
15 files changed
+402 -48

No files matched your search

+104 -22
View File
@@ -1,4 +1,4 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } = require('discord.js');
const bitfieldCalculator = require('discord-bitfield-calculator');
module.exports = {
@@ -51,9 +51,10 @@ module.exports = {
},
{
name: "channel",
description: "Channel for Zone Alarm Pings",
description: "The channel to configure",
value: "channel",
type: 7,
channel_types: [0], // Restrict to text channel
required: true,
},
{
@@ -66,7 +67,14 @@ module.exports = {
{
name: "emp-exempt",
description: "Is this Alarm Exempt to EMP Attacks?",
value: "emp-exempt",
value: false,
type: 5,
required: false,
},
{
name: "show-player-coords",
description: "Show a players coords when in the zone",
value: true,
type: 5,
required: false,
}
@@ -112,29 +120,41 @@ module.exports = {
}]
},
{
name: "set-rule",
description: "Add a Rule to an Alarm",
value: "set-rule",
name: "disable",
description: "Disable an Zone Alarm",
value: "disable",
type: 1,
options: [{
name: "rule",
description: "Rule to Add to an Alarm",
value: "rule",
type: 3,
required: true,
choices: [
{ name: 'Ban on Entry', value: 'ban_on_entry' },
{ name: 'Ban on Kill', value: 'ban_on_kill' },
{ name: 'Ban on IED Set', value: 'ban_on_ied_set' },
]
}]
},
{
name: "remove-rule",
description: "Remove a Rule from an Alarm",
value: "set-rule",
name: "enable",
description: "Enable an Zone Alarm",
value: "enable",
type: 1,
}
// {
// name: "set-rule",
// description: "Add a Rule to an Alarm",
// value: "set-rule",
// type: 1,
// options: [{
// name: "rule",
// description: "Rule to Add to an Alarm",
// value: "rule",
// type: 3,
// required: true,
// choices: [
// { name: 'Ban on Entry', value: 'ban_on_entry' },
// { name: 'Ban on Kill', value: 'ban_on_kill' },
// { name: 'Ban on IED Set', value: 'ban_on_ied_set' },
// ]
// }]
// },
// {
// name: "remove-rule",
// description: "Remove a Rule from an Alarm",
// value: "remove-rule",
// type: 1,
// }
],
SlashCommand: {
/**
@@ -164,7 +184,8 @@ module.exports = {
ignoredPlayers: [],
rules: [],
empExempt: client.exists(args[0].options[6]) ? args[0].options[6].value : false,
disabled: false, // emp related
showPlayerCoord: client.exists(args[0].options[7]) ? args[0].options[7].value : true,
disabled: false,
};
client.dbo.collection('guilds').updateOne({ 'server.serverID': GuildDB.serverID }, {
@@ -243,6 +264,37 @@ module.exports = {
const opt = new ActionRowBuilder().addComponents(alarms);
return interaction.send({ components: [opt], flags: (1 << 6) });
} else if (args[0].name == 'enable' || args[0].name == 'disable') {
if (GuildDB.alarms.length == 0) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Default).setDescription('**Notice:** No Existing Alarms to configure.')] });
let disable = args[0].name == 'disable' ? true : false;
let alarms = new SelectMenuBuilder()
.setCustomId(`EnableOrDisableAlarm-${disable ? 'disable' : 'enable'}-${interaction.member.user.id}`)
.setPlaceholder(`Select an Alarm to ${disable ? 'disable' : 'enable'}.`);
for (let i = 0; i < GuildDB.alarms.length; i++) {
if (disable && !GuildDB.alarms[i].disabled) {
alarms.addOptions({
label: GuildDB.alarm[i].name,
description: `Disable this alarm`,
value: GuildDB.alarm[i].name,
})
} else if (!disable && GuildDB.alarms[i].disabled) {
alarms.addOptions({
label: GuildDB.alarm[i].name,
description: `Enable this alarm`,
value: GuildDB.alarm[i].name,
})
}
}
const opt = new ActionRowBuilder().addComponents(alarms);
return interaction.send({ components: [opt], flags: (1 << 6) });
}
},
},
@@ -423,5 +475,35 @@ module.exports = {
return interaction.update({ embeds: [successEmbed], components: [] });
}
},
EnableOrDisableAlarm: {
run: async(client, interaction, GuildDB) => {
if (!interaction.customId.endsWith(interaction.member.user.id)) {
return interaction.reply({
content: "This menu is not for you",
flags: (1 << 6)
})
}
let alarm = GuildDB.alarms.find(alarm => alarm.name == interaction.values[0]);
let alarmIndex = GuildDB.alarms.indexOf(alarm);
let disable = interaction.customId.split('-')[1] == 'disable' ? true : false;
alarm.disabled = disable;
GuildDB.alarms[alarmIndex] = alarm
client.dbo.collection('guilds').updateOne({ 'server.serverID': GuildDB.serverID }, {
$set: {
'server.alarms': GuildDB.alarms,
}
}, function (err, res) {
if (err) return client.sendInternalError(interaction, err);
});
let successEmbed = new EmbedBuilder()
.setColor(client.config.Colors.Green)
.setDescription(`**Success:** Successfully ${disable ? 'disabled' : 'enabled'} the Alarm **${interaction.values[0]}**`);
return interaction.update({ embeds: [successEmbed], components: [] });
}
}
}
}
+57
View File
@@ -0,0 +1,57 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "bounty",
debug: false,
global: false,
description: "Set or view bounties",
usage: "[cmd] [opt]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
options: [{
name: "set",
description: "Set a bounty on a player",
value: "set",
type: 1,
options: [{
name: "gamertag",
description: "Gamertag of player for bounty",
value: "gamertag",
type: 3,
required: true,
}, {
name: "value",
description: "Amount of the bounty",
value: "value",
type: 10,
min_value: 0.01,
required: true
}]
}, {
name: "view",
description: "View all active bounties",
value: "view",
type: 1,
}],
SlashCommand: {
/**
*
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (args[0].name == 'set') {
} else if (args[0].name == 'view') {
}
},
},
}
View File
Whitespace-only changes.
+107
View File
@@ -48,6 +48,61 @@ module.exports = {
},
]
},
{
name: "killfeed_channel",
description: "Set the Killfeed Channel",
value: "killfeed_channel",
type: 1,
options: [{
name: "channel",
description: "The channel to configure",
value: "channel",
type: 7,
channel_types: [0], // Restrict to text channel
required: true,
}]
},
{
name: "admin_logs_channel",
description: "Set the Admin Logs Channel",
value: "admin_logs_channel",
type: 1,
options: [{
name: "channel",
description: "The channel to configure",
value: "channel",
type: 7,
channel_types: [0], // Restrict to text channel
required: true,
}]
},
{
name: "welcome_channel",
description: "Set the channel for users to gain access",
value: "welcome_channel",
type: 1,
options: [{
name: "channel",
description: "The channel to configure",
value: "channel",
type: 7,
channel_types: [0], // Restrict to text channel
required: true,
}]
},
{
name: "linked_gt_role",
description: "Access Role to give to users",
value: "linked_gt_role",
type: 1,
options: [{
name: "role",
description: "Role to configure",
value: "role",
type: 8,
required: true,
}]
},
{
name: "bot_admin_role",
description: "Set/remove bot admin role",
@@ -288,6 +343,58 @@ module.exports = {
);
return interaction.send({ embeds: [settingsEmbed] });
} else if (args[0].name == 'killfeed_channel') {
const channel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.killfeedChannel": channel}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setDescription(`Successfully added <#${channel}> as the Killfeed Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'admin_logs_channel') {
const channel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.connectionLogsChannel": channel}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setDescription(`Successfully set <#${channel}> as the Admin Logs Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'welcome_channel') {
const channel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.welcomeChannel": channel}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setDescription(`Successfully set <#${channel}> as the Welcome Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'linked_gt_role') {
const role = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.linkedGamertagRole": role}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setDescription(`Successfully set <@&${role}> to give to users who link their gamertag.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
}
},
},
+6 -4
View File
@@ -21,11 +21,13 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }, start) => {
let alarmEmbed = new EmbedBuilder()
.setDescription('test des.')
.addFields({ name: 'Test Field', value: `[Test Data](https://www.izurvive.com/chernarusplussatmap/#location=11467.6;7452)`, inline: false })
if (client.config.Dev != 'DEV.') return interaction.send({ content: 'This command is not available to Production Version.' });
let embed = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setDescription(`**Welcome** <@${interaction.member.user.id}> to **DayZ Reforger**\nTo gain access please use the command </gamertag-link:1>`);
return interaction.send({ embeds: [alarmEmbed] });
interaction.send({ embeds: [embed] });
},
},
}
+54
View File
@@ -0,0 +1,54 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "gamertag-link",
debug: false,
global: false,
description: "Connect DayZ account to gain server access",
usage: "[cmd] [opt]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
options: [{
name: "gamertag",
description: "Gamertag of player for bounty",
value: "gamertag",
type: 3,
required: true,
}],
SlashCommand: {
/**
*
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
let playerStat = GuildDB.playerstats.find(stat => stat.player == args[0].value[0]);
if (playerStat == undefined) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription('**Not Found** This player cannot be found, the gamertag may be incorrect or this player has not logged onto the server before for at least ` 5 minutes `.')] });
playerStat.discordID = interaction.member.user.id;
let playerStatIndex = GuildDB.playerstats.indexOf(playerStat);
let playerstats = GuildDB.playerstats;
playerstats[playerStatIndex] = playerStatIndex;
client.dbo.collectin("guilds").updateOne({ 'server.serverID': GuildDB.serverID }, {
$set: {
'server.playerstats': playerstats,
}
})
const role = interaction.guild.roles.cache.get(GuildDB.linkedGamertagRole);
const member = interaction.guild.members.cache.get(interaction.member.user.id);
member.roles.add(role);
let connectedEmbed = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setDescription(``)
},
},
}
+19 -4
View File
@@ -37,9 +37,9 @@ module.exports = {
type: 1,
},
{
name: "version",
description: "Current version of the bot",
value: "version",
name: "stats",
description: "Current Bot Statistics",
value: "stats",
type: 1,
}
],
@@ -52,7 +52,7 @@ module.exports = {
* @param {*} param3
*/
run: async (client, interaction, args) => {
run: async (client, interaction, args, start) => {
if (args[0].name == 'version') {
const versionEmbed = new EmbedBuilder()
.setTitle(`Current DayzArmbands Version`)
@@ -137,6 +137,21 @@ module.exports = {
`);
return interaction.send({ embeds: [creditsEmbed] })
} else if (args[0].name == 'stats') {
const end = new Date().getTime();
const stats = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setTitle('QuarksBot Statistics')
.addFields(
{ name: 'Guilds', value: `${client.guilds.cache.size}`, inline: true },
{ name: 'Users', value: `${client.users.cache.size}`, inline: true },
{ name: 'Latency', value: `${end - start}ms`, inline: true },
{ name: 'Uptime', value: `${client.secondsToDhms(process.uptime().toFixed(2))}`, inline: true },
{ name: 'Bot Version', value: `${client.config.Dev} v${client.config.Version}`, inline: true },
{ name: 'Discord Version', value: 'Discord.js v14.3.0', inline: true },
)
return interaction.send({ embeds: [stats] })
}
},
},
View File
Whitespace-only changes.
+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = {
const end = new Date().getTime();
const stats = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setTitle('QuarksBot Statistics')
.setTitle('DayZ Reforger Bot Statistics')
.addFields(
{ name: 'Guilds', value: `${client.guilds.cache.size}`, inline: true },
{ name: 'Users', value: `${client.users.cache.size}`, inline: true },