mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 22:44:32 +02:00
Azur Lane Ship Command
This commit is contained in:
@@ -15,6 +15,7 @@ SUCCESS_EMOJI_ID=
|
||||
|
||||
# API Keys, IDs, and Secrets
|
||||
ALPHA_VANTAGE_KEY=
|
||||
AZUR_LANE_SHIP_ROOT=
|
||||
CUSTOM_SEARCH_ID=
|
||||
DEVIANTART_ID=
|
||||
DEVIANTART_SECRET=
|
||||
|
||||
@@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
The bot is no longer available for invite. You can self-host the bot, or use her
|
||||
on the [home server](https://discord.gg/sbMe32W).
|
||||
|
||||
## Commands (317)
|
||||
## Commands (318)
|
||||
### Utility:
|
||||
|
||||
* **eval:** Executes JavaScript code.
|
||||
@@ -120,6 +120,7 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
|
||||
### Search:
|
||||
|
||||
* **azur-lane-ship:** Responds with information on an Azur Lane ship.
|
||||
* **bulbapedia:** Searches Bulbapedia for your query.
|
||||
* **derpibooru:** Responds with an image from Derpibooru.
|
||||
* **deviantart:** Responds with an image from a DeviantArt section, with optional query.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { AZUR_LANE_SHIP_ROOT } = process.env;
|
||||
|
||||
module.exports = class AzurLaneShipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'azur-lane-ship',
|
||||
aliases: ['azure-lane-ship', 'azur-lane', 'azure-lane', 'azur', 'azure'],
|
||||
group: 'search',
|
||||
memberName: 'azur-lane-ship',
|
||||
description: 'Responds with information on an Azur Lane ship.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'ship',
|
||||
prompt: 'What ship would you like to get information on?',
|
||||
type: 'string',
|
||||
parse: ship => encodeURIComponent(ship)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { ship }) {
|
||||
try {
|
||||
const { body } = await request.get(`${AZUR_LANE_SHIP_ROOT}/${ship}`);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x1A1917)
|
||||
.setAuthor('Azur Lane', 'https://i.imgur.com/KeGXiZA.jpg', 'https://azurlane.yo-star.com')
|
||||
.setTitle(`${body.names.en} (${body.class} Class)`)
|
||||
.setURL(body.page_url)
|
||||
.setThumbnail(body.icon)
|
||||
.setFooter(`Ship #${body.id}`)
|
||||
.addField('❯ Construction Time', body.construction_time, true)
|
||||
.addField('❯ Rarity', body.rarity, true)
|
||||
.addField('❯ Nationality', body.nationality, true)
|
||||
.addField('❯ Type', body.type, true)
|
||||
.addField('❯ Health', body.base.health, true)
|
||||
.addField('❯ Armor', body.base.armor, true)
|
||||
.addField('❯ Reload', body.base.reload, true)
|
||||
.addField('❯ Firepower', body.base.firepower, true)
|
||||
.addField('❯ Torpedo', body.base.torpedo, true)
|
||||
.addField('❯ Speed', body.base.speed, true)
|
||||
.addField('❯ Anti-Air', body.base.anti_air, true)
|
||||
.addField('❯ Anti-Sub', body.base.anti_sub, true)
|
||||
.addField('❯ Aviation', body.base.air_power, true)
|
||||
.addField('❯ Oil Cost', body.base.oil_usage, true)
|
||||
.addField('❯ Equipment', stripIndents`
|
||||
${body.equipment[0].equippable} (${body.equipment[0].efficiency})
|
||||
${body.equipment[1].equippable} (${body.equipment[1].efficiency})
|
||||
${body.equipment[2].equippable} (${body.equipment[2].efficiency})
|
||||
`)
|
||||
.addField('❯ Images', `[Chibi](${body.chibi}), ${body.images.map(img => `[${img.name}](${img.url})`).join(', ')}`);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 404) return msg.say('Could not find any results.');
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "91.11.0",
|
||||
"version": "91.12.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user