Merge pull request #11 from SowinskiBraeden/reformat-code
Reformat code
This commit is contained in:
37 files changed
+2913
-592
No files matched your search
+3
-3
@@ -2,13 +2,13 @@
|
|||||||
node_modules/*
|
node_modules/*
|
||||||
|
|
||||||
# test file
|
# test file
|
||||||
|
default.js
|
||||||
test.js
|
test.js
|
||||||
default.js
|
default.js
|
||||||
|
|
||||||
# Dev Launch
|
# Dev
|
||||||
config/dev-config.js
|
config/dev-config.js
|
||||||
dev.js
|
dev.js
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs/*
|
||||||
*.log
|
|
||||||
@@ -1,423 +0,0 @@
|
|||||||
const { Collection, Client, MessageEmbed } = require('discord.js');
|
|
||||||
const CommandHandler = require('./commands').Commands;
|
|
||||||
const MongoClient = require('mongodb').MongoClient;
|
|
||||||
const Logger = require("./util/Logger");
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
class LinesPoliceCadBot extends Client {
|
|
||||||
|
|
||||||
constructor(config) {
|
|
||||||
super()
|
|
||||||
|
|
||||||
this.config = config;
|
|
||||||
this.commands = new Collection();
|
|
||||||
this.logger = new Logger('./Logs.log');
|
|
||||||
|
|
||||||
if (this.config.Token === "")
|
|
||||||
return new TypeError(
|
|
||||||
"The botconfig.js is not filled out. Please make sure nothing is blank, otherwise the bot will not work properly."
|
|
||||||
);
|
|
||||||
|
|
||||||
this.connectMongo(this.config.mongoURI, this.config.dbo);
|
|
||||||
this.LoadCommands();
|
|
||||||
this.LoadEvents();
|
|
||||||
|
|
||||||
this.Ready = false;
|
|
||||||
|
|
||||||
this.ws.on("INTERACTION_CREATE", async (interaction) => {
|
|
||||||
client.log("Interaction")
|
|
||||||
let GuildDB = await this.GetGuild(interaction.guild_id);
|
|
||||||
|
|
||||||
//Initialize GuildDB
|
|
||||||
if (!GuildDB) {
|
|
||||||
await this.database.guild.set(interaction.guild_id, {
|
|
||||||
prefix: this.config.DefaultPrefix,
|
|
||||||
DJ: null,
|
|
||||||
});
|
|
||||||
GuildDB = await this.GetGuild(interaction.guild_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
const command = interaction.data.name.toLowerCase();
|
|
||||||
const args = interaction.data.options;
|
|
||||||
|
|
||||||
//Easy to send respnose so ;)
|
|
||||||
interaction.guild = await this.guilds.fetch(interaction.guild_id);
|
|
||||||
interaction.send = async (message) => {
|
|
||||||
return await this.api
|
|
||||||
.interactions(interaction.id, interaction.token)
|
|
||||||
.callback.post({
|
|
||||||
data: {
|
|
||||||
type: 4,
|
|
||||||
data:
|
|
||||||
typeof message == "string"
|
|
||||||
? { content: message }
|
|
||||||
: message.type && message.type === "rich"
|
|
||||||
? { embeds: [message] }
|
|
||||||
: message,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let cmd = client.commands.get(command);
|
|
||||||
if (cmd.SlashCommand && cmd.SlashCommand.run)
|
|
||||||
cmd.SlashCommand.run(this, interaction, args, { GuildDB });
|
|
||||||
});
|
|
||||||
|
|
||||||
const client = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
async connectMongo(mongoURI, dbo) {
|
|
||||||
this.db = await MongoClient.connect(mongoURI,{useUnifiedTopology:true});
|
|
||||||
this.dbo = this.db.db(dbo);
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadCommands() {
|
|
||||||
let CommandsDir = './commands';
|
|
||||||
fs.readdir(CommandsDir, (err, files) => {
|
|
||||||
if (err) this.log(err);
|
|
||||||
else
|
|
||||||
files.forEach((file) => {
|
|
||||||
let cmd = require(CommandsDir + "/" + file);
|
|
||||||
if (!cmd.name || !cmd.description || !cmd.run)
|
|
||||||
return this.log(
|
|
||||||
"Unable to load Command: " +
|
|
||||||
file.split(".")[0] +
|
|
||||||
", Reason: File doesn't had run/name/desciption"
|
|
||||||
);
|
|
||||||
this.commands.set(file.split(".")[0].toLowerCase(), cmd);
|
|
||||||
this.log("Command Loaded: " + file.split(".")[0]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadEvents() {
|
|
||||||
let EventsDir = './events';
|
|
||||||
fs.readdir(EventsDir, (err, files) => {
|
|
||||||
if (err) this.log(err);
|
|
||||||
else
|
|
||||||
files.forEach((file) => {
|
|
||||||
const event = require(EventsDir + "/" + file);
|
|
||||||
this.on(file.split(".")[0], event.bind(null, this));
|
|
||||||
this.logger.log("Event Loaded: " + file.split(".")[0]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterSlashCommands() {
|
|
||||||
this.guilds.cache.forEach((guild) => {
|
|
||||||
require("./util/RegisterSlashCommands")(this, guild.id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkRoleStatus(message) {
|
|
||||||
let hasRole = false;
|
|
||||||
let guild = await this.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild);
|
|
||||||
// If user has one of any in the list of allowed roles, hasRole is true
|
|
||||||
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
|
||||||
if (message.member.roles.cache.some(role => role.id == guild.server.allowedRoles[i])) hasRole = true;
|
|
||||||
}
|
|
||||||
return hasRole;
|
|
||||||
}
|
|
||||||
|
|
||||||
async GetGuild(GuildId) {
|
|
||||||
let prefix;
|
|
||||||
let channelId;
|
|
||||||
let customRoleStatus;
|
|
||||||
let customChannelStatus;
|
|
||||||
let allowedChannels;
|
|
||||||
let guild = await this.dbo.collection("prefixes").findOne({"server.serverID":GuildId}).then(guild => guild);
|
|
||||||
|
|
||||||
// If guild not found, generate guild default
|
|
||||||
if (!guild) {
|
|
||||||
let newGuild = {
|
|
||||||
server: {
|
|
||||||
serverID: GuildId,
|
|
||||||
prefix: this.config.DefaultPrefix,
|
|
||||||
hasCustomRoles: false,
|
|
||||||
hasCustomChannels: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.dbo.collection("prefixes").insertOne(newGuild, function(err, res) {
|
|
||||||
if (err) throw err;
|
|
||||||
});
|
|
||||||
prefix = newGuild.server.prefix;
|
|
||||||
customRoleStatus = newGuild.server.hasCustomRoles;
|
|
||||||
customChannelStatus = newGuild.server.hasCustomChannels;
|
|
||||||
allowedChannels = null;
|
|
||||||
} else {
|
|
||||||
prefix = guild.server.prefix;
|
|
||||||
customRoleStatus = guild.server.hasCustomRoles;
|
|
||||||
customChannelStatus = guild.server.hasCustomChannels;
|
|
||||||
if (guild.server.allowedChannels!=undefined||guild.server.allowedChannels!=null&&guild.server.allowedChannels.length>0) {
|
|
||||||
allowedChannels = guild.server.allowedChannels;
|
|
||||||
} else allowedChannels = null;
|
|
||||||
}
|
|
||||||
let guildData = {
|
|
||||||
prefix: prefix,
|
|
||||||
channelId: channelId,
|
|
||||||
customRoleStatus: customRoleStatus,
|
|
||||||
customChannelStatus: allowedChannels,
|
|
||||||
guildId: GuildId
|
|
||||||
}
|
|
||||||
return guildData;
|
|
||||||
}
|
|
||||||
|
|
||||||
log(Text) {
|
|
||||||
this.logger.log(Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
sendError(Channel, Error) {
|
|
||||||
let embed = new MessageEmbed()
|
|
||||||
.setTitle("An error occured")
|
|
||||||
.setColor("RED")
|
|
||||||
.setDescription(Error)
|
|
||||||
.setFooter(
|
|
||||||
"If you think this as a bug, please report it in the support server!"
|
|
||||||
);
|
|
||||||
|
|
||||||
Channel.send(embed);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
build() {
|
|
||||||
this.login(this.config.Token);
|
|
||||||
}
|
|
||||||
|
|
||||||
// main() {
|
|
||||||
// client.on('ready', () => {
|
|
||||||
// console.log(`Logged in as ${client.user.tag}`);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Basic Commands
|
|
||||||
// client.on('message', async (message) => {
|
|
||||||
// let { prefix, channelId, customRoleStatus, customChannelStatus, allowedChannels } = await this.getGuildPresets(message);
|
|
||||||
// if (!message.content.startsWith(prefix) || message.author.bot) return;
|
|
||||||
|
|
||||||
// if (customChannelStatus==true&&!allowedChannels.includes(message.channel.id)) {
|
|
||||||
// return message.channel.send(`This is not the preferred channel, please one of the allowed channels. Use \`${prefix}channels\` to see a list of allowed channels ${message.author}`);
|
|
||||||
// }
|
|
||||||
// const args = message.content.slice(prefix.length).trim().split(' ');
|
|
||||||
// const command = args.shift().toLowerCase();
|
|
||||||
|
|
||||||
// // Valid Statuses Embed
|
|
||||||
// const validStatus = new MessageEmbed()
|
|
||||||
// .setColor('#0099ff')
|
|
||||||
// .setTitle('Lines Police CAD')
|
|
||||||
// .setURL('https://www.linespolice-cad.com/')
|
|
||||||
// .setAuthor('LPS Website Support', 'https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png', 'https://discord.gg/jgUW656v2t')
|
|
||||||
// .setDescription('Valid Statuses')
|
|
||||||
// .addFields(
|
|
||||||
// { name: 'Statuses:', value: `
|
|
||||||
// 10-8 | \`On Duty\`
|
|
||||||
// 10-7 | \`Off Duty\`
|
|
||||||
// 10-6 | \`Busy\`
|
|
||||||
// 10-11 | \`Traffic Stop\`
|
|
||||||
// 10-23 | \`Arrive on Scene\`
|
|
||||||
// 10-97 | \`In Route\`
|
|
||||||
// 10-15 | \`Subject in Custody\`
|
|
||||||
// 10-70 | \`Foot Pursuit\`
|
|
||||||
// 10-80 | \`Vehicle Pursiut\`
|
|
||||||
// `
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
|
|
||||||
// // Help Embed
|
|
||||||
// const help = new MessageEmbed()
|
|
||||||
// .setColor('#0099ff')
|
|
||||||
// .setTitle('**Commands:**')
|
|
||||||
// .setURL('https://discord.gg/w2g2FFmHbF')
|
|
||||||
// .setAuthor('LPS Website & Bot Support', 'https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png', 'https://discord.gg/jgUW656v2t')
|
|
||||||
// .setDescription('Lines Police CAD Bot Commands')
|
|
||||||
// .addFields({
|
|
||||||
// name: `**__Bot Commands:__**`,
|
|
||||||
// value: `
|
|
||||||
// **${prefix}help** - \`Displays this help page\`
|
|
||||||
// **${prefix}stats** - \`Displays current Bot statistics\`
|
|
||||||
// **${prefix}ping** - \`Responds with Pong to check Bot responce\`
|
|
||||||
// `,
|
|
||||||
// inline: false
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: `**__LPC Commands (1/2):__**`,
|
|
||||||
// value: `
|
|
||||||
// **${prefix}login** - \`Redirects you to connect your discord to LPC(DM only)\`
|
|
||||||
// **${prefix}logout** - \`Logs out of your current logged in account\`
|
|
||||||
// **${prefix}validStatus** - \`Shows list of valid statuses to updade to\`
|
|
||||||
// **${prefix}checkStatus** <user> - \`Check your own or other status\`
|
|
||||||
// **${prefix}updateStatus** <status> - \`Updates your status\`
|
|
||||||
// **${prefix}account** - \`returns logged in account\`
|
|
||||||
// **${prefix}penalCodes** - \`Provides Link to penal codes\`
|
|
||||||
// **${prefix}namedb** <firstName> <lastName> <dob> - \`Searches for Civilian by Name\`
|
|
||||||
// **${prefix}platedb** <licence plate #> - \`Searches for Vehicle by Licence Plate #\`
|
|
||||||
// **${prefix}firearmdb** <Serial #> - \`Searches for Firearms by Serial #\`
|
|
||||||
// **${prefix}panic** - \`Enables/Disables your panic button\`
|
|
||||||
// **${prefix}license** <revoke|reinstate> <firstName> <lastName> <dob> - \`Revoke/Reinstate License\`
|
|
||||||
// `,
|
|
||||||
// inline: true
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: `**__LPC Command (2/2):__**`,
|
|
||||||
// value: `
|
|
||||||
// **${prefix}roles** - \`Shows a list of allowed roles\`
|
|
||||||
// **${prefix}channels** - \`Shows a list of allowed channels\`
|
|
||||||
// **${prefix}joincommunity** <community code> - \`Joins a community with the given code\`
|
|
||||||
// **${prefix}leavecommunity** - \`Leaves your current active community\`
|
|
||||||
// **${prefix}community** - \`Returns the name of the Community your currenty in\`
|
|
||||||
// `,
|
|
||||||
// inline: false
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: `**__Admin Commands:__**`,
|
|
||||||
// value: `
|
|
||||||
// **${prefix}setPrefix** <new prefix> - \`Sets new prefix\`
|
|
||||||
// **${prefix}setChannel** <channel> - \`Adds channel to list of allowed channels\`
|
|
||||||
// **${prefix}removeChannel** <channel> - \`Removes channel from list of allowed channels\`
|
|
||||||
// **${prefix}setRole** <role> - \`Adds role to list of allowed roles\`
|
|
||||||
// **${prefix}removeRole** <role> - \`Removes role from list of allowed roles\`
|
|
||||||
// **${prefix}togglePingOnPanic** <true|false> <role> - \`Enable/disable ping role on panic\`
|
|
||||||
// `,
|
|
||||||
// inline: false
|
|
||||||
// })
|
|
||||||
|
|
||||||
// const stats = new MessageEmbed()
|
|
||||||
// .setColor('#0099ff')
|
|
||||||
// .setTitle("Current LPC-Bot Statistics")
|
|
||||||
// .setURL('https://discord.gg/w2g2FFmHbF')
|
|
||||||
// .addField(" \u200B ", "**Channels** : ` " + `${client.channels.cache.size}` + " `")
|
|
||||||
// .addField(" \u200B ", "**Servers** : ` " + `${client.guilds.cache.size}` + " `")
|
|
||||||
// .addField(" \u200B ", "**Users** : ` " + `${client.users.cache.size}` + " `")
|
|
||||||
|
|
||||||
// if (command == 'ping') return message.channel.send('Pong!');
|
|
||||||
// if (command == 'help') return message.channel.send(help);
|
|
||||||
// if (command == 'stats') return message.channel.send(stats);
|
|
||||||
// if (command == 'setprefix') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot set a prefix in a dm ${message.author}`);
|
|
||||||
// if(!message.member.hasPermission(["ADMINISTRATOR","MANAGE_GUILD"])) return message.channel.send(`You don't have permission to used this command ${message.author}`);
|
|
||||||
// this.commandHandler.newPrefix(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'setchannel') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot set a channel in a dm ${message.author}`);
|
|
||||||
// if (!message.member.hasPermission(["ADMINISTRATOR","MANAGE_GUILD"])) return message.channel.send(`You don't have permission to used this command ${message.author}`);
|
|
||||||
// this.commandHandler.setChannel(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'removechannel') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot remove a channel in a dm ${message.author}`);
|
|
||||||
// if (!message.member.hasPermission(["ADMINISTRATOR","MANAGE_GUILD"])) return message.channel.send(`You don't have permission to used this command ${message.author}`);
|
|
||||||
// this.commandHandler.removeChannel(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'setrole') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot set a role in a dm ${message.author}`);
|
|
||||||
// if (!message.member.hasPermission(["ADMINISTRATOR","MANAGE_GUILD"])) return message.channel.send(`You don't have permission to used this command ${message.author}`);
|
|
||||||
// this.commandHandler.setRole(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'removerole') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot remove a role in a dm ${message.author}`);
|
|
||||||
// if (!message.member.hasPermission(["ADMINISTRATOR","MANAGE_GUILD"])) return message.channel.send(`You don't have permission to used this command ${message.author}`);
|
|
||||||
// this.commandHandler.removeRole(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'togglepingonpanic') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot remove a role in a dm ${message.author}`);
|
|
||||||
// if (!message.member.hasPermission(["ADMINISTRATOR","MANAGE_GUILD"])) return message.channel.send(`You don't have permission to used this command ${message.author}`);
|
|
||||||
// this.commandHandler.togglePingOnPanic(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'roles') {
|
|
||||||
// if (message.channel.type=="dm") return message.author.send(`You cannot see allowed roles in a dm ${message.author}`);
|
|
||||||
// this.commandHandler.roles(message);
|
|
||||||
// }
|
|
||||||
// if (command == 'channels') {
|
|
||||||
// if (message.channel.type=="dm") return message.channel.send(`You cannot see allowed channels in a dm ${message.author}`);
|
|
||||||
// this.commandHandler.channels(message);
|
|
||||||
// }
|
|
||||||
// if (command == 'pingonpanic') {
|
|
||||||
// if (message.channel.type=="dm") return message.channel.send(`You cannot see allowed channels in a dm ${message.author}`);
|
|
||||||
// this.commandHandler.getPingOnPanicStatus(message);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Login
|
|
||||||
// if (command == 'login') {
|
|
||||||
// if (message.channel.type=="text") return message.channel.send(`You must direct message me to use this command ${message.author}`);
|
|
||||||
// this.commandHandler.remoteLogin(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'logout') this.commandHandler.remoteLogout(message);
|
|
||||||
// if (command == 'validstatus') return message.channel.send(validStatus);
|
|
||||||
// if (command == 'checkstatus') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.commandHandler.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.checkStatus(message, args);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}`);
|
|
||||||
// } else this.commandHandler.checkStatus(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'updatestatus') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.commandHandler.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.updateStatus(message, args, prefix);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}`);
|
|
||||||
// } else this.commandHandler.updateStatus(message, args, prefix);
|
|
||||||
// }
|
|
||||||
// if (command == 'account') this.commandHandler.account(message);
|
|
||||||
// if (command == 'penalcodes') return message.channel.send('https://www.linespolice-cad.com/penal-code');
|
|
||||||
// if (command == 'namedb') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.commandHandler.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.nameSearch(message, args);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}`);
|
|
||||||
// } else this.commandHandler.nameSearch(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'platedb') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.commandHandler.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.plateSearch(message, args);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}`);
|
|
||||||
// } else this.commandHandler.plateSearch(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'firearmdb') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.firearmSearch(message, args);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}`);
|
|
||||||
// } else this.commandHandler.firearmSearch(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'panic') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.commandHandler.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.enablePanic(message);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}`);
|
|
||||||
// } else this.commandHandler.enablePanic(message);
|
|
||||||
// }
|
|
||||||
// if (command == 'license') {
|
|
||||||
// if (customRoleStatus) {
|
|
||||||
// let hasRole = await this.commandHandler.checkRoleStatus(message);
|
|
||||||
// if (hasRole) {
|
|
||||||
// this.commandHandler.updateLicense(message, args);
|
|
||||||
// } else return message.channel.send(`You don't have permission to use this command ${message.author}! `);
|
|
||||||
// } else this.commandHandler.updateLicense(message, args);
|
|
||||||
// }
|
|
||||||
// if (command == 'joincommunity') this.commandHandler.joinCommunity(message, args);
|
|
||||||
// if (command == 'leavecommunity') this.commandHandler.leaveCommunity(message);
|
|
||||||
// if (command == 'community') this.commandHandler.community(message);
|
|
||||||
|
|
||||||
// // Dev Commands (not visible in help) && easter egg commands
|
|
||||||
// if (command == 'version') message.channel.send(`**LPS-BOT Version : ${this.dev}-${this.config.version}**`)
|
|
||||||
// if (command == 'whatisthemeaningoflife') message.channel.send('42');
|
|
||||||
// if (command == 'whatareyou' || command == 'whoareyou') message.channel.send('Im your friendly neighborhood Lines Police CAD Bot');
|
|
||||||
// if (command == 'whocreatedyou') message.channel.send('Lines Police CAD Developer McDazzzled | https://github.com/SowinskiBraeden');
|
|
||||||
// if (command == 'pingserver') {
|
|
||||||
// const socket = io.connect(this.config.socket);
|
|
||||||
// socket.emit('botping', {message:'hello there'});
|
|
||||||
// socket.on('botpong', (data) => {
|
|
||||||
// console.log(data);
|
|
||||||
// message.channel.send(`Debug: Server responded`)
|
|
||||||
// socket.disconnect();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {LinesPoliceCadBot};
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Client has been logged in"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Client has been logged in"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Interaction"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\commands'"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\events'"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\commands'"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\events'"}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "account",
|
||||||
|
description: "View connected Lines Police CAD account",
|
||||||
|
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==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: {
|
||||||
|
options: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
|
||||||
|
if (user==null) return interaction.send(`You are not logged in.`);
|
||||||
|
client.users.fetch(interaction.member.user.id)
|
||||||
|
.then(duser => duser.send(`<@${interaction.member.user.id}> Logged in as **${user.user.username}** | **${user.user.email}**`).catch(err => {client.log(err)}))
|
||||||
|
.catch(err => {client.log(err)});
|
||||||
|
return
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "channels",
|
||||||
|
description: "View a list of allowed channels",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
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: {
|
||||||
|
options: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
|
if (guild.server.hasCustomChannels==false) {
|
||||||
|
return interaction.send('There are no channels set for the bot.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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 interaction.send({ embeds: [channelsEmbed] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "checkstatus",
|
||||||
|
description: "Check your own or another officer status",
|
||||||
|
usage: "[user]",
|
||||||
|
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 }) => {
|
||||||
|
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);
|
||||||
|
console.log(targetUserID, targetUser);
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "user",
|
||||||
|
description: "Discord Username",
|
||||||
|
value: "user",
|
||||||
|
type: 6,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
|
||||||
|
if (!user) return interaction.send(`You are not logged in.`);
|
||||||
|
if (user.user.activeCommunity == null) return interaction.send(`You must join a community to use this command.`);
|
||||||
|
if (!client.exists(args)) {
|
||||||
|
return interaction.send(`<@${interaction.member.user.id}>'s status: \`${user.user.dispatchStatus}\` | Set by: \`${user.user.dispatchStatusSetBy}\``);
|
||||||
|
} else {
|
||||||
|
let targetUserID = args[0].value.replace('<@!', '').replace('>', '');
|
||||||
|
let targetUser = await client.dbo.collection("users").findOne({"user.discord.id":targetUserID}).then(user => user);
|
||||||
|
// This lame line of code to get username without ping on discord
|
||||||
|
const User = client.users.cache.get(targetUserID);
|
||||||
|
console.debug(targetUserID, targetUser, User);
|
||||||
|
if (!targetUser) return message.channel.send(`Cannot find **${args[0].value}** <@${interaction.member.user.id}>`);
|
||||||
|
if (targetUser.user.activeCommunity!=user.user.activeCommunity) {
|
||||||
|
return interaction.send(`You are not in the same community as \`${User.tag}\` <@${interaction.member.user.id}>`);
|
||||||
|
}
|
||||||
|
return interaction.send(`<@${interaction.member.user.id}>, \`${User.tag}'s\` status: \`${targetUser.user.dispatchStatus}\` | Set by: \`${targetUser.user.dispatchStatusSetBy}\``);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "community",
|
||||||
|
description: "Check active community",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
|
||||||
|
if (!user) return interaction.send(`You are not logged in.`);
|
||||||
|
if (user.user.activeCommunity==null) return 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 interaction.send(`Community not found.`);
|
||||||
|
return interaction.send(`You are in the community \`${community.community.name}\``);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "debug",
|
||||||
|
description: "Debug for bot admin",
|
||||||
|
usage: "command",
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "command",
|
||||||
|
description: "The debug command to execute",
|
||||||
|
value: "command",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "consoleoutput",
|
||||||
|
description: "Output debug messages to console (deault=false)",
|
||||||
|
value: "consoleoutput",
|
||||||
|
type: 5,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (!client.config.Admins.includes(interaction.member.user.id)) return;
|
||||||
|
|
||||||
|
if (args.length==0) return message.channel.send('Debug Error: Provide a debug command');
|
||||||
|
if (!client.exists(args[0].value)) return interaction.send('Debug Error: Provide a valid debug command');
|
||||||
|
|
||||||
|
let debugConsole = args[1].value;
|
||||||
|
|
||||||
|
let command = args[0].value.toLowerCase();
|
||||||
|
|
||||||
|
if (command == 'server' || args[0] == 'guild') {
|
||||||
|
if (debugConsole) client.log("Debug: Guild >> ");console.debug(GuildDB);
|
||||||
|
return interaction.send("Debug: guild >> read log output")
|
||||||
|
|
||||||
|
} else if (command == "interaction") {
|
||||||
|
if (debugConsole) {
|
||||||
|
client.log("Debug: interaction >> ");
|
||||||
|
console.debug(interaction);
|
||||||
|
}
|
||||||
|
return interaction.send("Debug: interaction >> read log output");
|
||||||
|
|
||||||
|
} else if (command == "message") {
|
||||||
|
return interaction.send(`Use command with prefix to debug \`message\``);
|
||||||
|
|
||||||
|
} else if (command == "pingserver") {
|
||||||
|
const socket = io.connect(client.config.socket);
|
||||||
|
socket.emit('botping', {message:'hello there'});
|
||||||
|
socket.on('botpong', (data) => {
|
||||||
|
if (debugConsole) client.log('Debug: Socket responded')
|
||||||
|
return interaction.send(`Debug: Socket responded`)
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (command == "apicheck") {
|
||||||
|
// TODO: Make axios call to api and get api health
|
||||||
|
return interaction.send('Debug Notice: \`apicheck\` is currently unavailable');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return interaction.send('Debug Error: Provide a valid debug command');
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "firearmsearch",
|
||||||
|
description: "Search registered firearms",
|
||||||
|
usage: "[Serial #]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "serialnumber",
|
||||||
|
description: "Firearms's serial number",
|
||||||
|
value: "serialnumber",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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.`);
|
||||||
|
let data = {
|
||||||
|
user: user,
|
||||||
|
query: {
|
||||||
|
serialNumber: args[0].value,
|
||||||
|
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 interaction.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});
|
||||||
|
interaction.send(firearmResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
+15
-13
@@ -11,19 +11,17 @@ module.exports = {
|
|||||||
aliases: ["command", "commands", "cmd"],
|
aliases: ["command", "commands", "cmd"],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, message, args, { GuildDB }) => {
|
run: async (client, message, args, { GuildDB }) => {
|
||||||
let Commands = client.commands.map(
|
let Commands = client.commands.map((cmd) =>
|
||||||
(cmd) =>
|
cmd.name != 'debug' ? `\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||||
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
|
||||||
cmd.name
|
cmd.name
|
||||||
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}`
|
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` : null
|
||||||
);
|
);
|
||||||
|
|
||||||
let Embed = new MessageEmbed()
|
let Embed = new MessageEmbed()
|
||||||
.setAuthor(
|
.setAuthor(
|
||||||
`Commands of ${client.user.username}`,
|
`Commands of ${client.user.username}`,
|
||||||
@@ -37,7 +35,9 @@ module.exports = {
|
|||||||
).setDescription(`${Commands.join("\n")}
|
).setDescription(`${Commands.join("\n")}
|
||||||
|
|
||||||
Lines Police CAD Bot Version: v${client.config.Version}`);
|
Lines Police CAD Bot Version: v${client.config.Version}`);
|
||||||
if (!args[0]) message.channel.send(Embed);
|
if (!args[0]) {
|
||||||
|
message.channel.send({ embeds: [Embed] });
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
let cmd =
|
let cmd =
|
||||||
client.commands.get(args[0]) ||
|
client.commands.get(args[0]) ||
|
||||||
@@ -75,7 +75,7 @@ module.exports = {
|
|||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
|
|
||||||
message.channel.send(embed);
|
message.channel.send({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -91,18 +91,20 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
let Commands = client.commands.map(
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
(cmd) =>
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
}
|
||||||
|
let Commands = client.commands.map((cmd) =>
|
||||||
|
cmd.name != 'debug' ? `\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||||
cmd.name
|
cmd.name
|
||||||
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}`
|
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` : null
|
||||||
);
|
);
|
||||||
|
|
||||||
let Embed = new MessageEmbed()
|
let Embed = new MessageEmbed()
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "joincommunity",
|
||||||
|
description: "Join a community",
|
||||||
|
usage: "[code]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "code",
|
||||||
|
description: "Join community with community code",
|
||||||
|
value: "code",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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.`);
|
||||||
|
let myReq = {
|
||||||
|
userID: user._id,
|
||||||
|
communityCode: args[0].value
|
||||||
|
};
|
||||||
|
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 interaction.send(`${data.error}`);
|
||||||
|
}
|
||||||
|
return interaction.send(`Successfully joined the community \` ${data.commName} \``)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "leavecommunity",
|
||||||
|
description: "Leave your active community",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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.`);
|
||||||
|
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 interaction.send(`${data.error}`);
|
||||||
|
}
|
||||||
|
return interaction.send(`${data.message}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "login",
|
||||||
|
description: "Connect your Lines Police CAD account to Discord",
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
interaction.send('Login from Lines Police CAD account management https://www.linespolice-cad.com/');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "logout",
|
||||||
|
description: "Disconnect your Lines Police CAD account from Discord",
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
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.`);
|
||||||
|
client.dbo.collection("users").updateOne({"user.discord.id":interaction.member.user.id},{$unset:{"user.discord":""}, $set:{"user.discordConnected":false}},function(err,res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Succesfully disconnected you Discord account.`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "namesearch",
|
||||||
|
description: "Search a civilian",
|
||||||
|
usage: "[First Name] [Last Name] [yyyy-mm-dd]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "firstname",
|
||||||
|
description: "Civilian's First Name",
|
||||||
|
value: "firstname",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "lastname",
|
||||||
|
description: "Civilian's Last Name",
|
||||||
|
value: "lastname",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "dob",
|
||||||
|
description: "Civilian's DOB (yyyy-mm-dd)",
|
||||||
|
value: "dob",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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.`);
|
||||||
|
let data;
|
||||||
|
|
||||||
|
data = {
|
||||||
|
user: user,
|
||||||
|
query: {
|
||||||
|
firstName: args[0].value,
|
||||||
|
lastName: args[1].value,
|
||||||
|
dateOfBirth: args[2].value,
|
||||||
|
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 interaction.send(`Name \`${args[0].value} ${args[1].value}\` not found.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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});
|
||||||
|
interaction.send(nameResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "panic",
|
||||||
|
description: "Enables users panic button",
|
||||||
|
permissions: {
|
||||||
|
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 {
|
||||||
|
client.forceUpdateStatus(message.channel, message.author.id, 'Panic');
|
||||||
|
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
|
||||||
|
if (!user) return interaction.send(`You are not logged in.`);
|
||||||
|
if (user.user.activeCommunity==null) return interaction.send(`You must join a community to use this command.`);
|
||||||
|
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) => {
|
||||||
|
interaction.send(`Disabled Panic <@${interaction.member.user.id}> and set status to \`10-8\`.`);
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
// If panic is disabled, enable panic
|
||||||
|
} else {
|
||||||
|
client.forceUpdateStatus(interaction, interaction.member.user.id, 'Panic');
|
||||||
|
|
||||||
|
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":GuildDB.serverID}).then(guild => guild);
|
||||||
|
if (guild.server.pingOnPanic) return message.channel.send(`Attention <@&${guild.server.pingRole}>! \`${user.user.username}\` has activated panic`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "ping",
|
||||||
|
description: "check the bots responce",
|
||||||
|
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('Pong!');
|
||||||
|
},
|
||||||
|
SlashCommand: {
|
||||||
|
options: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
interaction.send('Pong!');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "pingonpanic",
|
||||||
|
description: "Get ping on panic status",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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.toString().toUpperCase()} \``);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "platesearch",
|
||||||
|
description: "Search for a registered Vehicle",
|
||||||
|
usage: "[Plate #]",
|
||||||
|
permissions: {
|
||||||
|
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) => {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "platenumber",
|
||||||
|
description: "Vehicle's license plate number",
|
||||||
|
value: "platenumber",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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.`);
|
||||||
|
let data = {
|
||||||
|
user: user,
|
||||||
|
query: {
|
||||||
|
plateNumber: args[0].value,
|
||||||
|
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 interaction.send(`Plate Number \`${args[0].value}\` 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 });
|
||||||
|
return interaction.send(plateResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "removechannel",
|
||||||
|
description: "Remove channel from allowed channels",
|
||||||
|
usage: "[channel]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "channel",
|
||||||
|
description: "Channel to remove from allowed channles",
|
||||||
|
value: "channel",
|
||||||
|
type: 7,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length==0) return interaction.send(`You must provide a channel.`);
|
||||||
|
let channelid = args[0].value;
|
||||||
|
let channel = client.channels.cache.get(channelid);
|
||||||
|
if (!channel) return interaction.send(`Uh Oh! The channel <#${args[0].value}> connot be found.`);
|
||||||
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
|
if (guild.server.hasCustomChannels==false) return interaction.send(`There are no channels to be removed.`);
|
||||||
|
if (!guild.server.allowedChannels.includes(channelid)) return interaction.send(`The channel <#${args[0].value}> is not added to your roles.`);
|
||||||
|
for (let i = 0; i < guild.server.allowedChannels.length; i++) {
|
||||||
|
if (guild.server.allowedChannels[i]==channelid) {
|
||||||
|
if ((guild.server.allowedChannels.length-1)==0) {
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":false}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully removed <#${args[0].value}> from allowed channels! There are no more allowed channels.`);
|
||||||
|
});
|
||||||
|
} else if ((guild.server.allowedChannels.length-1)>0) {
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedChannels":channelid}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully removed <#${args[0].value}> from allowed channels.`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "removerole",
|
||||||
|
description: "Remove a role allowed to use the bot",
|
||||||
|
usage: "[role]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "role",
|
||||||
|
description: "Role to remove from allowed roles",
|
||||||
|
value: "role",
|
||||||
|
type: 8,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let roleid = args[0].value;
|
||||||
|
let role = interaction.guild.roles.cache.find(x => x.id == roleid);
|
||||||
|
if (role == undefined) {
|
||||||
|
return interaction.send(`Uh Oh! The role <@&${args[0].value}> connot be found.`);
|
||||||
|
} else {
|
||||||
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
|
if (guild.server.hasCustomRoles==false) return interaction.send(`There are no roles to be removed.`);
|
||||||
|
if (!guild.server.allowedRoles.includes(roleid)) return interaction.send(`The role <@&${args[0].value}> is not added to your roles.`);
|
||||||
|
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
||||||
|
if (guild.server.allowedRoles[i]==roleid) {
|
||||||
|
if ((guild.server.allowedRoles.length-1)==0) {
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":false}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully removed <@&${args[0].value}> from allowed roles! There are no more allowed roles.`);
|
||||||
|
});
|
||||||
|
} else if ((guild.server.allowedRoles.length-1)>0) {
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedRoles":roleid}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully removed <@&${args[0].value}> from allowed roles.`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "roles",
|
||||||
|
description: "View allowed roles",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
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: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
|
if (guild.server.hasCustomRoles==false) {
|
||||||
|
return interaction.send('There are no roles set for the bot.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let roles = ``;
|
||||||
|
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
||||||
|
if (guild.server.allowedRoles[i] == undefined) break;
|
||||||
|
let role = interaction.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 interaction.send({ embeds: [rolesEmbed] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "setchannel",
|
||||||
|
description: "Add channel to allowed channels",
|
||||||
|
usage: "[channel]",
|
||||||
|
permissions: {
|
||||||
|
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) => {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "channel",
|
||||||
|
description: "Channel to add to allowed channles",
|
||||||
|
value: "channel",
|
||||||
|
type: 7,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let channelid = args[0].value;
|
||||||
|
let channel = client.channels.cache.get(channelid);
|
||||||
|
if (!channel) return message.channel.send(`Cannot find that channel.`);
|
||||||
|
if (channel.type=="voice") return interaction.send(`Connot set voice channel to preferred channel.`);
|
||||||
|
if (channel.deleted) return interaction.send(`Connot set deleted channel to preferred channel.`);
|
||||||
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
|
if (exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return interaction.send(`The channel <#${args[0].value}> has already been added.`);
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$push:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":true}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully added <#${args[0].value}> to allowed channels.`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "setprefix",
|
||||||
|
description: "Update prefix for the bot",
|
||||||
|
usage: "[new Prefix]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "new-prefix",
|
||||||
|
description: "Update prefix for the bot",
|
||||||
|
value: "setprefix",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
if (args[0].length<1) return interaction.send('Your new prefix must be \`1\` character!')
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.prefix":args[0].value}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
interaction.send(`The new prefix is now **\`${args[0].value}\`**`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "setrole",
|
||||||
|
description: "Add a role allowed to use the bot",
|
||||||
|
usage: "[role]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "role",
|
||||||
|
description: "Role to add to allowed roles",
|
||||||
|
value: "role",
|
||||||
|
type: 8,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let roleid = args[0].value;
|
||||||
|
let role = interaction.guild.roles.cache.find(x => x.id == roleid);
|
||||||
|
if (role == undefined) {
|
||||||
|
return interaction.send(`Uh Oh! The role <@&${args[0].value}> connot be found.`);
|
||||||
|
} else {
|
||||||
|
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||||
|
if (exists(guild.server.allowedRoles)&&guild.server.allowedRoles.includes(roleid)) return interaction.send(`The role <@&${args[0].value}> has already been added.`);
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$push:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":true}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully added <@&${args[0].value}> to allowed roles.`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
+10
-7
@@ -12,7 +12,7 @@ module.exports = {
|
|||||||
aliases: ["stat", "statistics", "info"],
|
aliases: ["stat", "statistics", "info"],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
@@ -21,30 +21,33 @@ module.exports = {
|
|||||||
const stats = new MessageEmbed()
|
const stats = new MessageEmbed()
|
||||||
.setColor('#0099ff')
|
.setColor('#0099ff')
|
||||||
.setTitle("Current LPC-Bot Statistics")
|
.setTitle("Current LPC-Bot Statistics")
|
||||||
.setURL('https://discord.gg/w2g2FFmHbF')
|
.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}` + " `")
|
||||||
return message.channel.send(stats)
|
return message.channel.send({ embeds: [stats] });
|
||||||
},
|
},
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
const { version } = require("discord.js");
|
const { version } = require("discord.js");
|
||||||
const stats = new MessageEmbed()
|
const stats = new MessageEmbed()
|
||||||
.setColor('#0099ff')
|
.setColor('#0099ff')
|
||||||
.setTitle("Current LPC-Bot Statistics")
|
.setTitle("Current LPC-Bot Statistics")
|
||||||
.setURL('https://discord.gg/w2g2FFmHbF')
|
.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}` + " `")
|
||||||
return message.channel.send(stats)
|
interaction.send(stats)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "togglepingonpanic",
|
||||||
|
description: "Enable or Disable ping on panic",
|
||||||
|
usage: "[true/false] [role]",
|
||||||
|
permissions: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "toggle",
|
||||||
|
description: "Toggle ping on panic",
|
||||||
|
value: "toggle",
|
||||||
|
type: 5,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "role",
|
||||||
|
description: "Role to ping on panic",
|
||||||
|
value: "role",
|
||||||
|
type: 8,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!args[0].value) {
|
||||||
|
// disable ping on panic and remove ping role
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.pingOnPanic":false,"server.pingRole":null}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully disabled ping role on panic.`);
|
||||||
|
});
|
||||||
|
} else if (args[0].value) {
|
||||||
|
let roleid = args[1].value;
|
||||||
|
let role = interaction.guild.roles.cache.find(x => x.id == roleid);
|
||||||
|
if (role == undefined) {
|
||||||
|
return interaction.send(`Uh Oh! The role <@&${args[1].value}> connot be found.`);
|
||||||
|
} else {
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.pingRole":roleid,"server.pingOnPanic":true}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
return interaction.send(`Successfully set <@&${args[1].value}> to be pinged on panic.`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "updatelicense",
|
||||||
|
description: "Update Drivers License Status",
|
||||||
|
usage: "[firstName] [lastName] [DOB]",
|
||||||
|
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) => {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "firstname",
|
||||||
|
description: "Civilian's First Name",
|
||||||
|
value: "firstname",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "lastname",
|
||||||
|
description: "Civilian's Last Name",
|
||||||
|
value: "lastname",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "dob",
|
||||||
|
description: "Civilian's DOB (yyyy-mm-dd)",
|
||||||
|
value: "dob",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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.`);
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
user: user,
|
||||||
|
query: {
|
||||||
|
firstName: args[0].value,
|
||||||
|
lastName: args[1].value,
|
||||||
|
dateOfBirth: args[2].value,
|
||||||
|
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 interaction.send(`Name \`${args[0].value} ${args[1].value}\` 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")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
interaction.send({ embeds: [nameResult], components: [row] });
|
||||||
|
|
||||||
|
client.on("interactionCreate", 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: [] });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "updatestatus",
|
||||||
|
description: "Change User status",
|
||||||
|
usage: "[status]",
|
||||||
|
permissions: {
|
||||||
|
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) => {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
name: "status",
|
||||||
|
description: "New Status Value",
|
||||||
|
value: "status",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
choices: [
|
||||||
|
{ name: '10-8 (In Service)', value: '10-8', }, { name: '10-7 (Out of Service)', value: '10-7', }, { name: '10-6 (Busy)', value: '10-6', },
|
||||||
|
{ name: '10-11 (Traffic Stop)', value: '10-11', }, { name: '10-23 (Arrive on Scene', value: '10-23', }, { name: '10-97 (In Route)', value: '10-97' },
|
||||||
|
{ name: '10-15 (Subject in Custody)', value: '10-15', }, { name: '10-70 (Foot Pursuit)', value: '10-70', }, { name: '10-80 (Vehicle Pursuit)', value: '10-80' },
|
||||||
|
{ name: '10-41 (Log in to CAD)', value: '10-41', }, { name: '10-42 (Log out of CAD)', value: '10-42' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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 ${message.author}`);
|
||||||
|
if (user.user.activeCommunity==null) return message.channel.send(`You must join a community to use this command.`);
|
||||||
|
let onDuty=null;
|
||||||
|
let updateDuty=false;
|
||||||
|
let status = args[0].value;
|
||||||
|
if (args[0].value=='10-41') {
|
||||||
|
onDuty=true;
|
||||||
|
updateDuty=true;
|
||||||
|
status='Online';
|
||||||
|
}
|
||||||
|
if (args[0].value=='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) => {
|
||||||
|
interaction.send(`Succesfully updated <@${interaction.member.user.id}>'s status to \`${args[0].value}\``);
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
Dev: "DEVELOPMENT",
|
Dev: "DEVELOPMENT",
|
||||||
Version: "2.0.0 Beta",
|
Version: "3.0.0 Beta",
|
||||||
Admins: ["userID", "userID"], // Admins of the bot
|
Admins: ["362791661274660874"], // Admins of the bot
|
||||||
defaultPrefix: "?",
|
defaultPrefix: "?",
|
||||||
socket: "https://www.linespolice-cad.com/",
|
socket: "https://police-cad-dev.herokuapp.com/",
|
||||||
SupportServer: "https://discord.gg/w2g2FFmHbF", //Support Server Link
|
SupportServer: "https://discord.gg/w2g2FFmHbF", //Support Server Link
|
||||||
Token: process.env.TOKEN || "", //Discord Bot Token
|
Token: process.env.TOKEN || "", //Discord Bot Token
|
||||||
Scopes: ["identify", "guilds", "applications.commands"], //Discord OAuth2 Scopes
|
Scopes: ["identify", "guilds", "applications.commands"], //Discord OAuth2 Scopes
|
||||||
IconURL: "https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png",
|
IconURL: "https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-cad.png",
|
||||||
EmbedColor: "#0099ff",
|
EmbedColor: "#0099ff",
|
||||||
Permissions: 2205281600,
|
Permissions: 2205281600,
|
||||||
Website: "https://linespolice-cad.com",
|
Website: "https://linespolice-cad.com",
|
||||||
@@ -19,6 +19,6 @@ module.exports = {
|
|||||||
Presence: {
|
Presence: {
|
||||||
status: "online", // You can show online, idle, and dnd
|
status: "online", // You can show online, idle, and dnd
|
||||||
name: "GTA V", // The message shown
|
name: "GTA V", // The message shown
|
||||||
type: "Playing", // PLAYING, WATCHING, LISTENING, STREAMING
|
type: "PLAYING", // PLAYING, WATCHING, LISTENING, STREAMING
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
+5
-5
@@ -1,13 +1,13 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
Dev: "PRODUCTION",
|
Dev: "PRODUCTION",
|
||||||
Version: "2.0.0",
|
Version: "3.0.0",
|
||||||
Admins: ["userID", "userID"], // Admins of the bot
|
Admins: ["362791661274660874"], // Admins of the bot
|
||||||
defaultPrefix: "?",
|
defaultPrefix: "?",
|
||||||
socket: "https://www.linespolice-cad.com/",
|
socket: "https://linespolice-cad.com/",
|
||||||
SupportServer: "https://discord.gg/w2g2FFmHbF", //Support Server Link
|
SupportServer: "https://discord.gg/w2g2FFmHbF", //Support Server Link
|
||||||
Token: process.env.TOKEN || "", //Discord Bot Token
|
Token: process.env.TOKEN || "", //Discord Bot Token
|
||||||
Scopes: ["identify", "guilds", "applications.commands"], //Discord OAuth2 Scopes
|
Scopes: ["identify", "guilds", "applications.commands"], //Discord OAuth2 Scopes
|
||||||
IconURL: "https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png",
|
IconURL: "https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-cad.png",
|
||||||
EmbedColor: "#0099ff",
|
EmbedColor: "#0099ff",
|
||||||
Permissions: 2205281600,
|
Permissions: 2205281600,
|
||||||
Website: "https://linespolice-cad.com",
|
Website: "https://linespolice-cad.com",
|
||||||
@@ -19,6 +19,6 @@ module.exports = {
|
|||||||
Presence: {
|
Presence: {
|
||||||
status: "online", // You can show online, idle, and dnd
|
status: "online", // You can show online, idle, and dnd
|
||||||
name: "GTA V", // The message shown
|
name: "GTA V", // The message shown
|
||||||
type: "Playing", // PLAYING, WATCHING, LISTENING, STREAMING
|
type: "PLAYING", // PLAYING, WATCHING, LISTENING, STREAMING
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {require("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {require("discord.js").Message} message
|
* @param {require("discord.js").message} message
|
||||||
* @returns {void} or nothing if you didn't know
|
* @returns {void} or nothing if you didn't know
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,15 +12,6 @@ module.exports = async (client, message) => {
|
|||||||
let GuildDB = await client.GetGuild(message.guild.id);
|
let GuildDB = await client.GetGuild(message.guild.id);
|
||||||
if (GuildDB && GuildDB.prefix) prefix = GuildDB.prefix;
|
if (GuildDB && GuildDB.prefix) prefix = GuildDB.prefix;
|
||||||
|
|
||||||
//Initialize GuildDB
|
|
||||||
if (!GuildDB) {
|
|
||||||
await client.database.guild.set(message.guild.id, {
|
|
||||||
prefix: prefix,
|
|
||||||
DJ: null,
|
|
||||||
});
|
|
||||||
GuildDB = await client.GetGuild(message.guild.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Prefixes also have mention match
|
//Prefixes also have mention match
|
||||||
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
|
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
|
||||||
prefix = message.content.match(prefixMention)
|
prefix = message.content.match(prefixMention)
|
||||||
@@ -29,6 +20,10 @@ module.exports = async (client, message) => {
|
|||||||
|
|
||||||
if (message.content.indexOf(prefix) !== 0) return;
|
if (message.content.indexOf(prefix) !== 0) return;
|
||||||
|
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(message.channel.id)) {
|
||||||
|
return message.channel.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
||||||
//Making the command lowerCase because our file name will be in lowerCase
|
//Making the command lowerCase because our file name will be in lowerCase
|
||||||
const command = args.shift().toLowerCase();
|
const command = args.shift().toLowerCase();
|
||||||
@@ -50,18 +45,12 @@ module.exports = async (client, message) => {
|
|||||||
cmd.permissions.member &&
|
cmd.permissions.member &&
|
||||||
!message.channel
|
!message.channel
|
||||||
.permissionsFor(message.member)
|
.permissionsFor(message.member)
|
||||||
.has(cmd.permissions.member)) ||
|
.has(cmd.permissions.member))
|
||||||
(cmd.permissions &&
|
|
||||||
GuildDB.DJ &&
|
|
||||||
!message.channel
|
|
||||||
.permissionsFor(message.member)
|
|
||||||
.has(["ADMINISTRATOR"]) &&
|
|
||||||
!message.member.roles.cache.has(GuildDB.DJ))
|
|
||||||
)
|
)
|
||||||
return client.sendError(
|
return client.sendError(
|
||||||
message.channel,
|
message.channel,
|
||||||
"Missing Permissions!" + GuildDB.DJ
|
"Missing Permissions!" + GuildDB.DJ
|
||||||
? " You need the `DJ` role to access this command."
|
? " You need the correct role to access this command."
|
||||||
: ""
|
: ""
|
||||||
);
|
);
|
||||||
cmd.run(client, message, args, { GuildDB });
|
cmd.run(client, message, args, { GuildDB });
|
||||||
+6
-6
@@ -1,12 +1,12 @@
|
|||||||
module.exports = async (client) => {
|
module.exports = async (client) => {
|
||||||
(client.Ready = true),
|
(client.Ready = true),
|
||||||
|
client.user.setActivity(client.config.Presence.name, {
|
||||||
|
type: client.config.Presence.type,
|
||||||
|
})
|
||||||
client.user.setPresence({
|
client.user.setPresence({
|
||||||
status: client.config.Presence.status, // You can show online, idle, and dnd
|
status: client.config.Presence.status, // You can show online, idle, and dnd
|
||||||
activity: {
|
});
|
||||||
name: client.config.Presence.name,
|
client.log(`Successfully Logged in as ${client.user.tag}`); // You can change the text if you want, but DO NOT REMOVE "client.user.tag"
|
||||||
type: client.config.Presence.type,
|
client.log(`Ready to serve in ${client.channels.cache.size} channels on ${client.guilds.cache.size} servers, for a total of ${client.users.cache.size} users.`)
|
||||||
},
|
|
||||||
});
|
|
||||||
client.log("Successfully Logged in as " + client.user.tag); // You can change the text if you want, but DO NOT REMOVE "client.user.tag"
|
|
||||||
client.RegisterSlashCommands();
|
client.RegisterSlashCommands();
|
||||||
};
|
};
|
||||||
Generated
+273
-108
@@ -10,7 +10,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^13.1.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",
|
||||||
@@ -38,10 +38,41 @@
|
|||||||
"kuler": "^2.0.0"
|
"kuler": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@discordjs/builders": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||||
|
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@sindresorhus/is": "^4.0.1",
|
||||||
|
"discord-api-types": "^0.22.0",
|
||||||
|
"ow": "^0.27.0",
|
||||||
|
"ts-mixer": "^6.0.0",
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0",
|
||||||
|
"npm": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@discordjs/builders/node_modules/@sindresorhus/is": {
|
||||||
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@discordjs/collection": {
|
"node_modules/@discordjs/collection": {
|
||||||
"version": "0.1.6",
|
"version": "0.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.4.tgz",
|
||||||
"integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
|
"integrity": "sha512-PVrEJH+V6Ob0OwfagYQ/57kwt/HNEJxt5jqY4P+S3st9y29t9iokdnGMQoJXG5VEMAQIPbzu9Snw1F6yE8PdLA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0",
|
||||||
|
"npm": ">=7.0.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@discordjs/form-data": {
|
"node_modules/@discordjs/form-data": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
@@ -56,6 +87,15 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@sapphire/async-queue": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-z+CDw5X4UgIEpZL8KM+ThVx1i8V60HBg0l/oFewTNbQQeRDJHdVxHyJykv+SF1H+Rc8EkMS81VTWo95jVYgO/g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=v14.0.0",
|
||||||
|
"npm": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sindresorhus/is": {
|
"node_modules/@sindresorhus/is": {
|
||||||
"version": "0.14.0",
|
"version": "0.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||||
@@ -80,22 +120,24 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
|
||||||
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
|
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "17.0.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
|
||||||
|
"integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/ws": {
|
||||||
|
"version": "7.4.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
|
||||||
|
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/abbrev": {
|
"node_modules/abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||||
},
|
},
|
||||||
"node_modules/abort-controller": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
|
||||||
"dependencies": {
|
|
||||||
"event-target-shim": "^5.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/accepts": {
|
"node_modules/accepts": {
|
||||||
"version": "1.3.7",
|
"version": "1.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
@@ -337,6 +379,14 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/callsites": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/camelcase": {
|
"node_modules/camelcase": {
|
||||||
"version": "6.2.0",
|
"version": "6.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
|
||||||
@@ -630,23 +680,32 @@
|
|||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||||
},
|
},
|
||||||
|
"node_modules/discord-api-types": {
|
||||||
|
"version": "0.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
|
||||||
|
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==",
|
||||||
|
"deprecated": "No longer supported. Install the latest release!",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/discord.js": {
|
"node_modules/discord.js": {
|
||||||
"version": "12.5.3",
|
"version": "13.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.1.0.tgz",
|
||||||
"integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
|
"integrity": "sha512-gxO4CXKdHpqA+WKG+f5RNnd3srTDj5uFJHgOathksDE90YNq/Qijkd2WlMgTTMS6AJoEnHxI7G9eDQHCuZ+xDA==",
|
||||||
"deprecated": "no longer supported",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/collection": "^0.1.6",
|
"@discordjs/builders": "^0.5.0",
|
||||||
|
"@discordjs/collection": "^0.2.1",
|
||||||
"@discordjs/form-data": "^3.0.1",
|
"@discordjs/form-data": "^3.0.1",
|
||||||
"abort-controller": "^3.0.0",
|
"@sapphire/async-queue": "^1.1.4",
|
||||||
|
"@types/ws": "^7.4.7",
|
||||||
|
"discord-api-types": "^0.22.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"prism-media": "^1.2.9",
|
"ws": "^7.5.1"
|
||||||
"setimmediate": "^1.0.5",
|
|
||||||
"tweetnacl": "^1.0.3",
|
|
||||||
"ws": "^7.4.4"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.0.0"
|
"node": ">=16.6.0",
|
||||||
|
"npm": ">=7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dot-prop": {
|
"node_modules/dot-prop": {
|
||||||
@@ -785,14 +844,6 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/event-target-shim": {
|
|
||||||
"version": "5.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
|
||||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express": {
|
"node_modules/express": {
|
||||||
"version": "4.17.1",
|
"version": "4.17.1",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
||||||
@@ -1259,6 +1310,11 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lodash.isequal": {
|
||||||
|
"version": "4.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||||
|
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
|
||||||
|
},
|
||||||
"node_modules/logform": {
|
"node_modules/logform": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz",
|
||||||
@@ -1561,6 +1617,61 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ow": {
|
||||||
|
"version": "0.27.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz",
|
||||||
|
"integrity": "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@sindresorhus/is": "^4.0.1",
|
||||||
|
"callsites": "^3.1.0",
|
||||||
|
"dot-prop": "^6.0.1",
|
||||||
|
"lodash.isequal": "^4.5.0",
|
||||||
|
"type-fest": "^1.2.1",
|
||||||
|
"vali-date": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ow/node_modules/@sindresorhus/is": {
|
||||||
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ow/node_modules/dot-prop": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
|
||||||
|
"dependencies": {
|
||||||
|
"is-obj": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ow/node_modules/type-fest": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/p-cancelable": {
|
"node_modules/p-cancelable": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
||||||
@@ -1633,31 +1744,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prism-media": {
|
|
||||||
"version": "1.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.1.tgz",
|
|
||||||
"integrity": "sha512-nyYAa3KB4qteJIqdguKmwxTJgy55xxUtkJ3uRnOvO5jO+frci+9zpRXw6QZVcfDeva3S654fU9+26P2OSTzjHw==",
|
|
||||||
"peerDependencies": {
|
|
||||||
"@discordjs/opus": "^0.5.0",
|
|
||||||
"ffmpeg-static": "^4.2.7 || ^3.0.0 || ^2.4.0",
|
|
||||||
"node-opus": "^0.3.3",
|
|
||||||
"opusscript": "^0.0.8"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@discordjs/opus": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"ffmpeg-static": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"node-opus": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"opusscript": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/process-nextick-args": {
|
"node_modules/process-nextick-args": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
@@ -1955,11 +2041,6 @@
|
|||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/setimmediate": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
|
||||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
|
||||||
},
|
|
||||||
"node_modules/setprototypeof": {
|
"node_modules/setprototypeof": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
||||||
@@ -2184,10 +2265,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
|
||||||
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
|
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
|
||||||
},
|
},
|
||||||
"node_modules/tweetnacl": {
|
"node_modules/ts-mixer": {
|
||||||
"version": "1.0.3",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
|
"integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
|
||||||
|
},
|
||||||
|
"node_modules/tslib": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||||
},
|
},
|
||||||
"node_modules/type-fest": {
|
"node_modules/type-fest": {
|
||||||
"version": "0.20.2",
|
"version": "0.20.2",
|
||||||
@@ -2309,6 +2395,14 @@
|
|||||||
"node": ">= 0.4.0"
|
"node": ">= 0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/vali-date": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vary": {
|
"node_modules/vary": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
@@ -2488,10 +2582,29 @@
|
|||||||
"kuler": "^2.0.0"
|
"kuler": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@discordjs/builders": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||||
|
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||||
|
"requires": {
|
||||||
|
"@sindresorhus/is": "^4.0.1",
|
||||||
|
"discord-api-types": "^0.22.0",
|
||||||
|
"ow": "^0.27.0",
|
||||||
|
"ts-mixer": "^6.0.0",
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@sindresorhus/is": {
|
||||||
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@discordjs/collection": {
|
"@discordjs/collection": {
|
||||||
"version": "0.1.6",
|
"version": "0.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.4.tgz",
|
||||||
"integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
|
"integrity": "sha512-PVrEJH+V6Ob0OwfagYQ/57kwt/HNEJxt5jqY4P+S3st9y29t9iokdnGMQoJXG5VEMAQIPbzu9Snw1F6yE8PdLA=="
|
||||||
},
|
},
|
||||||
"@discordjs/form-data": {
|
"@discordjs/form-data": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
@@ -2503,6 +2616,11 @@
|
|||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@sapphire/async-queue": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-z+CDw5X4UgIEpZL8KM+ThVx1i8V60HBg0l/oFewTNbQQeRDJHdVxHyJykv+SF1H+Rc8EkMS81VTWo95jVYgO/g=="
|
||||||
|
},
|
||||||
"@sindresorhus/is": {
|
"@sindresorhus/is": {
|
||||||
"version": "0.14.0",
|
"version": "0.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||||
@@ -2521,19 +2639,24 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
|
||||||
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
|
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
|
||||||
},
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "17.0.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
|
||||||
|
"integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ=="
|
||||||
|
},
|
||||||
|
"@types/ws": {
|
||||||
|
"version": "7.4.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
|
||||||
|
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"abbrev": {
|
"abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||||
},
|
},
|
||||||
"abort-controller": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
|
||||||
"requires": {
|
|
||||||
"event-target-shim": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"accepts": {
|
"accepts": {
|
||||||
"version": "1.3.7",
|
"version": "1.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
@@ -2725,6 +2848,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"callsites": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
|
||||||
|
},
|
||||||
"camelcase": {
|
"camelcase": {
|
||||||
"version": "6.2.0",
|
"version": "6.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
|
||||||
@@ -2959,19 +3087,24 @@
|
|||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||||
},
|
},
|
||||||
|
"discord-api-types": {
|
||||||
|
"version": "0.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
|
||||||
|
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg=="
|
||||||
|
},
|
||||||
"discord.js": {
|
"discord.js": {
|
||||||
"version": "12.5.3",
|
"version": "13.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.1.0.tgz",
|
||||||
"integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
|
"integrity": "sha512-gxO4CXKdHpqA+WKG+f5RNnd3srTDj5uFJHgOathksDE90YNq/Qijkd2WlMgTTMS6AJoEnHxI7G9eDQHCuZ+xDA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@discordjs/collection": "^0.1.6",
|
"@discordjs/builders": "^0.5.0",
|
||||||
|
"@discordjs/collection": "^0.2.1",
|
||||||
"@discordjs/form-data": "^3.0.1",
|
"@discordjs/form-data": "^3.0.1",
|
||||||
"abort-controller": "^3.0.0",
|
"@sapphire/async-queue": "^1.1.4",
|
||||||
|
"@types/ws": "^7.4.7",
|
||||||
|
"discord-api-types": "^0.22.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"prism-media": "^1.2.9",
|
"ws": "^7.5.1"
|
||||||
"setimmediate": "^1.0.5",
|
|
||||||
"tweetnacl": "^1.0.3",
|
|
||||||
"ws": "^7.4.4"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dot-prop": {
|
"dot-prop": {
|
||||||
@@ -3075,11 +3208,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
||||||
},
|
},
|
||||||
"event-target-shim": {
|
|
||||||
"version": "5.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
|
||||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
|
||||||
},
|
|
||||||
"express": {
|
"express": {
|
||||||
"version": "4.17.1",
|
"version": "4.17.1",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
||||||
@@ -3443,6 +3571,11 @@
|
|||||||
"package-json": "^6.3.0"
|
"package-json": "^6.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"lodash.isequal": {
|
||||||
|
"version": "4.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||||
|
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
|
||||||
|
},
|
||||||
"logform": {
|
"logform": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz",
|
||||||
@@ -3640,6 +3773,39 @@
|
|||||||
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
|
||||||
"integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA=="
|
"integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA=="
|
||||||
},
|
},
|
||||||
|
"ow": {
|
||||||
|
"version": "0.27.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz",
|
||||||
|
"integrity": "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==",
|
||||||
|
"requires": {
|
||||||
|
"@sindresorhus/is": "^4.0.1",
|
||||||
|
"callsites": "^3.1.0",
|
||||||
|
"dot-prop": "^6.0.1",
|
||||||
|
"lodash.isequal": "^4.5.0",
|
||||||
|
"type-fest": "^1.2.1",
|
||||||
|
"vali-date": "^1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@sindresorhus/is": {
|
||||||
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="
|
||||||
|
},
|
||||||
|
"dot-prop": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
|
||||||
|
"requires": {
|
||||||
|
"is-obj": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type-fest": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"p-cancelable": {
|
"p-cancelable": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
||||||
@@ -3693,12 +3859,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
|
||||||
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
|
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
|
||||||
},
|
},
|
||||||
"prism-media": {
|
|
||||||
"version": "1.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.1.tgz",
|
|
||||||
"integrity": "sha512-nyYAa3KB4qteJIqdguKmwxTJgy55xxUtkJ3uRnOvO5jO+frci+9zpRXw6QZVcfDeva3S654fU9+26P2OSTzjHw==",
|
|
||||||
"requires": {}
|
|
||||||
},
|
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
@@ -3938,11 +4098,6 @@
|
|||||||
"send": "0.17.1"
|
"send": "0.17.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"setimmediate": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
|
||||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
|
||||||
},
|
|
||||||
"setprototypeof": {
|
"setprototypeof": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
||||||
@@ -4121,10 +4276,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
|
||||||
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
|
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
|
||||||
},
|
},
|
||||||
"tweetnacl": {
|
"ts-mixer": {
|
||||||
"version": "1.0.3",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
|
"integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
|
||||||
|
},
|
||||||
|
"tslib": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||||
},
|
},
|
||||||
"type-fest": {
|
"type-fest": {
|
||||||
"version": "0.20.2",
|
"version": "0.20.2",
|
||||||
@@ -4215,6 +4375,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||||
},
|
},
|
||||||
|
"vali-date": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY="
|
||||||
|
},
|
||||||
"vary": {
|
"vary": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^13.1.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",
|
||||||
|
|||||||
@@ -0,0 +1,254 @@
|
|||||||
|
const { Collection, Client, MessageEmbed } = require('discord.js');
|
||||||
|
const MongoClient = require('mongodb').MongoClient;
|
||||||
|
const Logger = require("../util/Logger");
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
class LinesPoliceCadBot extends Client {
|
||||||
|
|
||||||
|
constructor(options, config) {
|
||||||
|
super(options)
|
||||||
|
|
||||||
|
this.config = config;
|
||||||
|
this.commands = new Collection();
|
||||||
|
this.logger = new Logger(path.join(__dirname, "..", "logs/Logs.log"));
|
||||||
|
|
||||||
|
if (this.config.Token === "")
|
||||||
|
return new TypeError(
|
||||||
|
"The botconfig.js is not filled out. Please make sure nothing is blank, otherwise the bot will not work properly."
|
||||||
|
);
|
||||||
|
|
||||||
|
this.db;
|
||||||
|
this.dbo;
|
||||||
|
this.connectMongo(this.config.mongoURI, this.config.dbo);
|
||||||
|
this.LoadCommands();
|
||||||
|
this.LoadEvents();
|
||||||
|
|
||||||
|
this.Ready = false;
|
||||||
|
|
||||||
|
this.ws.on("INTERACTION_CREATE", async (interaction) => {
|
||||||
|
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;
|
||||||
|
|
||||||
|
//Easy to send respnose so ;)
|
||||||
|
interaction.guild = await this.guilds.fetch(interaction.guild_id);
|
||||||
|
interaction.send = async (message) => {
|
||||||
|
return await this.api
|
||||||
|
.interactions(interaction.id, interaction.token)
|
||||||
|
.callback.post({
|
||||||
|
data: {
|
||||||
|
type: 4,
|
||||||
|
data:
|
||||||
|
typeof message == "string"
|
||||||
|
? { content: message }
|
||||||
|
: message.type && message.type === "rich"
|
||||||
|
? { embeds: [message] }
|
||||||
|
: message,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
let cmd = client.commands.get(command);
|
||||||
|
if (cmd.SlashCommand && cmd.SlashCommand.run)
|
||||||
|
cmd.SlashCommand.run(this, interaction, args, { GuildDB });
|
||||||
|
});
|
||||||
|
|
||||||
|
const client = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
async connectMongo(mongoURI, dbo) {
|
||||||
|
this.db = await MongoClient.connect(mongoURI,{useUnifiedTopology:true});
|
||||||
|
this.dbo = this.db.db(dbo);
|
||||||
|
this.log('Successfully connected to mongoDB');
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is for the 'panic' command when enabling panic
|
||||||
|
// May be used by other interaction
|
||||||
|
async forceUpdateStatus(sendObject, userID, status) {
|
||||||
|
let validStatus=['10-8','10-7','10-6','10-11','10-23','10-97','10-15','10-70','10-80', '10-41', '10-42', 'Panic'];
|
||||||
|
let user = await this.dbo.collection("users").findOne({"user.discord.id":userID}).then(user => user);
|
||||||
|
if (!user) return returnMessage(`You are not logged in <@${userID}>`);
|
||||||
|
if (user.user.activeCommunity==null) return returnMessage(`You must join a community to use this command.`);
|
||||||
|
if (!validStatus.includes(status)) return returnMessage(`\`${status}\` is a Invalid Status.`);
|
||||||
|
let onDuty=null;
|
||||||
|
let updateDuty=false;
|
||||||
|
if (status=='10-41') {
|
||||||
|
onDuty=true;
|
||||||
|
updateDuty=true;
|
||||||
|
status='Online';
|
||||||
|
}
|
||||||
|
if (status=='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(this.config.socket);
|
||||||
|
socket.emit('bot_update_status', req);
|
||||||
|
socket.on('bot_updated_status', (res) => {
|
||||||
|
sendObject.send(`Succesfully updated status to \`${status}\` <@${userID}>`);
|
||||||
|
socket.disconnect();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
exists(n){return null!=n&&null!=n&&""!=n}
|
||||||
|
|
||||||
|
LoadCommands() {
|
||||||
|
let CommandsDir = path.join(__dirname, '..', 'commands');
|
||||||
|
fs.readdir(CommandsDir, (err, files) => {
|
||||||
|
if (err) this.log(err);
|
||||||
|
else
|
||||||
|
files.forEach((file) => {
|
||||||
|
let cmd = require(CommandsDir + "/" + file);
|
||||||
|
if (!cmd.name || !cmd.description || !cmd.run)
|
||||||
|
return this.log(
|
||||||
|
"Unable to load Command: " +
|
||||||
|
file.split(".")[0] +
|
||||||
|
", Reason: File doesn't had run/name/desciption"
|
||||||
|
);
|
||||||
|
this.commands.set(file.split(".")[0].toLowerCase(), cmd);
|
||||||
|
this.log("Command Loaded: " + file.split(".")[0]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadEvents() {
|
||||||
|
let EventsDir = path.join(__dirname, '..', 'events');
|
||||||
|
fs.readdir(EventsDir, (err, files) => {
|
||||||
|
if (err) this.log(err);
|
||||||
|
else
|
||||||
|
files.forEach((file) => {
|
||||||
|
const event = require(EventsDir + "/" + file);
|
||||||
|
this.on(file.split(".")[0], event.bind(null, this));
|
||||||
|
this.logger.log("Event Loaded: " + file.split(".")[0]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendTime(Channel, Error) {
|
||||||
|
let embed = new MessageEmbed()
|
||||||
|
.setColor(this.config.EmbedColor)
|
||||||
|
.setDescription(Error);
|
||||||
|
|
||||||
|
Channel.send(embed);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterSlashCommands() {
|
||||||
|
this.guilds.cache.forEach((guild) => {
|
||||||
|
require("../util/RegisterSlashCommands")(this, guild.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkRoleStatus(rolesCache, serverID, isList) {
|
||||||
|
let hasRole = false;
|
||||||
|
let guild = await this.dbo.collection("prefixes").findOne({"server.serverID":serverID}).then(guild => guild);
|
||||||
|
// If user has one of any in the list of allowed roles, hasRole is true
|
||||||
|
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
|
||||||
|
if (!isList) {
|
||||||
|
if (rolesCache.some(role => role.id == guild.server.allowedRoles[i])) {
|
||||||
|
hasRole = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (rolesCache.includes(guild.server.allowedRoles[i])) {
|
||||||
|
hasRole = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasRole;
|
||||||
|
}
|
||||||
|
|
||||||
|
async GetGuild(GuildId) {
|
||||||
|
let prefix;
|
||||||
|
let customRoleStatus;
|
||||||
|
let customChannelStatus;
|
||||||
|
let allowedChannels;
|
||||||
|
let guild = await this.dbo.collection("prefixes").findOne({"server.serverID":GuildId}).then(guild => guild);
|
||||||
|
|
||||||
|
// If guild not found, generate guild default
|
||||||
|
if (!guild) {
|
||||||
|
let newGuild = {
|
||||||
|
server: {
|
||||||
|
serverID: GuildId,
|
||||||
|
prefix: this.config.DefaultPrefix,
|
||||||
|
hasCustomRoles: false,
|
||||||
|
hasCustomChannels: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.dbo.collection("prefixes").insertOne(newGuild, function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
});
|
||||||
|
prefix = newGuild.server.prefix;
|
||||||
|
customRoleStatus = newGuild.server.hasCustomRoles;
|
||||||
|
customChannelStatus = newGuild.server.hasCustomChannels;
|
||||||
|
allowedChannels = null;
|
||||||
|
} else {
|
||||||
|
prefix = guild.server.prefix;
|
||||||
|
customRoleStatus = guild.server.hasCustomRoles;
|
||||||
|
customChannelStatus = guild.server.hasCustomChannels;
|
||||||
|
if (guild.server.allowedChannels!=undefined||guild.server.allowedChannels!=null&&guild.server.allowedChannels.length>0) {
|
||||||
|
allowedChannels = guild.server.allowedChannels;
|
||||||
|
} else allowedChannels = null;
|
||||||
|
}
|
||||||
|
let guildData = {
|
||||||
|
prefix: prefix,
|
||||||
|
allowedChannels: allowedChannels,
|
||||||
|
customRoleStatus: customRoleStatus,
|
||||||
|
customChannelStatus: customChannelStatus,
|
||||||
|
serverID: GuildId
|
||||||
|
}
|
||||||
|
return guildData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
This command is to verify a user
|
||||||
|
has the correct role to use a
|
||||||
|
command ie. has cop role to use
|
||||||
|
name-search
|
||||||
|
*/
|
||||||
|
async verifyUseCommand(serverID, rolesCache, isList) {
|
||||||
|
let { customRoleStatus } = await this.GetGuild(serverID)
|
||||||
|
if (customRoleStatus) {
|
||||||
|
let hasRole = await this.checkRoleStatus(rolesCache, serverID, isList);
|
||||||
|
if (hasRole) {
|
||||||
|
return true // User has role, can use command
|
||||||
|
} else return false // User does not have role, can't use command
|
||||||
|
} else return true // There is no role limits
|
||||||
|
}
|
||||||
|
|
||||||
|
log(Text) {
|
||||||
|
this.logger.log(Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendError(Channel, Error) {
|
||||||
|
let embed = new MessageEmbed()
|
||||||
|
.setTitle("An error occured")
|
||||||
|
.setColor("RED")
|
||||||
|
.setDescription(Error)
|
||||||
|
.setFooter(
|
||||||
|
"If you think this as a bug, please report it in the support server!"
|
||||||
|
);
|
||||||
|
|
||||||
|
Channel.send(embed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
build() {
|
||||||
|
this.login(this.config.Token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = LinesPoliceCadBot;
|
||||||
@@ -3,12 +3,12 @@ const path = require("path");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register slash commands for a guild
|
* Register slash commands for a guild
|
||||||
* @param {require("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {string} guild
|
* @param {string} guild
|
||||||
*/
|
*/
|
||||||
module.exports = (client, guild) => {
|
module.exports = (client, guild) => {
|
||||||
|
|
||||||
let commandsDir = path.join(__dirname, "..", "commands");;
|
let commandsDir = path.join(__dirname, "..", "commands");
|
||||||
|
|
||||||
fs.readdir(commandsDir, (err, files) => {
|
fs.readdir(commandsDir, (err, files) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|||||||
Reference in new issue
Block a user