1.5.0 Firearm search
This commit is contained in:
1 parent
d49bc4a0b4
commit
80f0b0e738
3 files changed
+42
-16
No files matched your search
@@ -225,19 +225,45 @@ class Bot {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// In Dev
|
async firearmSearch(message, args) {
|
||||||
// async firearmSeach(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}!`);
|
if (args.length==0) return message.channel.send(`You are missing a **Serial Number** ${message.author}`);
|
||||||
// if (args.length==0) return message.channel.send(`You are missing a **Serial Number** ${message.author}`);
|
let data = {
|
||||||
// let data = {
|
user: user,
|
||||||
// user: user,
|
query: {
|
||||||
// query: {
|
serialNumber: args[0],
|
||||||
// serialNumber: args[0],
|
activeCommunityID: user.user.activeCommunity
|
||||||
// activeCommunityID: user.user.activeCommunity
|
}
|
||||||
// }
|
}
|
||||||
// }
|
this.socket.emit('bot_firearm_search', data);
|
||||||
// }
|
this.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 Discord.MessageEmbed()
|
||||||
|
.setColor('#0099ff')
|
||||||
|
.setTitle(`**${results.firearms[i].firearm.serialNumber} | ${results.firearms[i]._id}**`)
|
||||||
|
.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')
|
||||||
|
.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(firearmResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async checkStatus(message, args) {
|
async checkStatus(message, args) {
|
||||||
if (args.length==0) {
|
if (args.length==0) {
|
||||||
@@ -383,9 +409,9 @@ class Bot {
|
|||||||
if (command == 'penalcodes') return message.channel.send('https://www.linespolice-cad.com/penal-code');
|
if (command == 'penalcodes') return message.channel.send('https://www.linespolice-cad.com/penal-code');
|
||||||
if (command == 'namedb') this.nameSearch(message, args);
|
if (command == 'namedb') this.nameSearch(message, args);
|
||||||
if (command == 'platedb') this.plateSearch(message, args);
|
if (command == 'platedb') this.plateSearch(message, args);
|
||||||
|
if (command == 'firearmdb') this.firearmSearch(message, args);
|
||||||
|
|
||||||
// Disabled for dev
|
// Disabled for dev
|
||||||
// if (command == 'firearmdb') this.weaponSearch(message, args);
|
|
||||||
// if (command == 'createbolo') this.createBolo(message, args);
|
// if (command == 'createbolo') this.createBolo(message, args);
|
||||||
// if (command == 'panic') this.enablePanic(message);
|
// if (command == 'panic') this.enablePanic(message);
|
||||||
|
|
||||||
|
|||||||
+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.4",
|
"version": "Beta 1.5.0",
|
||||||
"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.4",
|
"version": "Beta 1.5.0",
|
||||||
"socket": "http://localhost:8080",
|
"socket": "http://localhost:8080",
|
||||||
"dbo": "heroku_8pc4g86l"
|
"dbo": "heroku_8pc4g86l"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user