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