deprecate prefix commands
This commit is contained in:
29 files changed
+34
-1012
No files matched your search
+1
-14
@@ -8,20 +8,7 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (user==null) return message.channel.send(`You are not logged in ${message.author}`);
|
||||
return message.author.send(`${message.author} Logged in as **${user.user.username}** | **${user.user.email}**`);
|
||||
},
|
||||
SlashCommand: {
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
*
|
||||
|
||||
+1
-30
@@ -8,36 +8,7 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (guild.server.hasCustomChannels==false) {
|
||||
return message.channel.send('There are no channels set for the bot.');
|
||||
}
|
||||
|
||||
let channels = ``;
|
||||
for (let i = 0; i < guild.server.allowedChannels.length; i++) {
|
||||
if (guild.server.allowedChannels[i] == undefined) break;
|
||||
if (channels.length==0) channels += `<#${guild.server.allowedChannels[i]}>`;
|
||||
else channels += `\n<#${guild.server.allowedChannels[i]}>`;
|
||||
}
|
||||
let channelsEmbed = new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setDescription('**Allowed Channels to use the Bot**')
|
||||
.addFields(
|
||||
{ name: `There are currently ${guild.server.allowedChannels.length} allowed channels.`, value: `${channels}`, inline: true },
|
||||
)
|
||||
.setFooter('LPS Website Support', client.config.IconURL, 'https://discord.gg/jgUW656v2t')
|
||||
return message.channel.send({ embeds: [channelsEmbed] });
|
||||
},
|
||||
SlashCommand: {
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -8,35 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (user.user.activeCommunity == null) return message.channel.send(`You must join a community to use this command.`);
|
||||
if (args.length == 0) {
|
||||
return message.channel.send(`${message.author}'s status: \`${user.user.dispatchStatus}\` | Set by: \`${user.user.dispatchStatusSetBy}\``);
|
||||
} else {
|
||||
let targetUserID = args[0].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 message.channel.send(`Cannot find **${args[0].value}** ${message.author}`);
|
||||
if (targetUser.user.activeCommunity!=user.user.activeCommunity) {
|
||||
return message.channel.send(`You are not in the same community as \`${User.tag}\` ${message.author}`);
|
||||
}
|
||||
return message.channel.send(`${message.author}, \`${User.tag}'s\` status: \`${targetUser.user.dispatchStatus}\` | Set by: \`${targetUser.user.dispatchStatusSetBy}\``);
|
||||
}
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -9,22 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (user.user.activeCommunity==null) return message.channel.send(`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 message.channel.send(`Community not found.`);
|
||||
return message.channel.send(`You are in the community \`${community.community.name}\``);
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
|
||||
@@ -1,24 +1,13 @@
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "login",
|
||||
description: "Connect your Lines Police CAD account to Discord",
|
||||
name: "connectAccount",
|
||||
description: "Connect your Discord Account to the Lines Police CAD Database",
|
||||
usage: "",
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
return message.channel.send('Login from Lines Police CAD account management https://www.linespolice-cad.com/');
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
@@ -32,7 +21,7 @@ module.exports = {
|
||||
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||
}
|
||||
interaction.send('Login from Lines Police CAD account management https://www.linespolice-cad.com/');
|
||||
return interaction.send('Login from Lines Police CAD account management https://www.linespolice-cad.com/');
|
||||
},
|
||||
},
|
||||
}
|
||||
+1
-54
@@ -5,64 +5,11 @@ module.exports = {
|
||||
name: "debug",
|
||||
description: "Debug for bot admin",
|
||||
usage: "command",
|
||||
debug: true,
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
if (!client.config.Admins.includes(message.author.id)) return;
|
||||
|
||||
if (args.length==0) return message.channel.send('Debug Error: Provide a debug command');
|
||||
if (!client.exists(args[0])) return message.channel.send('Debug Error: Provide a valid debug command');
|
||||
|
||||
let debugConsole = false
|
||||
if (client.exists(args[1])&&args[1]=='true') debugConsole = true
|
||||
|
||||
let command = args[0].toLowerCase();
|
||||
|
||||
if (command == 'server' || command == 'guild') {
|
||||
if (debugConsole) {
|
||||
client.log("Debug: Guild >> ");
|
||||
console.debug(GuildDB);
|
||||
}
|
||||
return message.channel.send("Debug: guild >> read log output")
|
||||
|
||||
} else if (command == "interaction") {
|
||||
return message.channel.send(`Use slash command to debug \`interaction\``);
|
||||
|
||||
} else if (command == "message") {
|
||||
if (debugConsole) {
|
||||
client.log("Debug: message >> ");
|
||||
console.debug(message);
|
||||
}
|
||||
return message.channel.send("Debug: message >> read log output");
|
||||
|
||||
} 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 message.channel.send(`Debug: Socket responded`)
|
||||
socket.disconnect();
|
||||
});
|
||||
|
||||
} else if (command == "apicheck") {
|
||||
// TODO: Make axios call to api and get api health
|
||||
return message.channel.send('Debug Notice: \`apicheck\` is currently unavailable');
|
||||
|
||||
} else {
|
||||
return message.channel.send('Debug Error: Provide a valid debug command');
|
||||
|
||||
}
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -2,28 +2,12 @@ const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "logout",
|
||||
description: "Disconnect your Lines Police CAD account from Discord",
|
||||
description: "Disconnect your Discord account from the Lines Police CAD Database",
|
||||
usage: "",
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You cannot logout if your not logged in.`);
|
||||
client.dbo.collection("users").updateOne({"user.discord.id":message.author.id},{$unset:{"user.discord":""}, $set:{"user.discordConnected":false}},function(err,res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Succesfully disconnected you Discord account.`);
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
@@ -9,58 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["firearm_search", "firearmdb", "firearm_db"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (args.length==0) return message.channel.send(`You are missing a \`Serial Number\`.`);
|
||||
let data = {
|
||||
user: user,
|
||||
query: {
|
||||
serialNumber: args[0],
|
||||
activeCommunityID: user.user.activeCommunity
|
||||
}
|
||||
}
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit('bot_firearm_search', data);
|
||||
socket.on('bot_firearm_search_results', results => {
|
||||
if (results.user._id==user._id) {
|
||||
if (results.firearms.length==0) {
|
||||
return message.channel.send(`No Firearms found ${message.author}`);
|
||||
}
|
||||
|
||||
for (let i = 0; i < results.firearms.length; i++) {
|
||||
let firearmResult = new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`**${results.firearms[i].firearm.serialNumber} | ${results.firearms[i]._id}**`)
|
||||
.setURL('https://discord.gg/jgUW656v2t')
|
||||
.setAuthor('LPS Website Support', client.config.IconURL, 'https://discord.gg/jgUW656v2t')
|
||||
.setDescription('Firearm Search Results')
|
||||
.addFields(
|
||||
{ name: `**Serial Number**`, value: `\`${results.firearms[i].firearm.serialNumber}\``, inline: true },
|
||||
{ name: `**Type**`, value: `\`${results.firearms[i].firearm.weaponType}\``, inline: true },
|
||||
{ name: `**Owner**`, value: `\`${results.firearms[i].firearm.registeredOwner}\``, inline: true },
|
||||
)
|
||||
// Other details
|
||||
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});
|
||||
message.channel.send({ embeds: [firearmResult] });
|
||||
}
|
||||
}
|
||||
socket.disconnect();
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
+9
-96
@@ -8,77 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["command", "commands", "cmd"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
let Commands = client.commands.map((cmd) =>
|
||||
cmd.name != 'debug' ? `\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||
cmd.name
|
||||
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` : null
|
||||
);
|
||||
let Embed = new MessageEmbed()
|
||||
.setAuthor(
|
||||
`Commands of ${client.user.username}`,
|
||||
client.config.IconURL
|
||||
)
|
||||
.setColor(client.config.EmbedColor)
|
||||
.setFooter(
|
||||
`To get info of each command type ${
|
||||
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
|
||||
}help [Command] | Have a nice day!`
|
||||
).setDescription(`${Commands.join("\n")}
|
||||
|
||||
Lines Police CAD Bot Version: v${client.config.Version}`);
|
||||
if (!args[0]) {
|
||||
message.channel.send({ embeds: [Embed] });
|
||||
}
|
||||
else {
|
||||
let cmd =
|
||||
client.commands.get(args[0]) ||
|
||||
client.commands.find((x) => x.aliases && x.aliases.includes(args[0]));
|
||||
if (!cmd)
|
||||
return client.sendTime(
|
||||
message.channel,
|
||||
`❌ | Unable to find that command.`
|
||||
);
|
||||
|
||||
let embed = new MessageEmbed()
|
||||
.setAuthor(`Command: ${cmd.name}`, client.config.IconURL)
|
||||
.setDescription(cmd.description)
|
||||
.setColor("GREEN")
|
||||
//.addField("Name", cmd.name, true)
|
||||
.addField("Aliases", `\`${cmd.aliases.join(", ")}\``, true)
|
||||
.addField(
|
||||
"Usage",
|
||||
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||
cmd.name
|
||||
}${cmd.usage ? " " + cmd.usage : ""}\``,
|
||||
true
|
||||
)
|
||||
.addField(
|
||||
"Permissions",
|
||||
"Member: " +
|
||||
cmd.permissions.member.join(", ") +
|
||||
"\nBot: " +
|
||||
cmd.permissions.channel.join(", "),
|
||||
true
|
||||
)
|
||||
.setFooter(
|
||||
`Prefix - ${
|
||||
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
|
||||
}`
|
||||
);
|
||||
|
||||
message.channel.send({ embeds: [embed] });
|
||||
}
|
||||
},
|
||||
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
@@ -101,25 +30,18 @@ module.exports = {
|
||||
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||
}
|
||||
let Commands = client.commands.map((cmd) =>
|
||||
cmd.name != 'debug' ? `\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||
cmd.name
|
||||
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` : null
|
||||
let Commands = client.commands.filter((cmd) => {
|
||||
if (client.exists(cmd.debug)) return !cmd.debug
|
||||
else return true
|
||||
}).map((cmd) =>
|
||||
`\`/${cmd.name}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}`
|
||||
);
|
||||
|
||||
let Embed = new MessageEmbed()
|
||||
.setAuthor(
|
||||
`Commands of ${client.user.username}`,
|
||||
client.config.IconURL
|
||||
)
|
||||
.setColor(client.config.EmbedColor)
|
||||
.setFooter(
|
||||
`To get info of each command type ${
|
||||
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
|
||||
}help [Command] | Have a nice day!`
|
||||
).setDescription(`${Commands.join("\n")}
|
||||
.setDescription(`${Commands.join("\n")}
|
||||
|
||||
Lines Police CAD Bot Version: v${client.config.Version}`);
|
||||
LPC Bot Version: v${client.config.Version}`);
|
||||
if (!args) return interaction.send(Embed);
|
||||
else {
|
||||
let cmd =
|
||||
@@ -137,13 +59,9 @@ module.exports = {
|
||||
.setAuthor(`Command: ${cmd.name}`, client.config.IconURL)
|
||||
.setDescription(cmd.description)
|
||||
.setColor("GREEN")
|
||||
//.addField("Name", cmd.name, true)
|
||||
.addField("Aliases", cmd.aliases.join(", "), true)
|
||||
.addField(
|
||||
"Usage",
|
||||
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||
cmd.name
|
||||
}\`${cmd.usage ? " " + cmd.usage : ""}`,
|
||||
`\`/${cmd.name}${cmd.usage ? " " + cmd.usage : ""}\``,
|
||||
true
|
||||
)
|
||||
.addField(
|
||||
@@ -154,13 +72,8 @@ module.exports = {
|
||||
cmd.permissions.channel.join(", "),
|
||||
true
|
||||
)
|
||||
.setFooter(
|
||||
`Prefix - ${
|
||||
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
|
||||
}`
|
||||
);
|
||||
|
||||
interaction.send(embed);
|
||||
return interaction.send(embed);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,32 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["join"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (args.length==0) return message.channel.send(`You must provide a \`Community Code\`.`);
|
||||
let myReq = {
|
||||
userID: user._id,
|
||||
communityCode: args[0]
|
||||
};
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit('bot_join_community', myReq);
|
||||
socket.on('bot_joined_community', (data) => {
|
||||
socket.disconnect()
|
||||
if (data.error) {
|
||||
return message.channel.send(`${data.error}`);
|
||||
}
|
||||
return message.channel.send(`Successfully joined the community \` ${data.commName} \``)
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -9,30 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["leave"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
let myReq = {
|
||||
userID: user._id
|
||||
};
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit('bot_leave_community', myReq);
|
||||
socket.on('bot_left_community', (data) => {
|
||||
socket.disconnect()
|
||||
if (data.error) {
|
||||
return message.channel.send(`${data.error}`);
|
||||
}
|
||||
return message.channel.send(`${data.message}`);
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
|
||||
@@ -9,109 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["namedb", "name_search", "name_db"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
if (GuildDB.customRoleStatus) {
|
||||
let userRoles = []; // TODO: get user roles
|
||||
let hasRole = await client.hasRole(userRoles, GuildDB.serverID);
|
||||
if (!hasRole) return message.channel.send(`You don't have permission to use this command.`);
|
||||
}
|
||||
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (args.length==0) return message.channel.send(`You must provide a \`First Name\`, \`Last Name\` and \`DOB\`(yyyy-mm-dd).`);
|
||||
if (args.length==1) return message.channel.send(`You're missing a \`Last Name\` and \`DOB\`(yyyy-mm-dd).`);
|
||||
if (args.length==2) return message.channel.send(`You're missing a \`DOB\`(yyyy-mm-dd).`);
|
||||
|
||||
let data = {
|
||||
user: user,
|
||||
query: {
|
||||
firstName: args[0],
|
||||
lastName: args[1],
|
||||
dateOfBirth: args[2],
|
||||
activeCommunityID: user.user.activeCommunity
|
||||
}
|
||||
}
|
||||
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit("bot_name_search", data);
|
||||
socket.on("bot_name_search_results", results => {
|
||||
|
||||
if (results.user._id==user._id) {
|
||||
if (results.civilians.length == 0) {
|
||||
return message.channel.send(`Name \`${args[0]} ${args[1]}\` not found ${message.author}`);
|
||||
}
|
||||
|
||||
for (let i = 0; i < results.civilians.length; i++) {
|
||||
// Get Drivers Licence Status
|
||||
let licenceStatus;
|
||||
if (results.civilians[i].civilian.licenseStatus == 1) licenceStatus = 'Valid';
|
||||
if (results.civilians[i].civilian.licenceStatus == 2) licenceStatus = 'Revoked';
|
||||
if (results.civilians[i].civilian.licenceStatus == 3) licenceStatus = 'None';
|
||||
// Get Firearm Licence Status
|
||||
let firearmLicence = results.civilians[i].civilian.firearmLicense;
|
||||
if (firearmLicence == undefined || firearmLicence == null) firearmLicence = 'None';
|
||||
if (firearmLicence == '2') firearmLicence = 'Valid';
|
||||
if (firearmLicence == '3') firearmLicence = 'Revoked';
|
||||
let nameResult = new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`**${results.civilians[i].civilian.firstName} ${results.civilians[i].civilian.lastName} | ${results.civilians[i]._id}**`)
|
||||
.setURL('https://discord.gg/jgUW656v2t')
|
||||
.setAuthor('LPS Website Support', client.config.IconURL, 'https://discord.gg/jgUW656v2t')
|
||||
.setDescription('Name Search Results')
|
||||
.addFields(
|
||||
{ name: `**First Name**`, value: `\`${results.civilians[i].civilian.firstName}\``, inline: true },
|
||||
{ name: `**Last Name**`, value: `\`${results.civilians[i].civilian.lastName}\``, inline: true },
|
||||
{ name: `**DOB**`, value: `\`${results.civilians[i].civilian.birthday}\``, inline: true },
|
||||
{ name: `**Drivers License**`, value: `\`${licenceStatus}\``, inline: true },
|
||||
{ name: `**Firearm Licence**`, value: `\`${firearmLicence}\``, inline: true },
|
||||
{ name: `**Gender**`, value: `\`${results.civilians[i].civilian.gender}\``, inline: true }
|
||||
)
|
||||
// Check Other details
|
||||
let address = results.civilians[i].civilian.address;
|
||||
let occupation = results.civilians[i].civilian.occupation;
|
||||
let height = results.civilians[i].civilian.height;
|
||||
let weight = results.civilians[i].civilian.weight;
|
||||
let eyeColor = results.civilians[i].civilian.eyeColor;
|
||||
let hairColor = results.civilians[i].civilian.hairColor;
|
||||
if (address != null && address != undefined && address != '') nameResult.addFields({ name: `**Address**`, value: `\`${address}\``, inline: true });
|
||||
if (occupation != null && occupation != undefined && occupation != '') nameResult.addFields({ name: `**Occupation**`, value: `\`${occupation}\``, inline: true });
|
||||
if (height!=null&&height!=undefined&&height!="NaN"&&height!='') {
|
||||
if (results.civilians[i].civilian.heightClassification=='imperial') {
|
||||
let ft = Math.floor(height/12);
|
||||
let inch = height%12;
|
||||
nameResult.addFields({ name: '**Height**', value: `\`${ft}'${inch}"\``, inline: true });
|
||||
} else {
|
||||
nameResult.addFields({ name: '**Height**', value: `\`${height}cm\``, inline: true });
|
||||
}
|
||||
}
|
||||
if (weight!=null&&weight!=undefined&&weight!='') {
|
||||
if (results.civilians[i].civilian.weightClassification=='imperial') {
|
||||
nameResult.addFields({ name: '**Weight**', value: `\`${weight}lbs.\``, inline: true });
|
||||
} else {
|
||||
nameResult.addFields({ name: '**Weight**', value: `\`${weight}kgs.\``, inline: true });
|
||||
}
|
||||
}
|
||||
if (eyeColor!=null&&eyeColor!=undefined&&eyeColor!='') nameResult.addFields({name:'**Eye Color**',value:`\`${eyeColor}\``,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:'**Veteran**',value:`\`${results.civilians[i].civilian.veteran}\``,inline:true});
|
||||
message.channel.send({ embeds: [nameResult] });
|
||||
}
|
||||
}
|
||||
socket.disconnect();
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -8,63 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["enablepanic"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (user.user.activeCommunity==null) return message.channel.send(`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') {
|
||||
let myReq = {
|
||||
userID: user._id,
|
||||
communityID: user.user.activeCommunity
|
||||
};
|
||||
socket.emit('clear_panic', myReq);
|
||||
|
||||
let myUpdateReq = {
|
||||
userID: user._id,
|
||||
status: '10-8',
|
||||
setBy: 'System',
|
||||
onDuty: null,
|
||||
updateDuty: false
|
||||
};
|
||||
socket.emit('bot_update_status', myUpdateReq);
|
||||
socket.on('bot_updated_status', (res) => {
|
||||
message.channel.send(`Disabled Panic ${message.author} and set status to \`10-8\`.`);
|
||||
socket.disconnect();
|
||||
});
|
||||
return;
|
||||
|
||||
// If panic is disabled, enable panic
|
||||
} else {
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (user.user.activeCommunity==null) return message.channel.send(`You must join a community to use this command.`);
|
||||
client.forceUpdateStatus('Panic', user);
|
||||
|
||||
let req = {
|
||||
userID: user._id,
|
||||
userUsername: user.user.username,
|
||||
activeCommunity: user.user.activeCommunity
|
||||
}
|
||||
socket.emit('panic_button_update', req);
|
||||
socket.disconnect();
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (guild.server.pingOnPanic) return message.channel.send(`Attention <@&${guild.server.pingRole}>! \`${user.user.username}\` has activated panic`);
|
||||
return;
|
||||
}
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
|
||||
@@ -9,16 +9,6 @@ module.exports = {
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
return message.channel.send('Pong!');
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
|
||||
@@ -8,18 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["pingonpanicstatus"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
return message.channel.send(`Current Ping on Panic Status: ${guild.server.pingOnPanic}`);
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
|
||||
@@ -9,67 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["plate_search", "platedb", "plate_db"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (args.length==0) return message.channel.send(`You are missing a \`Plate #\`.`);
|
||||
let data = {
|
||||
user: user,
|
||||
query: {
|
||||
plateNumber: args[0],
|
||||
activeCommunityID: user.user.activeCommunity
|
||||
}
|
||||
}
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit('bot_plate_search', data);
|
||||
socket.on('bot_plate_search_results', results => {
|
||||
|
||||
if (results.user._id==user._id) {
|
||||
if (results.vehicles.length == 0) {
|
||||
return message.channel.send(`Plate Number \`${args[0]}\` not found.`);
|
||||
}
|
||||
|
||||
for (let i = 0; i < results.vehicles.length; i++) {
|
||||
let plateResult = new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`**${results.vehicles[i].vehicle.plate} | ${results.vehicles[i]._id}**`)
|
||||
.setURL('https://discord.gg/jgUW656v2t')
|
||||
.setAuthor('LPS Website Support', client.config.IconURL, 'https://discord.gg/jgUW656v2t')
|
||||
.setDescription('Plate Search Results')
|
||||
.addFields(
|
||||
{ name: `**Plate #**`, value: `\`${results.vehicles[i].vehicle.plate}\``, inline: true },
|
||||
{ name: `**Vin #**`, value: `\`${results.vehicles[i].vehicle.vin}\``, inline: true },
|
||||
{ name: `**Model**`, value: `\`${results.vehicles[i].vehicle.model}\``, inline: true },
|
||||
{ name: `**Color**`, value: `\`${results.vehicles[i].vehicle.color}\``, inline: true },
|
||||
{ name: `**Owner**`, value: `\`${results.vehicles[i].vehicle.registeredOwner}\``, inline: true },
|
||||
)
|
||||
// Other details
|
||||
let validRegistration = results.vehicles[i].vehicle.validRegistration;
|
||||
let validInsurance = results.vehicles[i].vehicle.validInsurance;
|
||||
let stolen = results.vehicles[i].vehicle.isStolen;
|
||||
if (validRegistration=='1') plateResult.addFields({ name: `**Registration**`, value: `\`Valid\``, inline: true });
|
||||
if (validRegistration=='2') plateResult.addFields({ name: `**Registration**`, value: `\`InValid\``, inline: true });
|
||||
if (validInsurance=='1') plateResult.addFields({ name: `**Insurance**`, value: `\`Valid\``, 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=='2') plateResult.addFields({ name: `**Stolen**`, value: `\`Yes\``, inline: true });
|
||||
message.channel.send({ embeds: [plateResult] });
|
||||
}
|
||||
}
|
||||
socket.disconnect();
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -8,38 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["remove_role"],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
if (args.length==0) return message.channel.send(`You must provide a channel.`);
|
||||
let channelid = args[0].replace('<#', '').replace('>', '');
|
||||
let channel = client.channels.cache.get(channelid);
|
||||
if (!channel) return message.channel.send(`Uh Oh! The channel ${args[0]} connot be found.`);
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (guild.server.hasCustomChannels==false) return message.channel.send(`There are no channels to be removed.`);
|
||||
if (!guild.server.allowedChannels.includes(channelid)) return message.channel.send(`The channel ${args[0]} 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":message.guild.id},{$pull:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":false}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully removed ${args[0]} from allowed channels ${message.author}! There are no more allowed channels.`);
|
||||
});
|
||||
} else if ((guild.server.allowedChannels.length-1)>0) {
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$pull:{"server.allowedChannels":channelid}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully removed ${args[0]} from allowed channels.`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -8,41 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
aliases: ["remove_role"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
if (args.length==0) return message.channel.send(`You must provide a role.`);
|
||||
let roleid = args[0].replace('<@&', '').replace('>', '');
|
||||
let role = message.guild.roles.cache.find(x => x.id == roleid);
|
||||
if (role == undefined) {
|
||||
return message.channel.send(`Uh Oh! The role ${args[0]} connot be found.`);
|
||||
} else {
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (guild.server.hasCustomRoles==false) return message.channel.send(`There are no roles to be removed.`);
|
||||
if (!guild.server.allowedRoles.includes(roleid)) return message.channel.send(`The role ${args[0]} 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":message.guild.id},{$pull:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":false}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully removed ${args[0]} from allowed roles! There are no more allowed roles.`);
|
||||
});
|
||||
} else if ((guild.server.allowedRoles.length-1)>0) {
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$pull:{"server.allowedRoles":roleid}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully removed ${args[0]} from allowed roles.`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -8,36 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (guild.server.hasCustomRoles==false) {
|
||||
return message.channel.send('There are no roles set for the bot.');
|
||||
}
|
||||
|
||||
let roles = ``;
|
||||
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
||||
if (guild.server.allowedRoles[i] == undefined) break;
|
||||
let role = message.guild.roles.cache.find(r => r.id == guild.server.allowedRoles[i]);
|
||||
if (roles.length==0) roles += `@${role.name}`;
|
||||
else roles += `\n@${role.name}`;
|
||||
}
|
||||
let rolesEmbed = new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setDescription('**Allowed Roles to use the Bot**')
|
||||
.addFields(
|
||||
{ name: `There are currently ${guild.server.allowedRoles.length} allowed roles.`, value: `\`${roles}\``, inline: true },
|
||||
)
|
||||
.setFooter('LPS Website Support', client.config.IconURL, 'https://discord.gg/jgUW656v2t')
|
||||
return message.channel.send({ embeds: [rolesEmbed] });
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
|
||||
@@ -8,28 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
aliases: ["set_channel", "addchannel", "add_channel"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
if (args.length==0) return message.channel.send(`You must provide a channel.`);
|
||||
let channelid = args[0].replace('<#', '').replace('>', '');
|
||||
let channel = client.channels.cache.get(channelid);
|
||||
if (!channel) return message.channel.send(`Cannot find that channel.`);
|
||||
if (channel.type=="voice") return message.channel.send(`Connot set voice channel to preferred channel.`);
|
||||
if (channel.deleted) return message.channel.send(`Connot set deleted channel to preferred channel.`);
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return message.channel.send(`The channel ${args[0]} has already been added.`);
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$push:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":true}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully added ${args[0]} to allowed channels.`);
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -8,22 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
aliases: ["newprefix", "new_prefix", "set_prefix"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
if (args[0]==undefined) return message.channel.send(`You must provide a \`new prefix\` ${message.author}`);
|
||||
if (args[0].length<1) return message.channel.send('Your new prefix must be \`1\` character!')
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.prefix":args[0]}},function(err, res) {
|
||||
if (err) throw err;
|
||||
message.channel.send(`The new prefix is now **\`${args[0]}\`**`);
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -8,29 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
aliases: ["set_role", "addrole", "add_role"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
if (args.length==0) return message.channel.send(`You must provide a role.`);
|
||||
let roleid = args[0].replace('<@&', '').replace('>', '');
|
||||
let role = message.guild.roles.cache.find(x => x.id == roleid);
|
||||
if (role == undefined) {
|
||||
return message.channel.send(`Uh Oh! The role ${args[0]} connot be found.`);
|
||||
} else {
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
||||
if (client.exists(guild.server.allowedRoles)&&guild.server.allowedRoles.includes(roleid)) return message.channel.send(`The role ${args[0]} has already been added.`);
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$push:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":true}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully added ${args[0]} to allowed roles.`);
|
||||
});
|
||||
}
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -9,24 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["stat", "statistics", "info"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message) => {
|
||||
const stats = new MessageEmbed()
|
||||
.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}` + " `")
|
||||
return message.channel.send({ embeds: [stats] });
|
||||
},
|
||||
SlashCommand: {
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -8,36 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
if (args.length==0) return message.channel.send(`You must provide a \`Ping On Role Status\` and a \`role\` to ping.`);
|
||||
if (args[0]=="false") {
|
||||
// disable ping on panic and remove ping role
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$set:{"server.pingOnPanic":false,"server.pingRole":null}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully disabled ping role on panic.`);
|
||||
});
|
||||
} else if (args[0]=="true") {
|
||||
if (!args[1]) return message.channel.send(`You must provide a \`role\` to ping .`);
|
||||
let roleid = args[1].replace('<@&', '').replace('>', '');
|
||||
let role = message.guild.roles.cache.find(x => x.id == roleid);
|
||||
if (role == undefined) {
|
||||
return message.channel.send(`Uh Oh! The role ${args[1]} connot be found.`);
|
||||
} else {
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$set:{"server.pingRole":roleid,"server.pingOnPanic":true}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return message.channel.send(`Successfully set ${args[1]} to be pinged on panic.`);
|
||||
});
|
||||
}
|
||||
} else return message.channel.send(`\`${args[0]}\` is an invalid status, use \`true\` or \`false\``);
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -9,114 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in.`);
|
||||
if (args.length==0) return message.channel.send(`You must provide a \`First Name\`, \`Last Name\`, \`DOB\`(yyyy-mm-dd).`);
|
||||
if (args.length==1) return message.channel.send(`You're missing a \`Last Name\` and \`DOB\`(yyyy-mm-dd).`);
|
||||
if (args.length==2) return message.channel.send(`You're missing a \`DOB\`(yyyy-mm-dd).`);
|
||||
|
||||
let data = {
|
||||
user: user,
|
||||
query: {
|
||||
firstName: args[0],
|
||||
lastName: args[1],
|
||||
dateOfBirth: args[2],
|
||||
activeCommunityID: user.user.activeCommunity
|
||||
}
|
||||
}
|
||||
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit("bot_name_search", data);
|
||||
socket.on("bot_name_search_results", (results) => {
|
||||
if (results.user._id==user._id) {
|
||||
if (results.civilians.length == 0) {
|
||||
return message.channel.send(`Name \`${args[0]} ${args[1]}\` not found.`);
|
||||
}
|
||||
}
|
||||
|
||||
let nameResult;
|
||||
let row;
|
||||
for (let i = 0; i < results.civilians.length; i++) {
|
||||
// Get Drivers Licence Status
|
||||
let licenseStatus;
|
||||
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()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`**${results.civilians[i].civilian.firstName} ${results.civilians[i].civilian.lastName} | ${results.civilians[i]._id}**`)
|
||||
.setURL('https://discord.gg/jgUW656v2t')
|
||||
.setAuthor('LPS Website Support', client.config.IconURL, 'https://discord.gg/jgUW656v2t')
|
||||
.setDescription('Name Search Results')
|
||||
.addFields(
|
||||
{ name: `**First Name**`, value: `\`${results.civilians[i].civilian.firstName}\``, inline: true },
|
||||
{ name: `**Last Name**`, value: `\`${results.civilians[i].civilian.lastName}\``, inline: true },
|
||||
{ name: `**DOB**`, value: `\`${results.civilians[i].civilian.birthday}\``, inline: true },
|
||||
{ name: `**Drivers License**`, value: `\`${licenseStatus}\``, inline: true },
|
||||
{ name: `**Gender**`, value: `\`${results.civilians[i].civilian.gender}\``, inline: true }
|
||||
)
|
||||
row = new MessageActionRow()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
.setCustomId(`license-revoke-${results.civilians[i]._id}`)
|
||||
.setLabel("Revoke")
|
||||
.setStyle("DANGER"),
|
||||
new MessageButton()
|
||||
.setCustomId(`license-reinstate-${results.civilians[i]._id}`)
|
||||
.setLabel("Reinstate")
|
||||
.setStyle("SUCCESS")
|
||||
)
|
||||
}
|
||||
|
||||
message.channel.send({ embeds: [nameResult], components: [row] });
|
||||
|
||||
const filter = i => {
|
||||
return i.user.id == message.author.id;
|
||||
}
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 20000
|
||||
});
|
||||
|
||||
collector.on('collect', async ButtonInteraction => {
|
||||
const socket = io.connect(client.config.socket);
|
||||
|
||||
let queryString = ButtonInteraction.customId;
|
||||
let query = {
|
||||
_id: "",
|
||||
status: null,
|
||||
bot_request: true
|
||||
};
|
||||
if (queryString.substr(8, 6)=='revoke') {
|
||||
query.status = 2;
|
||||
query._id = queryString.substr(15, 24);
|
||||
} else if (queryString.substr(8, 9)=='reinstate') {
|
||||
query.status = 1;
|
||||
query._id = queryString.substr(18, 24);
|
||||
}
|
||||
socket.emit("update_drivers_license_status", query);
|
||||
socket.on("bot_updated_drivers_license_status", (res) => {
|
||||
if (!res.success) ButtonInteraction.update({ content: 'Failed to update license.', embeds: [], components: [] });
|
||||
socket.disconnect();
|
||||
});
|
||||
return ButtonInteraction.update({ content: 'Successfully updated license.', embeds: [], components: [] });
|
||||
});
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -9,51 +9,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
aliases: ["update_status"],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, message, args, { GuildDB }) => {
|
||||
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
|
||||
if (!useCommand) return message.channel.send("You don't have permission to use this command");
|
||||
|
||||
let validStatus=['10-8','10-7','10-6','10-11','10-23','10-97','10-15','10-70','10-80', '10-41', '10-42'];
|
||||
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||
if (!user) return message.channel.send(`You are not logged in ${message.author}`);
|
||||
if (user.user.activeCommunity==null) return message.channel.send(`You must join a community to use this command.`);
|
||||
if (args.length==0) return message.channel.send(`You must provide a new status.`);
|
||||
if (!validStatus.includes(args[0])) return message.channel.send(`\`${args[0]}\` is a Invalid Status.`);
|
||||
let onDuty=null;
|
||||
let updateDuty=false;
|
||||
let status = args[0]
|
||||
if (args[0]=='10-41') {
|
||||
onDuty=true;
|
||||
updateDuty=true;
|
||||
status='Online';
|
||||
}
|
||||
if (args[0]=='10-42') {
|
||||
onDuty=false;
|
||||
updateDuty=true;
|
||||
status='Offline';
|
||||
}
|
||||
let req={
|
||||
userID: user._id,
|
||||
status: status,
|
||||
setBy: 'Self',
|
||||
onDuty: onDuty,
|
||||
updateDuty: updateDuty
|
||||
};
|
||||
const socket = io.connect(client.config.socket);
|
||||
socket.emit('bot_update_status', req);
|
||||
socket.on('bot_updated_status', (res) => {
|
||||
message.channel.send(`Succesfully updated status to \`${args[0]}\` ${message.author}`);
|
||||
socket.disconnect();
|
||||
});
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user