map and move interaction handlers
This commit is contained in:
9 files changed
+621
-583
No files matched your search
+19
-2
@@ -46,7 +46,6 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param {require("../structures/QuarksBot")} client
|
* @param {require("../structures/QuarksBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
@@ -94,7 +93,7 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`311-delete`)
|
.setCustomId(`Delete311`)
|
||||||
.setLabel("Delete")
|
.setLabel("Delete")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
)
|
)
|
||||||
@@ -115,4 +114,22 @@ module.exports = {
|
|||||||
return interaction.send({ content: 'A report has been sent via 311.' });
|
return interaction.send({ content: 'A report has been sent via 311.' });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Interactions: {
|
||||||
|
|
||||||
|
Delete311: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.member._roles.includes(GuildDB.dispatcherRole)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully Deleted 311 Report.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+19
-1
@@ -94,7 +94,7 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`911-delete`)
|
.setCustomId(`Delete911`)
|
||||||
.setLabel("Delete")
|
.setLabel("Delete")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
)
|
)
|
||||||
@@ -115,4 +115,22 @@ module.exports = {
|
|||||||
return interaction.send({ content: '911 Alerted!' });
|
return interaction.send({ content: '911 Alerted!' });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Interactions: {
|
||||||
|
|
||||||
|
Delete911: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.member._roles.includes(GuildDB.dispatcherRole)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully Deleted 911 Call.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+15
-1
@@ -121,7 +121,7 @@ module.exports = {
|
|||||||
const userID = client.exists(interaction.user) ? interaction.user.id : interaction.member.user.id;
|
const userID = client.exists(interaction.user) ? interaction.user.id : interaction.member.user.id;
|
||||||
|
|
||||||
let settingsMenu = new SelectMenuBuilder()
|
let settingsMenu = new SelectMenuBuilder()
|
||||||
.setCustomId(`settingSelect-${userID}`)
|
.setCustomId(`SettingsHelp-${userID}`)
|
||||||
.setPlaceholder('Select Setting you require help with')
|
.setPlaceholder('Select Setting you require help with')
|
||||||
|
|
||||||
settings.settings.map((setting) => {
|
settings.settings.map((setting) => {
|
||||||
@@ -169,4 +169,18 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Interactions: {
|
||||||
|
|
||||||
|
SettingsHelp: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
const setting = settings.settings.find(setting => setting.name === interaction.values[0]);
|
||||||
|
const settingEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Default)
|
||||||
|
.setTitle(setting.name)
|
||||||
|
.setDescription(setting.description)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [settingEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
+178
-5
@@ -2,6 +2,7 @@ const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, SelectMenuBu
|
|||||||
const { Inventory, addInventory } = require('../structures/inventory');
|
const { Inventory, addInventory } = require('../structures/inventory');
|
||||||
|
|
||||||
const getActions = ['pick up', 'grab', 'get', 'aquire', 'obtain', 'gain', 'take possesssion of', 'retrieve'];
|
const getActions = ['pick up', 'grab', 'get', 'aquire', 'obtain', 'gain', 'take possesssion of', 'retrieve'];
|
||||||
|
const dropActions = ['ditch', 'drop', 'forget', 'throw out', 'leave', 'set down', 'let go of', 'discard'];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "inventory",
|
name: "inventory",
|
||||||
@@ -191,7 +192,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (args[0].name == 'view') {
|
if (args[0].name == 'view') {
|
||||||
let items = new SelectMenuBuilder()
|
let items = new SelectMenuBuilder()
|
||||||
.setCustomId(`inventorySelect-${interaction.member.user.id}`)
|
.setCustomId(`InventoryView-${interaction.member.user.id}`)
|
||||||
.setPlaceholder('Select Item to view')
|
.setPlaceholder('Select Item to view')
|
||||||
.addOptions(
|
.addOptions(
|
||||||
{
|
{
|
||||||
@@ -292,7 +293,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let items = new SelectMenuBuilder()
|
let items = new SelectMenuBuilder()
|
||||||
.setCustomId(`dropSelect-${interaction.member.user.id}`)
|
.setCustomId(`InventoryDrop-${interaction.member.user.id}`)
|
||||||
.setPlaceholder('Select item to drop')
|
.setPlaceholder('Select item to drop')
|
||||||
|
|
||||||
for (let i = 1; i < inventory.guilds[GuildDB.serverID].items.length; i++) {
|
for (let i = 1; i < inventory.guilds[GuildDB.serverID].items.length; i++) {
|
||||||
@@ -327,7 +328,7 @@ module.exports = {
|
|||||||
const targetUserID = args[0].options[0].value.replace('<@!', '').replace('>', '');
|
const targetUserID = args[0].options[0].value.replace('<@!', '').replace('>', '');
|
||||||
|
|
||||||
let items = new SelectMenuBuilder()
|
let items = new SelectMenuBuilder()
|
||||||
.setCustomId(`giveSelect-${targetUserID}-${interaction.member.user.id}`)
|
.setCustomId(`InventoryGive-${targetUserID}-${interaction.member.user.id}`)
|
||||||
.setPlaceholder('Select Item to give')
|
.setPlaceholder('Select Item to give')
|
||||||
|
|
||||||
for (let i = 1; i < inventory.guilds[GuildDB.serverID].items.length; i++) {
|
for (let i = 1; i < inventory.guilds[GuildDB.serverID].items.length; i++) {
|
||||||
@@ -359,11 +360,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`inventoryClear-yes-${interaction.member.user.id}`)
|
.setCustomId(`InventoryClear-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`inventoryClear-no-${interaction.member.user.id}`)
|
.setCustomId(`InventoryClear-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -373,4 +374,176 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Interactions: {
|
||||||
|
|
||||||
|
InventoryView: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
||||||
|
inventory = inventory.inventory;
|
||||||
|
|
||||||
|
if (interaction.values[0] == 'all') {
|
||||||
|
let inventoryEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Default)
|
||||||
|
.setTitle('Your Inventory')
|
||||||
|
|
||||||
|
let description = `To see detials on an Item use \`/inventory view\` and select the item to view\n\n\`\`\``
|
||||||
|
for (let i = 0; i < inventory.guilds[GuildDB.serverID].items.length; i++) {
|
||||||
|
if (inventory.guilds[GuildDB.serverID].items[i].type == 'firearm') description += `${i+1}. ${inventory.guilds[GuildDB.serverID].items[i].weaponType} - ${inventory.guilds[GuildDB.serverID].items[i].description}\n`;
|
||||||
|
else description += `${i+1}. ${inventory.guilds[GuildDB.serverID].items[i].name} - ${inventory.guilds[GuildDB.serverID].items[i].description}\n`
|
||||||
|
}
|
||||||
|
description += "```"
|
||||||
|
|
||||||
|
inventoryEmbed.setDescription(description);
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [inventoryEmbed], components: [], flags: (1 << 6) });
|
||||||
|
} else {
|
||||||
|
let item = inventory.guilds[GuildDB.serverID].items[interaction.values[0]];
|
||||||
|
let itemEmbed = new EmbedBuilder().setColor(client.config.Colors.Default);
|
||||||
|
if (item.type == 'wallet') {
|
||||||
|
// Display wallet
|
||||||
|
|
||||||
|
let ID = `${client.exists(item.ID.firstname) ? item.ID.firstname : '...'} ${client.exists(item.ID.lastname) ? item.ID.lastname : '...'} | ${client.exists(item.ID.dob) ? item.ID.dob : 'N/A'} | ${client.exists(item.ID.addr) ? item.ID.addr : 'N/A'}`
|
||||||
|
|
||||||
|
itemEmbed.setTitle(`Your Wallet`);
|
||||||
|
itemEmbed.addFields(
|
||||||
|
{ name: '**Cash**', value: `$${item.cash.toFixed(2)}`, inline: true },
|
||||||
|
{ name: '**ID**', value: ID, inline: true });
|
||||||
|
|
||||||
|
} else if (item.type == 'firearm') {
|
||||||
|
// Display firearm
|
||||||
|
|
||||||
|
itemEmbed.setTitle('Firearm');
|
||||||
|
itemEmbed.addFields(
|
||||||
|
{ name: 'Serial #', value: item.serial, inline: true },
|
||||||
|
{ name: 'Type', value: item.weaponType, inline: true },
|
||||||
|
{ name: 'Description', value: item.description, inline: true },
|
||||||
|
{ name: 'Owner', value: item.ownerName, inline: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Display generic item here
|
||||||
|
|
||||||
|
itemEmbed.setTitle(`Item information`);
|
||||||
|
itemEmbed.addFields({ name: item.name, value: item.description, inline: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [itemEmbed], components: [], flags: (1 << 6) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
InventoryDrop: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
||||||
|
inventory = inventory.inventory;
|
||||||
|
|
||||||
|
let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1];
|
||||||
|
|
||||||
|
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
|
||||||
|
let message = new EmbedBuilder()
|
||||||
|
.setTitle(`You ${dropActions[Math.floor(Math.random() * dropActions.length)]} your ${item.name}`)
|
||||||
|
.setColor(client.config.Colors.Default);
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [message], components: [] });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
InventoryGive: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
||||||
|
inventory = inventory.inventory;
|
||||||
|
|
||||||
|
let item = inventory.guilds[GuildDB.serverID].items[interaction.values[0]];
|
||||||
|
let targetUserID = interaction.customId.split('-')[1].replace('<@!', '').replace('>', '');
|
||||||
|
let targetUserInventory = await client.dbo.collection("inventories").findOne({"inventory.userID":targetUserID}).then(inventory => inventory);
|
||||||
|
|
||||||
|
if (!targetUserInventory) {
|
||||||
|
// Register inventory for user with item givn
|
||||||
|
let newInventory = new Inventory();
|
||||||
|
newInventory.createInventory(targetUserID, GuildDB.serverID);
|
||||||
|
newInventory.addItem(item);
|
||||||
|
newInventory.save().catch(err => {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
targetUserInventory = targetUserIventory.inventory;
|
||||||
|
if (!client.exists(targetUserInventory.guilds[GuildDB.serverID])) {
|
||||||
|
const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client);
|
||||||
|
if (!success) {
|
||||||
|
client.error(err);
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||||
|
.setColor(client.config.Colors.Red)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [embed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let successEmbed = new EmbedBuilder()
|
||||||
|
.setTitle('Success')
|
||||||
|
.setDescription(`Successfully gave <@${targetUserID}> ${item.name}`)
|
||||||
|
.setColor(client.config.Colors.Green);
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
InventoryClear: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
const queryString = interaction.customId;
|
||||||
|
if (!queryString.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = ''
|
||||||
|
if (queryString==`inventoryClear-yes-${interaction.member.user.id}`) {
|
||||||
|
action = 'cleared';
|
||||||
|
const tempWallet = inventory.guilds[GuildDB.serverID].items[0];
|
||||||
|
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id},{$set:{[`inventory.guilds.${GuildDB.serverID}.items`]: [tempWallet]}},function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (queryString==`inventoryClear-no-${interaction.member.user.id}`) action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} your inventory.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+69
-2
@@ -45,11 +45,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`reset-yes-${targetUserID}-${interaction.member.user.id}`)
|
.setCustomId(`Reset-yes-${targetUserID}-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`reset-no-${targetUserID}-${interaction.member.user.id}`)
|
.setCustomId(`Reset-no-${targetUserID}-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -58,4 +58,71 @@ module.exports = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Interactions: {
|
||||||
|
|
||||||
|
Reset: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
const choice = interaction.customId.split('-')[1];
|
||||||
|
const targetUserID = interaction.customId.split('-')[2];
|
||||||
|
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (choice=='yes') {
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle('Successfully reset user\'s data')
|
||||||
|
|
||||||
|
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
||||||
|
let banking = await client.dbo.collection("banks").findOne({"banking.userID": interaction.member.user.id}).then(banking => banking);
|
||||||
|
|
||||||
|
let inventoryReset = false;
|
||||||
|
let bankingReset = false;
|
||||||
|
if (!inventory) inventoryReset = true
|
||||||
|
else inventory = inventory.inventory
|
||||||
|
if (!banking) bankingReset = true
|
||||||
|
else banking = banking.banking
|
||||||
|
|
||||||
|
if (inventoryReset && bankingReset) return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
|
||||||
|
if (!inventoryReset) {
|
||||||
|
const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client);
|
||||||
|
if (!success) {
|
||||||
|
client.error(err);
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||||
|
.setColor(client.config.Colors.Red)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [embed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bankingReset) {
|
||||||
|
const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client);
|
||||||
|
if (!success) {
|
||||||
|
client.error(err);
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||||
|
.setColor(client.config.Colors.Red)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [embed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
|
||||||
|
} else if (choice=='no') {
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`The User was not reset`);
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+304
-22
@@ -418,11 +418,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`allowedChannels-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveAllowedChannels-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`allowedChannels-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveAllowedChannels-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -458,11 +458,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`actionChannel-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveActionChannel-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`actionChannel-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveActionChannel-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -497,11 +497,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveTweetChannel-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveTweetChannel-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -536,11 +536,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`advertsChannel-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveAdvertsChannel-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`advertsChannel-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveAdvertsChannel-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -576,11 +576,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`dispatchChannel-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveDispatcherChannel-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`dispatchChannel-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveDispatcherChannel-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -658,11 +658,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`incomeRole-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveIncomeRole-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`incomeRole-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveIncomeRole-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -693,11 +693,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`commercialRole-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveCommercialRole-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`commercialRole-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveCommercialRole-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -728,11 +728,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`officerRole-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveOfficerRole-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`officerRole-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveOfficerRole-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -763,11 +763,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`dispatchRole-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveDispatcherRole-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`dispatchRole-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveDispatcherRole-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -799,11 +799,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`botAdmin-yes-${interaction.member.user.id}`)
|
.setCustomId(`RemoveBotAdminRole-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`botAdmin-no-${interaction.member.user.id}`)
|
.setCustomId(`RemoveBotAdminRole-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -844,11 +844,11 @@ module.exports = {
|
|||||||
const opt = new ActionRowBuilder()
|
const opt = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`settingsReset-yes-${interaction.member.user.id}`)
|
.setCustomId(`ResetSettings-yes-${interaction.member.user.id}`)
|
||||||
.setLabel("Yes")
|
.setLabel("Yes")
|
||||||
.setStyle(ButtonStyle.Danger),
|
.setStyle(ButtonStyle.Danger),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`settingsReset-no-${interaction.member.user.id}`)
|
.setCustomId(`ResetSettings-no-${interaction.member.user.id}`)
|
||||||
.setLabel("No")
|
.setLabel("No")
|
||||||
.setStyle(ButtonStyle.Success)
|
.setStyle(ButtonStyle.Success)
|
||||||
)
|
)
|
||||||
@@ -902,4 +902,286 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Interactions: {
|
||||||
|
|
||||||
|
RemoveAllowedChannels: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!queryString.endsWith(interaction.member.user.id)) {
|
||||||
|
return ButtonInteraction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = ''
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, function (err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Success: You ${action} the channel.`)
|
||||||
|
|
||||||
|
return interactino.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveActionChannel: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!queryString.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = ''
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.actionChannel": null}},function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (queryString==`no-${interaction.member.user.id}`) action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Success: You ${action} the channel.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveTweetChannel: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = ''
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.tweetChannel": null}},function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Success: You ${action} the channel.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveAdvertsChannel: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.advertsChannel": null}},function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Success: You ${action} the channel.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveDispatcherChannel: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatchChannel": null}},function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Success: You ${action} the channel.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveIncomeRole: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": roleId}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} <@&${roleId}> from income roles.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveCommercialRole: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.commercialRole": null}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} <@&${roleId}> as commercial role.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveOfficerRole: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='no') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.officerRole": null}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} <@&${roleId}> as officer role.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveDispatcherRole: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.dispatcherRole": null}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} <@&${roleId}> as dispatcher role.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
RemoveBotAdminRole: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return ButtonInteraction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.botAdmin": null}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} <@&${roleId}> as the bot admin role.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
ResetSettings: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return ButtonInteraction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'reset';
|
||||||
|
const defaultGuildConfig = {
|
||||||
|
serverID: GuildDB.serverID,
|
||||||
|
allowedChannels: [],
|
||||||
|
actionChannel: null,
|
||||||
|
tweetChannel: null,
|
||||||
|
advertsChannel: null,
|
||||||
|
dispatchChannel: null,
|
||||||
|
startingBalance: 1000.00,
|
||||||
|
incomeRoles: [],
|
||||||
|
botAdmin: null,
|
||||||
|
commercialRole: null,
|
||||||
|
officerRole: null,
|
||||||
|
dispatcherRole: null,
|
||||||
|
onlyOfficersSearch: false,
|
||||||
|
}
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setTitle(`Successfully ${action} guild configurations.`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@ require('dotenv').config();
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Dev: "PROD.",
|
Dev: "PROD.",
|
||||||
Version: "12.7.14",
|
Version: "12.7.15",
|
||||||
Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot
|
Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot
|
||||||
DefaultPrefix: "?",
|
DefaultPrefix: "?",
|
||||||
ServerID: "955668596745461830",
|
ServerID: "955668596745461830",
|
||||||
|
|||||||
+7
-540
@@ -1,7 +1,4 @@
|
|||||||
const { EmbedBuilder } = require("discord.js");
|
const { EmbedBuilder } = require("discord.js");
|
||||||
const settings = require('../config/settingsHelp');
|
|
||||||
|
|
||||||
const dropActions = ['ditch', 'drop', 'forget', 'throw out', 'leave', 'set down', 'let go of', 'discard'];
|
|
||||||
|
|
||||||
module.exports = async (client, interaction) => {
|
module.exports = async (client, interaction) => {
|
||||||
if (interaction.isCommand()) return;
|
if (interaction.isCommand()) return;
|
||||||
@@ -10,543 +7,13 @@ module.exports = async (client, interaction) => {
|
|||||||
from any command
|
from any command
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const GuildDB = await client.GetGuild(interaction.guildId);
|
let GuildDB = await client.GetGuild(interaction.guild_id);
|
||||||
|
const interactionName = interaction.customId.split("-")[0];
|
||||||
|
let interactionHandler = client.interactionHandlers.get(interactionName);
|
||||||
|
|
||||||
// Handler for '/311'
|
try {
|
||||||
if (interaction.customId.startsWith('911')) {
|
interactionHandler.run(client, interaction, { GuildDB });
|
||||||
if (!interaction.member._roles.includes(GuildDB.dispatcherRole)) {
|
} catch (err) {
|
||||||
return interaction.reply({
|
client.sendInternalError(err);
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully Deleted 311 Report.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/911'
|
|
||||||
if (interaction.customId.startsWith('911')) {
|
|
||||||
if (!interaction.member._roles.includes(GuildDB.dispatcherRole)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully Deleted 911 Call.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/help settings'
|
|
||||||
if (interaction.customId.startsWith('settingSelect')) {
|
|
||||||
const setting = settings.settings.find(setting => setting.name === interaction.values[0]);
|
|
||||||
const settingEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Default)
|
|
||||||
.setTitle(setting.name)
|
|
||||||
.setDescription(setting.description)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [settingEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/inventory view'
|
|
||||||
if (interaction.customId.startsWith('inventorySelect')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
|
||||||
inventory = inventory.inventory;
|
|
||||||
|
|
||||||
if (interaction.values[0] == 'all') {
|
|
||||||
let inventoryEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Default)
|
|
||||||
.setTitle('Your Inventory')
|
|
||||||
|
|
||||||
let description = `To see detials on an Item use \`/inventory view\` and select the item to view\n\n\`\`\``
|
|
||||||
for (let i = 0; i < inventory.guilds[GuildDB.serverID].items.length; i++) {
|
|
||||||
if (inventory.guilds[GuildDB.serverID].items[i].type == 'firearm') description += `${i+1}. ${inventory.guilds[GuildDB.serverID].items[i].weaponType} - ${inventory.guilds[GuildDB.serverID].items[i].description}\n`;
|
|
||||||
else description += `${i+1}. ${inventory.guilds[GuildDB.serverID].items[i].name} - ${inventory.guilds[GuildDB.serverID].items[i].description}\n`
|
|
||||||
}
|
|
||||||
description += "```"
|
|
||||||
|
|
||||||
inventoryEmbed.setDescription(description);
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [inventoryEmbed], components: [], flags: (1 << 6) });
|
|
||||||
} else {
|
|
||||||
let item = inventory.guilds[GuildDB.serverID].items[interaction.values[0]];
|
|
||||||
let itemEmbed = new EmbedBuilder().setColor(client.config.Colors.Default);
|
|
||||||
if (item.type == 'wallet') {
|
|
||||||
// Display wallet
|
|
||||||
|
|
||||||
let ID = `${client.exists(item.ID.firstname) ? item.ID.firstname : '...'} ${client.exists(item.ID.lastname) ? item.ID.lastname : '...'} | ${client.exists(item.ID.dob) ? item.ID.dob : 'N/A'} | ${client.exists(item.ID.addr) ? item.ID.addr : 'N/A'}`
|
|
||||||
|
|
||||||
itemEmbed.setTitle(`Your Wallet`);
|
|
||||||
itemEmbed.addFields(
|
|
||||||
{ name: '**Cash**', value: `$${item.cash.toFixed(2)}`, inline: true },
|
|
||||||
{ name: '**ID**', value: ID, inline: true });
|
|
||||||
|
|
||||||
} else if (item.type == 'firearm') {
|
|
||||||
// Display firearm
|
|
||||||
|
|
||||||
itemEmbed.setTitle('Firearm');
|
|
||||||
itemEmbed.addFields(
|
|
||||||
{ name: 'Serial #', value: item.serial, inline: true },
|
|
||||||
{ name: 'Type', value: item.weaponType, inline: true },
|
|
||||||
{ name: 'Description', value: item.description, inline: true },
|
|
||||||
{ name: 'Owner', value: item.ownerName, inline: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Display generic item here
|
|
||||||
|
|
||||||
itemEmbed.setTitle(`Item information`);
|
|
||||||
itemEmbed.addFields({ name: item.name, value: item.description, inline: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [itemEmbed], components: [], flags: (1 << 6) });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/invenvotry drop'
|
|
||||||
if (interaction.customId.startsWith('dropSelect')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
|
||||||
inventory = inventory.inventory;
|
|
||||||
|
|
||||||
let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1];
|
|
||||||
|
|
||||||
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
|
|
||||||
let message = new EmbedBuilder()
|
|
||||||
.setTitle(`You ${dropActions[Math.floor(Math.random() * dropActions.length)]} your ${item.name}`)
|
|
||||||
.setColor(client.config.Colors.Default);
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [message], components: [] });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/inventory give'
|
|
||||||
if (interaction.customId.startsWith('giveSelect')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
|
||||||
inventory = inventory.inventory;
|
|
||||||
|
|
||||||
let item = inventory.guilds[GuildDB.serverID].items[interaction.values[0]];
|
|
||||||
let targetUserID = interaction.customId.split('-')[1].replace('<@!', '').replace('>', '');
|
|
||||||
let targetUserInventory = await client.dbo.collection("inventories").findOne({"inventory.userID":targetUserID}).then(inventory => inventory);
|
|
||||||
|
|
||||||
if (!targetUserInventory) {
|
|
||||||
// Register inventory for user with item givn
|
|
||||||
let newInventory = new Inventory();
|
|
||||||
newInventory.createInventory(targetUserID, GuildDB.serverID);
|
|
||||||
newInventory.addItem(item);
|
|
||||||
newInventory.save().catch(err => {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
targetUserInventory = targetUserIventory.inventory;
|
|
||||||
if (!client.exists(targetUserInventory.guilds[GuildDB.serverID])) {
|
|
||||||
const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client);
|
|
||||||
if (!success) {
|
|
||||||
client.error(err);
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
|
||||||
.setColor(client.config.Colors.Red)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [embed], components: [] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let successEmbed = new EmbedBuilder()
|
|
||||||
.setTitle('Success')
|
|
||||||
.setDescription(`Successfully gave <@${targetUserID}> ${item.name}`)
|
|
||||||
.setColor(client.config.Colors.Green);
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/inventory clear'
|
|
||||||
if (interaction.customId.startsWith('inventoryClear')) {
|
|
||||||
const queryString = interaction.customId;
|
|
||||||
if (!queryString.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = ''
|
|
||||||
if (queryString==`inventoryClear-yes-${interaction.member.user.id}`) {
|
|
||||||
action = 'cleared';
|
|
||||||
const tempWallet = inventory.guilds[GuildDB.serverID].items[0];
|
|
||||||
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id},{$set:{[`inventory.guilds.${GuildDB.serverID}.items`]: [tempWallet]}},function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (queryString==`inventoryClear-no-${interaction.member.user.id}`) action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} your inventory.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/reset'
|
|
||||||
if (interaction.customId.startsWith('reset')) {
|
|
||||||
const choice = interaction.customId.split('-')[1];
|
|
||||||
const targetUserID = interaction.customId.split('-')[2];
|
|
||||||
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (choice=='yes') {
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle('Successfully reset user\'s data')
|
|
||||||
|
|
||||||
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
|
|
||||||
let banking = await client.dbo.collection("banks").findOne({"banking.userID": interaction.member.user.id}).then(banking => banking);
|
|
||||||
|
|
||||||
let inventoryReset = false;
|
|
||||||
let bankingReset = false;
|
|
||||||
if (!inventory) inventoryReset = true
|
|
||||||
else inventory = inventory.inventory
|
|
||||||
if (!banking) bankingReset = true
|
|
||||||
else banking = banking.banking
|
|
||||||
|
|
||||||
if (inventoryReset && bankingReset) return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
|
|
||||||
if (!inventoryReset) {
|
|
||||||
const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client);
|
|
||||||
if (!success) {
|
|
||||||
client.error(err);
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
|
||||||
.setColor(client.config.Colors.Red)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [embed], components: [] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bankingReset) {
|
|
||||||
const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client);
|
|
||||||
if (!success) {
|
|
||||||
client.error(err);
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
|
||||||
.setColor(client.config.Colors.Red)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [embed], components: [] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
|
|
||||||
} else if (choice=='no') {
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`The User was not reset`);
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings allowed_channels remove'
|
|
||||||
if (interaction.customId.startsWith('allowedChannels')) {
|
|
||||||
if (!queryString.endsWith(interaction.member.user.id)) {
|
|
||||||
return ButtonInteraction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = ''
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, function (err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Success: You ${action} the channel.`)
|
|
||||||
|
|
||||||
return interactino.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings action_channel remove'
|
|
||||||
if (interaction.customId.startsWith('actionChannel')) {
|
|
||||||
if (!queryString.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = ''
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.actionChannel": null}},function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (queryString==`no-${interaction.member.user.id}`) action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Success: You ${action} the channel.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings tweet_channel remove'
|
|
||||||
if (interaction.customId.startsWith('tweetChannel')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = ''
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.tweetChannel": null}},function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Success: You ${action} the channel.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings adverts_channel remove'
|
|
||||||
if (interaction.customId.startsWith('advertsChannel')) {
|
|
||||||
if (!interaction.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.advertsChannel": null}},function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Success: You ${action} the channel.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings dispatcher_channel remove'
|
|
||||||
if(interaction.customId.startsWith('dispatchChannel')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatchChannel": null}},function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Success: You ${action} the channel.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings income_role remove'
|
|
||||||
if (interaction.customId.startsWith('incomeRole')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": roleId}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} <@&${roleId}> from income roles.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings commercial_role remove'
|
|
||||||
if (interaction.customId.startsWith('commercialRole')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.commercialRole": null}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} <@&${roleId}> as commercial role.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings officer_role remove'
|
|
||||||
if (interaction.customId.startsWith('officerRole')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='no') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.officerRole": null}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} <@&${roleId}> as officer role.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings dispatcher_role remove'
|
|
||||||
if (interaction.customId.startsWith('dispatchRole')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.dispatcherRole": null}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} <@&${roleId}> as dispatcher role.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings bot_admin_role remove'
|
|
||||||
if (interaction.customId.startsWith('botAdmin')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return ButtonInteraction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'removed';
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.botAdmin": null}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} <@&${roleId}> as dispatcher role.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler for '/settings reset'
|
|
||||||
if (interaction.customId.startsWith('settingsReset')) {
|
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
|
||||||
return ButtonInteraction.reply({
|
|
||||||
content: "This button is not for you",
|
|
||||||
flags: (1 << 6)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let action = '';
|
|
||||||
if (interaction.customId.split('-')[1]=='yes') {
|
|
||||||
action = 'reset';
|
|
||||||
const defaultGuildConfig = {
|
|
||||||
serverID: GuildDB.serverID,
|
|
||||||
allowedChannels: [],
|
|
||||||
actionChannel: null,
|
|
||||||
tweetChannel: null,
|
|
||||||
advertsChannel: null,
|
|
||||||
dispatchChannel: null,
|
|
||||||
startingBalance: 1000.00,
|
|
||||||
incomeRoles: [],
|
|
||||||
botAdmin: null,
|
|
||||||
commercialRole: null,
|
|
||||||
officerRole: null,
|
|
||||||
dispatcherRole: null,
|
|
||||||
onlyOfficersSearch: false,
|
|
||||||
}
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) {
|
|
||||||
if (err) return client.sendInternalError(err);
|
|
||||||
});
|
|
||||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
|
||||||
|
|
||||||
const successEmbed = new EmbedBuilder()
|
|
||||||
.setColor(client.config.Colors.Green)
|
|
||||||
.setTitle(`Successfully ${action} guild configurations.`)
|
|
||||||
|
|
||||||
return interaction.update({ embeds: [successEmbed], components: [] });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@ const mongoose = require('mongoose');
|
|||||||
const Logger = require("../util/Logger");
|
const Logger = require("../util/Logger");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { exit } = require("process");
|
|
||||||
|
|
||||||
class QuarksBot extends Client {
|
class QuarksBot extends Client {
|
||||||
|
|
||||||
@@ -15,6 +14,7 @@ class QuarksBot extends Client {
|
|||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.commands = new Collection();
|
this.commands = new Collection();
|
||||||
|
this.interactionHandlers = new Collection();
|
||||||
this.logger = new Logger(path.join(__dirname, "..", "logs/Logs.log"));
|
this.logger = new Logger(path.join(__dirname, "..", "logs/Logs.log"));
|
||||||
|
|
||||||
if (this.config.Token === "")
|
if (this.config.Token === "")
|
||||||
@@ -25,7 +25,7 @@ class QuarksBot extends Client {
|
|||||||
this.db;
|
this.db;
|
||||||
this.dbo;
|
this.dbo;
|
||||||
this.connectMongo(this.config.mongoURI, this.config.dbo);
|
this.connectMongo(this.config.mongoURI, this.config.dbo);
|
||||||
this.LoadCommands();
|
this.LoadCommandsAndInteractionHandlers();
|
||||||
this.LoadEvents();
|
this.LoadEvents();
|
||||||
|
|
||||||
this.Ready = false;
|
this.Ready = false;
|
||||||
@@ -56,12 +56,7 @@ class QuarksBot extends Client {
|
|||||||
try {
|
try {
|
||||||
cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start); // start is only used in ping / stats command
|
cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start); // start is only used in ping / stats command
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
client.error(err)
|
this.sendInternalError(err);
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
|
||||||
.setColor(client.config.Colors.Red)
|
|
||||||
|
|
||||||
return interaction.send({ embeds: [embed] });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -98,7 +93,7 @@ class QuarksBot extends Client {
|
|||||||
return dDisplay + hDisplay + mDisplay + sDisplay;
|
return dDisplay + hDisplay + mDisplay + sDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadCommands() {
|
LoadCommandsAndInteractionHandlers() {
|
||||||
let CommandsDir = path.join(__dirname, '..', 'commands');
|
let CommandsDir = path.join(__dirname, '..', 'commands');
|
||||||
fs.readdir(CommandsDir, (err, files) => {
|
fs.readdir(CommandsDir, (err, files) => {
|
||||||
if (err) this.error(err);
|
if (err) this.error(err);
|
||||||
@@ -112,6 +107,11 @@ class QuarksBot extends Client {
|
|||||||
", Reason: File doesn't had name/desciption"
|
", Reason: File doesn't had name/desciption"
|
||||||
);
|
);
|
||||||
this.commands.set(file.split(".")[0].toLowerCase(), cmd);
|
this.commands.set(file.split(".")[0].toLowerCase(), cmd);
|
||||||
|
if (this.exists(cmd.Interactions)) {
|
||||||
|
for (let [interaction, handler] of Object.entries(cmd.Interactions)) {
|
||||||
|
this.interactionHandlers.set(interaction, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.log("Command Loaded: " + file.split(".")[0]);
|
this.log("Command Loaded: " + file.split(".")[0]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user