diff --git a/commands/location.js b/commands/location.js new file mode 100644 index 0000000..180cddc --- /dev/null +++ b/commands/location.js @@ -0,0 +1,48 @@ +const { EmbedBuilder } = require('discord.js'); +const bitfieldCalculator = require('discord-bitfield-calculator'); + +module.exports = { + name: "location", + debug: false, + global: false, + description: "Find your last known location", + usage: "", + permissions: { + channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], + member: [], + }, + SlashCommand: { + /** + * + * @param {require("../structures/QuarksBot")} client + * @param {import("discord.js").Message} message + * @param {string[]} args + * @param {*} param3 + */ + run: async (client, interaction, args, { GuildDB }) => { + + if (!client.exists(GuildDB.playerstats)) { + GuildDB.playerstats = [{}]; + client.dbo.collection("guilds").updateOne({ "server.serverID": GuildDB.serverID }, { + $set: { + "server.playerstats": [] + } + }, function (err, res) { + if (err) return client.sendInternalError(interaction, err); + }); + } + + let playerStat = GuildDB.playerstats.find(stat => stat.discordID == interaction.member.userID ); + if (playerStat == undefined) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription(`**Not Found** You haven't linked your gamertag and are unable to use this command.`)] }); + + let newDt = await client.getDateEST(playerStat.time); + let unixTime = Math.floor(newDt.getTime()/1000); + + let lastLocation = new EmbedBuilder() + .setColor(client.config.Colors.Default) + .setDescription(`**Location - **\nYour last location was detected at **[${playerStat.pos[0]}, ${playerStat.pos[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${data.pos[0]};${data.pos[1]})**`) + + return interaction.send({ embeds: [lastLocation], flags: (1 << 6) }); + }, + }, +} \ No newline at end of file diff --git a/package.json b/package.json index 511982c..81af20e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayz-armbands", - "version": "8.1.3", + "version": "8.2.0", "description": "A General Purpose Discord Bot for DayZ Servers.", "main": "index.js", "nodemonConfig": {