fix deprecation issues

This commit is contained in:
SowinskiBraeden committed 2022-09-30 10:52:40 -07:00
1 parent 4b0d89899a
commit a1cc29c43c
31 files changed
+582 -1929

No files matched your search

+3 -3
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "account",
@@ -19,14 +19,14 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (user==null) return interaction.send(`You are not logged in.`);
client.users.fetch(interaction.member.user.id)
.then(duser => duser.send(`<@${interaction.member.user.id}> Logged in as **${user.user.username}** | **${user.user.email}**`).catch(err => {client.log(err)}))
.catch(err => {client.log(err)});
return interaction.send('Your account details have been sent in your dm.');
return interaction.send({ content: 'Your account details have been sent in your dm.' });
},
},
}
+4 -4
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "channels",
@@ -19,12 +19,12 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (guild.server.hasCustomChannels==false) {
return interaction.send('There are no channels set for the bot.');
return interaction.send({ content: 'There are no channels set for the bot.' });
}
let channels = ``;
@@ -32,7 +32,7 @@ module.exports = {
if (client.exists(guild.server.allowedChannels[i])) continue;
else channels += `\n<#${guild.server.allowedChannels[i]}>`;
}
let channelsEmbed = new MessageEmbed()
let channelsEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setDescription('**Allowed Channels to use the Bot**')
.addFields(
+9 -9
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "checkstatus",
@@ -27,27 +27,27 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (user.user.activeCommunity == null) return interaction.send(`You must join a community to use this command.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
if (user.user.activeCommunity == null) return interaction.send({ content: `You must join a community to use this command.` });
if (!client.exists(args)) {
return interaction.send(`<@${interaction.member.user.id}>'s status: \`${user.user.dispatchStatus}\` | Set by: \`${user.user.dispatchStatusSetBy}\``);
return interaction.send({ content: `<@${interaction.member.user.id}>'s status: \`${user.user.dispatchStatus}\` | Set by: \`${user.user.dispatchStatusSetBy}\`` });
} else {
let targetUserID = args[0].value.replace('<@!', '').replace('>', '');
let targetUser = await client.dbo.collection("users").findOne({"user.discord.id":targetUserID}).then(user => user);
// This lame line of code to get username without ping on discord
const User = client.users.cache.get(targetUserID);
if (!targetUser) return interaction.send(`Cannot find **${args[0].value}** <@${interaction.member.user.id}>`);
if (!targetUser) return interaction.send({ content: `Cannot find **${args[0].value}** <@${interaction.member.user.id}>` });
if (targetUser.user.activeCommunity!=user.user.activeCommunity) {
return interaction.send(`You are not in the same community as \`${User.tag}\` <@${interaction.member.user.id}>`);
return interaction.send({ content: `You are not in the same community as \`${User.tag}\` <@${interaction.member.user.id}>` });
}
return interaction.send(`<@${interaction.member.user.id}>, \`${User.tag}'s\` status: \`${targetUser.user.dispatchStatus}\` | Set by: \`${targetUser.user.dispatchStatusSetBy}\``);
return interaction.send({ content: `<@${interaction.member.user.id}>, \`${User.tag}'s\` status: \`${targetUser.user.dispatchStatus}\` | Set by: \`${targetUser.user.dispatchStatusSetBy}\`` });
}
},
},
+6 -6
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const ObjectId = require('mongodb').ObjectId;
module.exports = {
@@ -20,15 +20,15 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (user.user.activeCommunity==null) return interaction.send(`You are not in a community.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
if (user.user.activeCommunity==null) return interaction.send({ content: `You are not in a community.` });
let community = await client.dbo.collection("communities").findOne({_id:ObjectId(user.user.activeCommunity)}).then(community => community);
if (!community) return interaction.send(`Community not found.`);
return interaction.send(`You are in the community \`${community.community.name}\``);
if (!community) return interaction.send({ content: `Community not found.` });
return interaction.send({ content: `You are in the community \`${community.community.name}\`` });
},
},
}
+3 -3
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "connect_account",
@@ -19,9 +19,9 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
return interaction.send('Login from Lines Police CAD account management https://www.linespolice-cad.com/');
return interaction.send({ content: 'Login from Lines Police CAD `account_management` https://www.linespolice-cad.com/' });
},
},
}
+9 -9
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -37,8 +37,8 @@ module.exports = {
run: async (client, interaction, args, { GuildDB }) => {
if (!client.config.Admins.includes(interaction.member.user.id)) return;
if (args.length==0) return message.channel.send('Debug Error: Provide a debug command');
if (!client.exists(args[0].value)) return interaction.send('Debug Error: Provide a valid debug command');
if (args.length==0) return message.channel.send({ content: 'Debug Error: Provide a debug command' });
if (!client.exists(args[0].value)) return interaction.send({ content: 'Debug Error: Provide a valid debug command' });
let debugConsole = args[1].value;
@@ -46,33 +46,33 @@ module.exports = {
if (command == 'server' || args[0] == 'guild') {
if (debugConsole) client.log("Debug: Guild >> ");console.debug(GuildDB);
return interaction.send("Debug: guild >> read log output")
return interaction.send({ content: "Debug: guild >> read log output" })
} else if (command == "interaction") {
if (debugConsole) {
client.log("Debug: interaction >> ");
console.debug(interaction);
}
return interaction.send("Debug: interaction >> read log output");
return interaction.send({ content: "Debug: interaction >> read log output" });
} else if (command == "message") {
return interaction.send(`Use command with prefix to debug \`message\``);
return interaction.send({ content: `Use command with prefix to debug \`message\`` });
} else if (command == "pingserver") {
const socket = io.connect(client.config.socket);
socket.emit('botping', {message:'hello there'});
socket.on('botpong', (data) => {
if (debugConsole) client.log('Debug: Socket responded')
return interaction.send(`Debug: Socket responded`)
return interaction.send({ content: `Debug: Socket responded` })
socket.disconnect();
});
} else if (command == "apicheck") {
// TODO: Make axios call to api and get api health
return interaction.send('Debug Notice: \`apicheck\` is currently unavailable');
return interaction.send({ content: 'Debug Notice: \`apicheck\` is currently unavailable' });
} else {
return interaction.send('Debug Error: Provide a valid debug command');
return interaction.send({ content: 'Debug Error: Provide a valid debug command' });
}
},
+4 -4
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "disconnect_account",
@@ -19,13 +19,13 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You cannot logout if your not logged in.`);
if (!user) return interaction.send({ content: `You cannot logout if your not logged in.` });
client.dbo.collection("users").updateOne({"user.discord.id":interaction.member.user.id},{$unset:{"user.discord":""}, $set:{"user.discordConnected":false}},function(err,res) {
if (err) throw err;
return interaction.send(`Succesfully disconnected you Discord account.`);
return interaction.send({ content: `Succesfully disconnected you Discord account.` });
});
},
},
+7 -7
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -28,14 +28,14 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
let data = {
user: user,
query: {
@@ -48,11 +48,11 @@ module.exports = {
socket.on('bot_firearm_search_results', results => {
if (results.user._id==user._id) {
if (results.firearms.length==0) {
return interaction.send(`No Firearms found <@${interaction.member.user.id}>`);
return interaction.send({ content: `No Firearms found <@${interaction.member.user.id}>` });
}
for (let i = 0; i < results.firearms.length; i++) {
let firearmResult = new MessageEmbed()
let firearmResult = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(`**${results.firearms[i].firearm.serialNumber} | ${results.firearms[i]._id}**`)
.setURL('https://discord.gg/jgUW656v2t')
@@ -67,7 +67,7 @@ module.exports = {
let isStolen = results.firearms[i].firearm.isStolen;
if (isStolen=="false"||isStolen==false) firearmResult.addFields({name:`**Stolen**`,value:'\`No\`',inline: true});
if (isStolen=="true"||isStolen==true) firearmResult.addFields({name:`**Stolen**`,value:'\`Yes\`',inline: true});
interaction.send(firearmResult);
interaction.send({ embeds: [firearmResult] });
}
}
socket.disconnect();
+5 -5
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "help",
@@ -28,7 +28,7 @@ module.exports = {
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let Commands = client.commands.filter((cmd) => {
if (client.exists(cmd.debug)) return !cmd.debug
@@ -37,7 +37,7 @@ module.exports = {
`\`/${cmd.name}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}`
);
let Embed = new MessageEmbed()
let Embed = new EmbedBuilder()
.setColor(client.config.EmbedColor)
.setDescription(`${Commands.join("\n")}
@@ -55,7 +55,7 @@ module.exports = {
`❌ | Unable to find that command.`
);
let embed = new MessageEmbed()
let embed = new EmbedBuilder()
.setAuthor(`Command: ${cmd.name}`, client.config.IconURL)
.setDescription(cmd.description)
.setColor("GREEN")
@@ -73,7 +73,7 @@ module.exports = {
true
)
return interaction.send(embed);
return interaction.send({ embeds: [embed] });
}
},
},
+5 -5
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -28,11 +28,11 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
let myReq = {
userID: user._id,
communityCode: args[0].value
@@ -42,9 +42,9 @@ module.exports = {
socket.on('bot_joined_community', (data) => {
socket.disconnect()
if (data.error) {
return interaction.send(`${data.error}`);
return interaction.send({ content: `${data.error}` });
}
return interaction.send(`Successfully joined the community \` ${data.commName} \``)
return interaction.send({ content: `Successfully joined the community \` ${data.commName} \`` })
});
},
},
+5 -5
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -20,11 +20,11 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
let myReq = {
userID: user._id
};
@@ -33,9 +33,9 @@ module.exports = {
socket.on('bot_left_community', (data) => {
socket.disconnect()
if (data.error) {
return interaction.send(`${data.error}`);
return interaction.send({ content: `${data.error}` });
}
return interaction.send(`${data.message}`);
return interaction.send({ content: `${data.message}` });
});
},
},
+6 -6
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -42,14 +42,14 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
let data;
data = {
@@ -82,7 +82,7 @@ module.exports = {
if (firearmLicence == undefined || firearmLicence == null) firearmLicence = 'None';
if (firearmLicence == '2') firearmLicence = 'Valid';
if (firearmLicence == '3') firearmLicence = 'Revoked';
let nameResult = new MessageEmbed()
let nameResult = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(`**${results.civilians[i].civilian.firstName} ${results.civilians[i].civilian.lastName} | ${results.civilians[i]._id}**`)
.setURL('https://discord.gg/jgUW656v2t')
@@ -125,7 +125,7 @@ module.exports = {
if (hairColor!=null&&hairColor!=undefined&&hairColor!='') nameResult.addFields({name:'**Hair Color**',value:`\`${hairColor}\``,inline:true});
nameResult.addFields({name:'**Organ Donor**',value:`\`${results.civilians[i].civilian.organDonor}\``,inline:true});
nameResult.addFields({name:'**Veteran**',value:`\`${results.civilians[i].civilian.veteran}\``,inline:true});
interaction.send(nameResult);
interaction.send({ embeds: [nameResult] });
}
}
socket.disconnect();
+8 -8
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -19,15 +19,15 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (user.user.activeCommunity==null) return interaction.send(`You must join a community to use this command.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
if (user.user.activeCommunity==null) return interaction.send({ content: `You must join a community to use this command.` });
const socket = io.connect(client.config.socket);
// If panic is enabled, disable panic
if (user.user.dispatchStatus=='Panic') {
@@ -53,8 +53,8 @@ module.exports = {
// If panic is disabled, enable panic
} else {
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (user.user.activeCommunity==null) return interaction.send(`You must join a community to use this command.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
if (user.user.activeCommunity==null) return interaction.send({ content: `You must join a community to use this command.` });
client.forceUpdateStatus('Panic', user);
let req = {
@@ -65,7 +65,7 @@ module.exports = {
socket.emit('panic_button_update', req);
socket.disconnect();
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":GuildDB.serverID}).then(guild => guild);
if (guild.server.pingOnPanic) return interaction.send(`Attention <@&${guild.server.pingRole}>! \`${user.user.username}\` has activated panic`);
if (guild.server.pingOnPanic) return interaction.send({ content: `Attention <@&${guild.server.pingRole}>! \`${user.user.username}\` has activated panic` });
return;
}
},
+3 -3
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "ping",
@@ -19,9 +19,9 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
interaction.send('Pong!');
interaction.send({ content: 'Pong!' });
},
},
}
+3 -3
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "pingonpanic",
@@ -19,11 +19,11 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
return interaction.send(`Current Ping on Panic Status: \` ${guild.server.pingOnPanic} \``);
return interaction.send({ content: `Current Ping on Panic Status: \` ${guild.server.pingOnPanic} \`` });
},
},
}
+7 -7
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -28,14 +28,14 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
let data = {
user: user,
query: {
@@ -49,11 +49,11 @@ module.exports = {
if (results.user._id==user._id) {
if (results.vehicles.length == 0) {
return interaction.send(`Plate Number \`${args[0].value}\` not found.`);
return interaction.send({ content: `Plate Number \`${args[0].value}\` not found.` });
}
for (let i = 0; i < results.vehicles.length; i++) {
let plateResult = new MessageEmbed()
let plateResult = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(`**${results.vehicles[i].vehicle.plate} | ${results.vehicles[i]._id}**`)
.setURL('https://discord.gg/jgUW656v2t')
@@ -76,7 +76,7 @@ module.exports = {
if (validInsurance=='2') plateResult.addFields({ name: `**Insurance**`, value: `\`InValid\``, inline: true });
if (stolen=='1') plateResult.addFields({ name: `**Stolen**`, value: `\`No\``, inline: true });
if (stolen=='2') plateResult.addFields({ name: `**Stolen**`, value: `\`Yes\``, inline: true });
return interaction.send(plateResult);
return interaction.send({ embeds: [plateResult] });
}
}
socket.disconnect();
+8 -8
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "removechannel",
@@ -27,27 +27,27 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
if (args.length==0) return interaction.send(`You must provide a channel.`);
if (args.length==0) return interaction.send({ content: `You must provide a channel.` });
let channelid = args[0].value;
let channel = client.channels.cache.get(channelid);
if (!channel) return interaction.send(`Uh Oh! The channel <#${args[0].value}> connot be found.`);
if (!channel) return interaction.send({ content: `Uh Oh! The channel <#${args[0].value}> connot be found.` });
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (guild.server.hasCustomChannels==false) return interaction.send(`There are no channels to be removed.`);
if (!guild.server.allowedChannels.includes(channelid)) return interaction.send(`The channel <#${args[0].value}> is not added to your roles.`);
if (guild.server.hasCustomChannels==false) return interaction.send({ content: `There are no channels to be removed.` });
if (!guild.server.allowedChannels.includes(channelid)) return interaction.send({ content: `The channel <#${args[0].value}> is not added to your roles.` });
for (let i = 0; i < guild.server.allowedChannels.length; i++) {
if (guild.server.allowedChannels[i]==channelid) {
if ((guild.server.allowedChannels.length-1)==0) {
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":false}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully removed <#${args[0].value}> from allowed channels! There are no more allowed channels.`);
return interaction.send({ content: `Successfully removed <#${args[0].value}> from allowed channels! There are no more allowed channels.` });
});
} else if ((guild.server.allowedChannels.length-1)>0) {
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedChannels":channelid}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully removed <#${args[0].value}> from allowed channels.`);
return interaction.send({ content: `Successfully removed <#${args[0].value}> from allowed channels.` });
});
}
}
+7 -7
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "removerole",
@@ -27,28 +27,28 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let roleid = args[0].value;
let role = interaction.guild.roles.cache.find(x => x.id == roleid);
if (role == undefined) {
return interaction.send(`Uh Oh! The role <@&${args[0].value}> connot be found.`);
return interaction.send({ content: `Uh Oh! The role <@&${args[0].value}> connot be found.` });
} else {
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (guild.server.hasCustomRoles==false) return interaction.send(`There are no roles to be removed.`);
if (!guild.server.allowedRoles.includes(roleid)) return interaction.send(`The role <@&${args[0].value}> is not added to your roles.`);
if (guild.server.hasCustomRoles==false) return interaction.send({ content: `There are no roles to be removed.` });
if (!guild.server.allowedRoles.includes(roleid)) return interaction.send({ content: `The role <@&${args[0].value}> is not added to your roles.` });
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
if (guild.server.allowedRoles[i]==roleid) {
if ((guild.server.allowedRoles.length-1)==0) {
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":false}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully removed <@&${args[0].value}> from allowed roles! There are no more allowed roles.`);
return interaction.send({ content: `Successfully removed <@&${args[0].value}> from allowed roles! There are no more allowed roles.` });
});
} else if ((guild.server.allowedRoles.length-1)>0) {
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedRoles":roleid}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully removed <@&${args[0].value}> from allowed roles.`);
return interaction.send({ content: `Successfully removed <@&${args[0].value}> from allowed roles.` });
});
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "roles",
@@ -19,12 +19,12 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (guild.server.hasCustomRoles==false) {
return interaction.send('There are no roles set for the bot.');
return interaction.send({ content: 'There are no roles set for the bot.' });
}
let roles = ``;
@@ -34,7 +34,7 @@ module.exports = {
if (roles.length==0) roles += `@${role.name}`;
else roles += `\n@${role.name}`;
}
let rolesEmbed = new MessageEmbed()
let rolesEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setDescription('|**Allowed Roles to use the Bot**')
.addFields(
+7 -7
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "setchannel",
@@ -27,19 +27,19 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let channelid = args[0].value;
let channel = client.channels.cache.get(channelid);
if (!channel) return interaction.send(`Cannot find that channel.`);
if (channel.type=="voice") return interaction.send(`Connot set voice channel to preferred channel.`);
if (channel.deleted) return interaction.send(`Connot set deleted channel to preferred channel.`);
if (!channel) return interaction.send({ content: `Cannot find that channel.` });
if (channel.type=="voice") return interaction.send({ content: `Connot set voice channel to preferred channel.` });
if (channel.deleted) return interaction.send({ content: `Connot set deleted channel to preferred channel.` });
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return interaction.send(`The channel <#${args[0].value}> has already been added.`);
if (client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return interaction.send({ content: `The channel <#${args[0].value}> has already been added.` });
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$push:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":true}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully added <#${args[0].value}> to allowed channels.`);
return interaction.send({ content: `Successfully added <#${args[0].value}> to allowed channels.` });
});
},
},
+4 -4
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "setprefix",
@@ -27,12 +27,12 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
if (args[0].length<1) return interaction.send('Your new prefix must be \`1\` character!')
if (args[0].length<1) return interaction.send({ content: 'Your new prefix must be \`1\` character!' })
client.dbo.collection("prefixes").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.prefix":args[0].value}},function(err, res) {
if (err) throw err;
interaction.send(`The new prefix is now **\`${args[0].value}\`**`);
interaction.send({ content: `The new prefix is now **\`${args[0].value}\`**` });
});
},
},
+5 -5
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "setrole",
@@ -27,19 +27,19 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let roleid = args[0].value;
let role = interaction.guild.roles.cache.find(x => x.id == roleid);
if (role == undefined) {
return interaction.send(`Uh Oh! The role <@&${args[0].value}> connot be found.`);
return interaction.send({ content: `Uh Oh! The role <@&${args[0].value}> connot be found.` });
} else {
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (client.exists(guild.server.allowedRoles)&&guild.server.allowedRoles.includes(roleid)) return interaction.send(`The role <@&${args[0].value}> has already been added.`);
if (client.exists(guild.server.allowedRoles)&&guild.server.allowedRoles.includes(roleid)) return interaction.send({ content: `The role <@&${args[0].value}> has already been added.` });
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$push:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":true}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully added <@&${args[0].value}> to allowed roles.`);
return interaction.send({ content: `Successfully added <@&${args[0].value}> to allowed roles.` });
});
}
},
+4 -4
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
require("moment-duration-format");
module.exports = {
@@ -19,17 +19,17 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
const { version } = require("discord.js");
const stats = new MessageEmbed()
const stats = new EmbedBuilder()
.setColor('#0099ff')
.setTitle("Current LPC-Bot Statistics")
.setURL(client.config.SupportServer)
.addField(" \u200B ", "**Channels** : ` " + `${client.channels.cache.size}` + " `")
.addField(" \u200B ", "**Servers** : ` " + `${client.guilds.cache.size}` + " `")
.addField(" \u200B ", "**Users** : ` " + `${client.users.cache.size}` + " `")
interaction.send(stats)
interaction.send({ embeds: [stats] })
},
},
};
+5 -5
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "togglepingonpanic",
@@ -34,24 +34,24 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
if (!args[0].value) {
// disable ping on panic and remove ping role
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.pingOnPanic":false,"server.pingRole":null}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully disabled ping role on panic.`);
return interaction.send({ content: `Successfully disabled ping role on panic.` });
});
} else if (args[0].value) {
let roleid = args[1].value;
let role = interaction.guild.roles.cache.find(x => x.id == roleid);
if (role == undefined) {
return interaction.send(`Uh Oh! The role <@&${args[1].value}> connot be found.`);
return interaction.send({ content: `Uh Oh! The role <@&${args[1].value}> connot be found.` });
} else {
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.pingRole":roleid,"server.pingOnPanic":true}},function(err, res) {
if (err) throw err;
return interaction.send(`Successfully set <@&${args[1].value}> to be pinged on panic.`);
return interaction.send({ content: `Successfully set <@&${args[1].value}> to be pinged on panic.` });
});
}
}
+11 -11
View File
@@ -1,4 +1,4 @@
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -42,14 +42,14 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in.`);
if (!user) return interaction.send({ content: `You are not logged in.` });
let data = {
user: user,
@@ -66,7 +66,7 @@ module.exports = {
socket.on("bot_name_search_results", (results) => {
if (results.user._id==user._id) {
if (results.civilians.length == 0) {
return interaction.send(`Name \`${args[0].value} ${args[1].value}\` not found.`);
return interaction.send({ content: `Name \`${args[0].value} ${args[1].value}\` not found.` });
}
}
@@ -78,7 +78,7 @@ module.exports = {
if (results.civilians[i].civilian.licenseStatus == 1) licenseStatus = 'Valid';
if (results.civilians[i].civilian.licenseStatus == 2) licenseStatus = 'Revoked';
if (results.civilians[i].civilian.licenseStatus == 3) licenseStatus = 'None';
nameResult = new MessageEmbed()
nameResult = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(`**${results.civilians[i].civilian.firstName} ${results.civilians[i].civilian.lastName} | ${results.civilians[i]._id}**`)
.setURL('https://discord.gg/jgUW656v2t')
@@ -91,16 +91,16 @@ module.exports = {
{ name: `**Drivers License**`, value: `\`${licenseStatus}\``, inline: true },
{ name: `**Gender**`, value: `\`${results.civilians[i].civilian.gender}\``, inline: true }
)
row = new MessageActionRow()
row = new ActionRowBuilder()
.addComponents(
new MessageButton()
new ButtonBuilder()
.setCustomId(`license-revoke-${results.civilians[i]._id}`)
.setLabel("Revoke")
.setStyle("DANGER"),
new MessageButton()
.setStyle(ButtonStyle.Danger),
new ButtonBuilder()
.setCustomId(`license-reinstate-${results.civilians[i]._id}`)
.setLabel("Reinstate")
.setStyle("SUCCESS")
.setStyle(ButtonStyle.Success)
)
}
+6 -6
View File
@@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const io = require('socket.io-client');
module.exports = {
@@ -34,15 +34,15 @@ module.exports = {
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
}
let useCommand = await client.verifyUseCommand(GuildDB.serverID, interaction.member.roles, true);
if (!useCommand) return interaction.send("You don't have permission to use this command");
if (!useCommand) return interaction.send({ content: "You don't have permission to use this command" });
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
if (!user) return interaction.send(`You are not logged in <@${interactoin.member.user.id}>`);
if (user.user.activeCommunity==null) return interaction.send(`You must join a community to use this command.`);
if (!user) return interaction.send({ content: `You are not logged in <@${interactoin.member.user.id}>` });
if (user.user.activeCommunity==null) return interaction.send({ content: `You must join a community to use this command.` });
let onDuty=null;
let updateDuty=false;
let status = args[0].value;
@@ -66,7 +66,7 @@ module.exports = {
const socket = io.connect(client.config.socket);
socket.emit('bot_update_status', req);
socket.on('bot_updated_status', (res) => {
interaction.send(`Succesfully updated <@${interaction.member.user.id}>'s status to \`${args[0].value}\``);
interaction.send({ content: `Succesfully updated <@${interaction.member.user.id}>'s status to \`${args[0].value}\`` });
socket.disconnect();
});
},
+2 -2
View File
@@ -1,6 +1,6 @@
const LinesPoliceCadBot = require('./structures/LinesPoliceCadBot');
const { GatewayIntentBits } = require('discord.js');
const config = require('./config/config');
const { Intents } = require('discord.js');
let client = new LinesPoliceCadBot({ intents:[Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]}, config);
let client = new LinesPoliceCadBot({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] }, config);
client.build()
+373 -1727
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -12,7 +12,7 @@
"license": "ISC",
"dependencies": {
"colors": "^1.4.0",
"discord.js": "^13.8.0",
"discord.js": "^14.5.0",
"express": "^4.17.1",
"moment-duration-format": "^2.3.2",
"mongodb": "^3.6.8",
+33 -28
View File
@@ -1,5 +1,6 @@
const { Collection, Client, MessageEmbed } = require('discord.js');
const { Collection, Client, EmbedBuilder, Routes } = require('discord.js');
const MongoClient = require('mongodb').MongoClient;
const { REST } = require('@discordjs/rest');
const Logger = require("../util/Logger");
const io = require('socket.io-client');
const path = require("path");
@@ -28,38 +29,42 @@ class LinesPoliceCadBot extends Client {
this.Ready = false;
this.ws.on("INTERACTION_CREATE", async (interaction) => {
let GuildDB = await this.GetGuild(interaction.guild_id);
const start = new Date().getTime();
if (interaction.type!=3) {
client.log("Interaction")
let GuildDB = await this.GetGuild(interaction.guild_id);
if (interaction.type==3) return;
const command = interaction.data.name.toLowerCase();
const args = interaction.data.options;
const command = interaction.data.name.toLowerCase();
const args = interaction.data.options;
//Easy to send respnose so ;)
interaction.guild = await this.guilds.fetch(interaction.guild_id);
interaction.send = async (message) => {
const rest = new REST({ version: '10' }).setToken(client.config.Token);
//Easy to send respnose so ;)
interaction.guild = await this.guilds.fetch(interaction.guild_id);
interaction.send = async (message) => {
return await this.api
.interactions(interaction.id, interaction.token)
.callback.post({
data: {
type: 4,
data:
typeof message == "string"
? { content: message }
: message.type && message.type === "rich"
? { embeds: [message] }
: message,
},
return await rest.post(Routes.interactionCallback(interaction.id, interaction.token), {
body: {
type: 4,
data: message,
}
});
};
let cmd = client.commands.get(command);
client.log("Interaction - "+cmd.name);
if (cmd.SlashCommand && cmd.SlashCommand.run)
cmd.SlashCommand.run(this, interaction, args, { GuildDB });
});
try {
cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start); // start is only used in ping / stats command
} catch (err) {
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`)
.setColor(client.config.Colors.Red)
const client = this;
}
return interaction.send({ embeds: [embed] });
}
}
});
const client = this;
}
async connectMongo(mongoURI, dbo) {
this.db = await MongoClient.connect(mongoURI,{useUnifiedTopology:true});
@@ -151,7 +156,7 @@ class LinesPoliceCadBot extends Client {
}
sendTime(Channel, Error) {
let embed = new MessageEmbed()
let embed = new EmbedBuilder()
.setColor(this.config.EmbedColor)
.setDescription(Error);
@@ -228,7 +233,7 @@ class LinesPoliceCadBot extends Client {
}
sendError(Channel, Error) {
let embed = new MessageEmbed()
let embed = new EmbedBuilder()
.setTitle("An error occured")
.setColor("RED")
.setDescription(Error)
+25 -23
View File
@@ -1,36 +1,38 @@
const fs = require("fs");
const path = require("path");
const { Routes } = require('discord.js');
const { REST } = require('@discordjs/rest');
/**
* Register slash commands for a guild
* @param {require("../structures/LinesPoliceCadBot")} client
* @param {string} guild
*/
module.exports = (client, guild) => {
module.exports = async function(client, guild) {
const commands = [];
const commandFiles = fs.readdirSync(path.join(__dirname, "..", "commands")).filter(file => file.endsWith('.js'));
let commandsDir = path.join(__dirname, "..", "commands");
// Place your client and guild ids here
const clientId = client.application.id;
const guildId = guild;
fs.readdir(commandsDir, (err, files) => {
if (err) throw err;
files.forEach(async (file) => {
let cmd = require(commandsDir + "/" + file);
if (!cmd.SlashCommand || !cmd.SlashCommand.run) return;
let dataStuff = {
name: cmd.name,
description: cmd.description,
options: cmd.SlashCommand.options,
};
for (const file of commandFiles) {
const command = require(`../commands/${file}`);
commands.push(command);
}
//Creating variables like this, So you might understand my code :)
let ClientAPI = client.api.applications(client.user.id);
let GuildAPI = ClientAPI.guilds(guild);
const rest = new REST({ version: '10' }).setToken(client.config.Token);
try {
await GuildAPI.commands.post({ data: dataStuff });
} catch (e) {
client.log('Error: API missing permissions');
console.log(e)
}
});
});
try {
client.log(`[${guildId}] Started refreshing guild (/) commands.`);
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
client.log(`[${guildId}] Successfully reloaded guild (/) commands.`);
} catch (error) {
client.error(error);
}
};