Bug Fixes

This commit is contained in:
SowinskiBraeden committed 2021-11-20 13:16:52 -08:00
1 parent 9f75974b7e
commit 7838cf3fbb
3 files changed
+10 -8

No files matched your search

+8 -6
View File
@@ -373,7 +373,7 @@ class Bot {
} }
} }
async revokeLicense(message, args) { async updateLicense(message, args) {
let user = await this.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user); let user = await this.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) return message.channel.send(`You are not logged in ${message.author}!`);
let data; let data;
@@ -382,10 +382,12 @@ class Bot {
if (args.length==1) return message.channel.send(`You're missing a \`First Name\`, \`Last Name\` and \`DOB\`(yyyy-mm-dd) ${message.author}!`); if (args.length==1) return message.channel.send(`You're missing a \`First Name\`, \`Last Name\` and \`DOB\`(yyyy-mm-dd) ${message.author}!`);
if (args.length==2) return message.channel.send(`You're missing a \`Last Name\` and \`DOB\`(yyyy-mm-dd) ${message.author}!`); if (args.length==2) return message.channel.send(`You're missing a \`Last Name\` and \`DOB\`(yyyy-mm-dd) ${message.author}!`);
if (args.length==3) return message.channel.send(`You're missing a \`DOB\`(yyyy-mm-dd) ${message.author}!`); if (args.length==3) return message.channel.send(`You're missing a \`DOB\`(yyyy-mm-dd) ${message.author}!`);
if (args[0].toLowerCase()!='revoke'&&args[0].toLowerCase()!='reinstate') return message.channel.send(`Invalid License Status, choose \`revoke\` or \`reinstate\` ${message.author}!`);
} }
if (args.length==0) return message.channel.send(`You must provide a \`License Status\`, \`First Name\` and \`Last Name\` ${message.author}!`); if (args.length==0) return message.channel.send(`You must provide a \`License Status\`, \`First Name\` and \`Last Name\` ${message.author}!`);
if (args.length==1) return message.channel.send(`You're missing a \`First Name\` and \`Last Name\` ${message.author}!`); if (args.length==1) return message.channel.send(`You're missing a \`First Name\` and \`Last Name\` ${message.author}!`);
if (args.length==2) return message.channel.send(`You're missing a \`Last Name\` ${message.author}!`); if (args.length==2) return message.channel.send(`You're missing a \`Last Name\` ${message.author}!`);
if (args[0].toLowerCase()!='revoke'&&args[0].toLowerCase()!='reinstate') return message.channel.send(`Invalid License Status, choose \`revoke\` or \`reinstate\` ${message.author}!`);
if (user.user.activeCommunity=='' || user.user.activeCommunity==null) { if (user.user.activeCommunity=='' || user.user.activeCommunity==null) {
data = { data = {
@@ -413,7 +415,7 @@ class Bot {
socket.on("bot_name_search_results", (results) => { socket.on("bot_name_search_results", (results) => {
if (results.user._id==user._id) { if (results.user._id==user._id) {
if (results.civilians.length == 0) { if (results.civilians.length == 0) {
return message.channel.send(`Name \`${args[0]} ${args[1]}\` not found ${message.author}`); return message.channel.send(`Name \`${args[1]} ${args[2]}\` not found ${message.author}`);
} }
} }
@@ -426,8 +428,8 @@ class Bot {
if (args[0]=='reinstate') query.status = 1; if (args[0]=='reinstate') query.status = 1;
socket.emit("update_drivers_license_status", query); socket.emit("update_drivers_license_status", query);
socket.on("bot_updated_drivers_license_status", (res) => { socket.on("bot_updated_drivers_license_status", (res) => {
if (!res.success) return message.channel.send(`Failed to update license of ${args[0]} ${args[1]} ${message.author}`); if (!res.success) return message.channel.send(`Failed to update license of \`${args[1]} ${args[2]}\` ${message.author}`);
message.channel.send(`Successfully updated license of ${args[0]} ${args[1]} ${message.author}`); message.channel.send(`Successfully updated license of \`${args[1]} ${args[2]}\` ${message.author}`);
socket.disconnect(); socket.disconnect();
return; return;
}); });
@@ -887,9 +889,9 @@ class Bot {
if (customRoleStatus) { if (customRoleStatus) {
let hasRole = await this.checkRoleStatus(message); let hasRole = await this.checkRoleStatus(message);
if (hasRole) { if (hasRole) {
this.revokeLicense(message, args); this.updateLicense(message, args);
} else return message.channel.send(`You don't have permission to use this command ${message.author}! `); } else return message.channel.send(`You don't have permission to use this command ${message.author}! `);
} else this.revokeLicense(message, args); } else this.updateLicense(message, args);
} }
if (command == 'joincommunity') this.joinCommunity(message, args); if (command == 'joincommunity') this.joinCommunity(message, args);
if (command == 'leavecommunity') this.leaveCommunity(message); if (command == 'leavecommunity') this.leaveCommunity(message);
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"defaultPrefix": "?", "defaultPrefix": "?",
"version": "Beta 1.9.8", "version": "Beta 1.9.9",
"socket": "https://police-cad-dev.herokuapp.com/" "socket": "https://police-cad-dev.herokuapp.com/"
} }
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"defaultPrefix": "?", "defaultPrefix": "?",
"version": "1.9.8", "version": "1.9.9",
"socket": "https://www.linespolice-cad.com/" "socket": "https://www.linespolice-cad.com/"
} }