1.4.4 Hotfix make sure socket.on is for self
This commit is contained in:
1 parent
ea546f4237
commit
d49bc4a0b4
3 files changed
+103
-85
No files matched your search
@@ -111,65 +111,67 @@ class Bot {
|
|||||||
this.socket.emit("bot_name_search", data);
|
this.socket.emit("bot_name_search", data);
|
||||||
this.socket.on("bot_name_search_results", results => {
|
this.socket.on("bot_name_search_results", results => {
|
||||||
|
|
||||||
if (results.civilians.length == 0) {
|
if (results.user._id==user._id) {
|
||||||
return message.channel.send(`Name **${args[0]} ${args[1]}** not found ${message.author}`);
|
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++) {
|
for (let i = 0; i < results.civilians.length; i++) {
|
||||||
// Get Drivers Licence Status
|
// Get Drivers Licence Status
|
||||||
let licenceStatus;
|
let licenceStatus;
|
||||||
if (results.civilians[i].civilian.licenseStatus == 1) licenceStatus = 'Valid';
|
if (results.civilians[i].civilian.licenseStatus == 1) licenceStatus = 'Valid';
|
||||||
if (results.civilians[i].civilian.licenceStatus == 2) licenceStatus = 'Revoked';
|
if (results.civilians[i].civilian.licenceStatus == 2) licenceStatus = 'Revoked';
|
||||||
if (results.civilians[i].civilian.licenceStatus == 3) licenceStatus = 'None';
|
if (results.civilians[i].civilian.licenceStatus == 3) licenceStatus = 'None';
|
||||||
// Get Firearm Licence Status
|
// Get Firearm Licence Status
|
||||||
let firearmLicence = results.civilians[i].civilian.firearmLicense;
|
let firearmLicence = results.civilians[i].civilian.firearmLicense;
|
||||||
if (firearmLicence == undefined || firearmLicence == null) firearmLicence = 'None';
|
if (firearmLicence == undefined || firearmLicence == null) firearmLicence = 'None';
|
||||||
if (firearmLicence == '2') firearmLicence = 'Valid';
|
if (firearmLicence == '2') firearmLicence = 'Valid';
|
||||||
if (firearmLicence == '3') firearmLicence = 'Revoked';
|
if (firearmLicence == '3') firearmLicence = 'Revoked';
|
||||||
let nameResult = new Discord.MessageEmbed()
|
let nameResult = new Discord.MessageEmbed()
|
||||||
.setColor('#0099ff')
|
.setColor('#0099ff')
|
||||||
.setTitle(`**${results.civilians[i].civilian.firstName} ${results.civilians[i].civilian.lastName} | ${results.civilians[i]._id}**`)
|
.setTitle(`**${results.civilians[i].civilian.firstName} ${results.civilians[i].civilian.lastName} | ${results.civilians[i]._id}**`)
|
||||||
.setURL('https://discord.gg/jgUW656v2t')
|
.setURL('https://discord.gg/jgUW656v2t')
|
||||||
.setAuthor('LPS Website Support', 'https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png', 'https://discord.gg/jgUW656v2t')
|
.setAuthor('LPS Website Support', 'https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png', 'https://discord.gg/jgUW656v2t')
|
||||||
.setDescription('Name Search Results')
|
.setDescription('Name Search Results')
|
||||||
.addFields(
|
.addFields(
|
||||||
{ name: `**First Name**`, value: `**${results.civilians[i].civilian.firstName}**`, inline: true },
|
{ name: `**First Name**`, value: `**${results.civilians[i].civilian.firstName}**`, inline: true },
|
||||||
{ name: `**Last Name**`, value: `**${results.civilians[i].civilian.lastName}**`, inline: true },
|
{ name: `**Last Name**`, value: `**${results.civilians[i].civilian.lastName}**`, inline: true },
|
||||||
{ name: `**DOB**`, value: `**${results.civilians[i].civilian.birthday}**`, inline: true },
|
{ name: `**DOB**`, value: `**${results.civilians[i].civilian.birthday}**`, inline: true },
|
||||||
{ name: `**Drivers License**`, value: `**${licenceStatus}**`, inline: true },
|
{ name: `**Drivers License**`, value: `**${licenceStatus}**`, inline: true },
|
||||||
{ name: `**Firearm Licence**`, value: `**${firearmLicence}**`, inline: true },
|
{ name: `**Firearm Licence**`, value: `**${firearmLicence}**`, inline: true },
|
||||||
{ name: `**Gender**`, value: `**${results.civilians[i].civilian.gender}**`, inline: true }
|
{ name: `**Gender**`, value: `**${results.civilians[i].civilian.gender}**`, inline: true }
|
||||||
)
|
)
|
||||||
// Check Other details
|
// Check Other details
|
||||||
let address = results.civilians[i].civilian.address;
|
let address = results.civilians[i].civilian.address;
|
||||||
let occupation = results.civilians[i].civilian.occupation;
|
let occupation = results.civilians[i].civilian.occupation;
|
||||||
let height = results.civilians[i].civilian.height;
|
let height = results.civilians[i].civilian.height;
|
||||||
let weight = results.civilians[i].civilian.weight;
|
let weight = results.civilians[i].civilian.weight;
|
||||||
let eyeColor = results.civilians[i].civilian.eyeColor;
|
let eyeColor = results.civilians[i].civilian.eyeColor;
|
||||||
let hairColor = results.civilians[i].civilian.hairColor;
|
let hairColor = results.civilians[i].civilian.hairColor;
|
||||||
if (address != null && address != undefined && address != '') nameResult.addFields({ name: `**Address**`, value: `**${address}**`, inline: true });
|
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 (occupation != null && occupation != undefined && occupation != '') nameResult.addFields({ name: `**Occupation**`, value: `**${occupation}**`, inline: true });
|
||||||
if (height!=null&&height!=undefined&&height!="NaN"&&height!='') {
|
if (height!=null&&height!=undefined&&height!="NaN"&&height!='') {
|
||||||
if (results.civilians[i].civilian.heightClassification=='imperial') {
|
if (results.civilians[i].civilian.heightClassification=='imperial') {
|
||||||
let ft = Math.floor(height/12);
|
let ft = Math.floor(height/12);
|
||||||
let inch = height%12;
|
let inch = height%12;
|
||||||
nameResult.addFields({ name: '**Height**', value: `**${ft}'${inch}"**`, inline: true });
|
nameResult.addFields({ name: '**Height**', value: `**${ft}'${inch}"**`, inline: true });
|
||||||
} else {
|
} else {
|
||||||
nameResult.addFields({ name: '**Height**', value: `**${height}cm**`, inline: true });
|
nameResult.addFields({ name: '**Height**', value: `**${height}cm**`, inline: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (weight!=null&&weight!=undefined&&weight!='') {
|
||||||
if (weight!=null&&weight!=undefined&&weight!='') {
|
if (results.civilians[i].civilian.weightClassification=='imperial') {
|
||||||
if (results.civilians[i].civilian.weightClassification=='imperial') {
|
nameResult.addFields({ name: '**Weight**', value: `**${weight}lbs.**`, inline: true });
|
||||||
nameResult.addFields({ name: '**Weight**', value: `**${weight}lbs.**`, inline: true });
|
} else {
|
||||||
} else {
|
nameResult.addFields({ name: '**Weight**', value: `**${weight}kgs.**`, inline: true });
|
||||||
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(nameResult);
|
||||||
}
|
}
|
||||||
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(nameResult);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -188,39 +190,55 @@ class Bot {
|
|||||||
this.socket.emit('bot_plate_search', data);
|
this.socket.emit('bot_plate_search', data);
|
||||||
this.socket.on('bot_plate_search_results', results => {
|
this.socket.on('bot_plate_search_results', results => {
|
||||||
|
|
||||||
if (results.vehicles.length == 0) {
|
if (results.user._id==user._id) {
|
||||||
return message.channel.send(`Plate Number **${args[0]}** not found ${message.author}`);
|
if (results.vehicles.length == 0) {
|
||||||
}
|
return message.channel.send(`Plate Number **${args[0]}** not found ${message.author}`);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < results.vehicles.length; i++) {
|
for (let i = 0; i < results.vehicles.length; i++) {
|
||||||
let plateResult = new Discord.MessageEmbed()
|
let plateResult = new Discord.MessageEmbed()
|
||||||
.setColor('#0099ff')
|
.setColor('#0099ff')
|
||||||
.setTitle(`**${results.vehicles[i].vehicle.plate} | ${results.vehicles[i]._id}**`)
|
.setTitle(`**${results.vehicles[i].vehicle.plate} | ${results.vehicles[i]._id}**`)
|
||||||
.setURL('https://discord.gg/jgUW656v2t')
|
.setURL('https://discord.gg/jgUW656v2t')
|
||||||
.setAuthor('LPS Website Support', 'https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png', 'https://discord.gg/jgUW656v2t')
|
.setAuthor('LPS Website Support', 'https://raw.githubusercontent.com/Linesmerrill/police-cad/master/lines-police-server.png', 'https://discord.gg/jgUW656v2t')
|
||||||
.setDescription('Plate Search Results')
|
.setDescription('Plate Search Results')
|
||||||
.addFields(
|
.addFields(
|
||||||
{ name: `**Plate #**`, value: `**${results.vehicles[i].vehicle.plate}**`, inline: true },
|
{ name: `**Plate #**`, value: `**${results.vehicles[i].vehicle.plate}**`, inline: true },
|
||||||
{ name: `**Vin #**`, value: `**${results.vehicles[i].vehicle.vin}**`, inline: true },
|
{ name: `**Vin #**`, value: `**${results.vehicles[i].vehicle.vin}**`, inline: true },
|
||||||
{ name: `**Model**`, value: `**${results.vehicles[i].vehicle.model}**`, inline: true },
|
{ name: `**Model**`, value: `**${results.vehicles[i].vehicle.model}**`, inline: true },
|
||||||
{ name: `**Color**`, value: `**${results.vehicles[i].vehicle.color}**`, inline: true },
|
{ name: `**Color**`, value: `**${results.vehicles[i].vehicle.color}**`, inline: true },
|
||||||
{ name: `**Owner**`, value: `**${results.vehicles[i].vehicle.registeredOwner}**`, inline: true },
|
{ name: `**Owner**`, value: `**${results.vehicles[i].vehicle.registeredOwner}**`, inline: true },
|
||||||
)
|
)
|
||||||
// Other details
|
// Other details
|
||||||
let validRegistration = results.vehicles[i].vehicle.validRegistration;
|
let validRegistration = results.vehicles[i].vehicle.validRegistration;
|
||||||
let validInsurance = results.vehicles[i].vehicle.validInsurance;
|
let validInsurance = results.vehicles[i].vehicle.validInsurance;
|
||||||
let stolen = results.vehicles[i].vehicle.isStolen;
|
let stolen = results.vehicles[i].vehicle.isStolen;
|
||||||
if (validRegistration=='1') plateResult.addFields({ name: `**Registration**`, value: `**Valid**`, inline: true });
|
if (validRegistration=='1') plateResult.addFields({ name: `**Registration**`, value: `**Valid**`, inline: true });
|
||||||
if (validRegistration=='2') plateResult.addFields({ name: `**Registration**`, value: `**InValid**`, 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=='1') plateResult.addFields({ name: `**Insurance**`, value: `**Valid**`, inline: true });
|
||||||
if (validInsurance=='2') plateResult.addFields({ name: `**Insurance**`, value: `**InValid**`, inline: true });
|
if (validInsurance=='2') plateResult.addFields({ name: `**Insurance**`, value: `**InValid**`, inline: true });
|
||||||
if (stolen=='1') plateResult.addFields({ name: `**Stolen**`, value: `**No**`, inline: true });
|
if (stolen=='1') plateResult.addFields({ name: `**Stolen**`, value: `**No**`, inline: true });
|
||||||
if (stolen=='2') plateResult.addFields({ name: `**Stolen**`, value: `**Yes**`, inline: true });
|
if (stolen=='2') plateResult.addFields({ name: `**Stolen**`, value: `**Yes**`, inline: true });
|
||||||
message.channel.send(plateResult);
|
message.channel.send(plateResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In Dev
|
||||||
|
// async firearmSeach(message, args) {
|
||||||
|
// 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 (args.length==0) return message.channel.send(`You are missing a **Serial Number** ${message.author}`);
|
||||||
|
// let data = {
|
||||||
|
// user: user,
|
||||||
|
// query: {
|
||||||
|
// serialNumber: args[0],
|
||||||
|
// activeCommunityID: user.user.activeCommunity
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
async checkStatus(message, args) {
|
async checkStatus(message, args) {
|
||||||
if (args.length==0) {
|
if (args.length==0) {
|
||||||
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);
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"defaultPrefix": "?",
|
"defaultPrefix": "?",
|
||||||
"botID": "860298681047056434",
|
"botID": "860298681047056434",
|
||||||
"mongoURI": "mongodb+srv://lps_bot:ktSkHml2BU9EIQ0a@heroku-police-cad-dev.j7aom.mongodb.net/heroku_8pc4g86l?retryWrites=true&w=majority",
|
"mongoURI": "mongodb+srv://lps_bot:ktSkHml2BU9EIQ0a@heroku-police-cad-dev.j7aom.mongodb.net/heroku_8pc4g86l?retryWrites=true&w=majority",
|
||||||
"version": "Beta 1.4.3",
|
"version": "Beta 1.4.4",
|
||||||
"socket": "https://police-cad-dev.herokuapp.com/",
|
"socket": "https://police-cad-dev.herokuapp.com/",
|
||||||
"dbo": "heroku_8pc4g86l"
|
"dbo": "heroku_8pc4g86l"
|
||||||
}
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"defaultPrefix": "?",
|
"defaultPrefix": "?",
|
||||||
"botID": "860298681047056434",
|
"botID": "860298681047056434",
|
||||||
"mongoURI": "mongodb+srv://lps_bot:ktSkHml2BU9EIQ0a@heroku-police-cad-dev.j7aom.mongodb.net/heroku_8pc4g86l?retryWrites=true&w=majority",
|
"mongoURI": "mongodb+srv://lps_bot:ktSkHml2BU9EIQ0a@heroku-police-cad-dev.j7aom.mongodb.net/heroku_8pc4g86l?retryWrites=true&w=majority",
|
||||||
"version": "Beta 1.4.3",
|
"version": "Beta 1.4.4",
|
||||||
"socket": "http://localhost:8080",
|
"socket": "http://localhost:8080",
|
||||||
"dbo": "heroku_8pc4g86l"
|
"dbo": "heroku_8pc4g86l"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user