mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Update Azur Lane API
This commit is contained in:
@@ -15,7 +15,6 @@ SUCCESS_EMOJI_ID=
|
|||||||
|
|
||||||
# API Keys, IDs, and Secrets
|
# API Keys, IDs, and Secrets
|
||||||
ALPHA_VANTAGE_KEY=
|
ALPHA_VANTAGE_KEY=
|
||||||
AZUR_LANE_SHIP_ROOT=
|
|
||||||
CUSTOM_SEARCH_ID=
|
CUSTOM_SEARCH_ID=
|
||||||
DEVIANTART_ID=
|
DEVIANTART_ID=
|
||||||
DEVIANTART_SECRET=
|
DEVIANTART_SECRET=
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const Command = require('../../structures/Command');
|
|||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
const { stripIndents } = require('common-tags');
|
const { stripIndents } = require('common-tags');
|
||||||
const { AZUR_LANE_SHIP_ROOT } = process.env;
|
|
||||||
|
|
||||||
module.exports = class AzurLaneShipCommand extends Command {
|
module.exports = class AzurLaneShipCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -15,46 +14,48 @@ module.exports = class AzurLaneShipCommand extends Command {
|
|||||||
clientPermissions: ['EMBED_LINKS'],
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'ship',
|
key: 'query',
|
||||||
prompt: 'What ship would you like to get information on?',
|
prompt: 'What ship would you like to get information on?',
|
||||||
type: 'string',
|
type: 'string'
|
||||||
parse: ship => encodeURIComponent(ship)
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { ship }) {
|
async run(msg, { query }) {
|
||||||
try {
|
try {
|
||||||
const { body } = await request.get(`${AZUR_LANE_SHIP_ROOT}/${ship}`);
|
const { body } = await request
|
||||||
|
.get(`https://al-shipgirls.pw/shipyard/ship_info_detailed/`)
|
||||||
|
.query({ search: query });
|
||||||
|
const data = body[0];
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0x1A1917)
|
.setColor(0x1A1917)
|
||||||
.setAuthor('Azur Lane', 'https://i.imgur.com/KeGXiZA.jpg', 'https://azurlane.yo-star.com')
|
.setAuthor('Azur Lane', 'https://i.imgur.com/KeGXiZA.jpg', 'https://azurlane.yo-star.com')
|
||||||
.setTitle(`${body.names.en} (${body.class} Class)`)
|
.setTitle(`${data.names.en} (${data.class} Class)`)
|
||||||
.setURL(body.page_url)
|
.setURL(data.page_url)
|
||||||
.setThumbnail(body.icon)
|
.setThumbnail(data.icon)
|
||||||
.setFooter(`Ship #${body.id}`)
|
.setFooter(`Ship #${data.id}`)
|
||||||
.addField('❯ Construction Time', body.construction_time, true)
|
.addField('❯ Construction Time', data.construction_time, true)
|
||||||
.addField('❯ Rarity', body.rarity, true)
|
.addField('❯ Rarity', data.rarity, true)
|
||||||
.addField('❯ Nationality', body.nationality, true)
|
.addField('❯ Nationality', data.nationality, true)
|
||||||
.addField('❯ Type', body.type, true)
|
.addField('❯ Type', data.type, true)
|
||||||
.addField('❯ Health', `${body.base.health} (${body.max.health} Max)`, true)
|
.addField('❯ Health', `${data.base.health} (${data.max.health} Max)`, true)
|
||||||
.addField('❯ Armor', body.base.armor, true)
|
.addField('❯ Armor', data.base.armor, true)
|
||||||
.addField('❯ Reload', `${body.base.reload} (${body.max.reload} Max)`, true)
|
.addField('❯ Reload', `${data.base.reload} (${data.max.reload} Max)`, true)
|
||||||
.addField('❯ Firepower', `${body.base.firepower} (${body.max.firepower} Max)`, true)
|
.addField('❯ Firepower', `${data.base.firepower} (${data.max.firepower} Max)`, true)
|
||||||
.addField('❯ Torpedo', `${body.base.torpedo} (${body.max.torpedo} Max)`, true)
|
.addField('❯ Torpedo', `${data.base.torpedo} (${data.max.torpedo} Max)`, true)
|
||||||
.addField('❯ Evasion', `${body.base.speed} (${body.max.speed} Max)`, true)
|
.addField('❯ Evasion', `${data.base.speed} (${data.max.speed} Max)`, true)
|
||||||
.addField('❯ Anti-Air', `${body.base.anti_air} (${body.max.anti_air} Max)`, true)
|
.addField('❯ Anti-Air', `${data.base.anti_air} (${data.max.anti_air} Max)`, true)
|
||||||
.addField('❯ Anti-Sub', `${body.base.anti_sub} (${body.max.anti_sub} Max)`, true)
|
.addField('❯ Anti-Sub', `${data.base.anti_sub} (${data.max.anti_sub} Max)`, true)
|
||||||
.addField('❯ Aviation', `${body.base.air_power} (${body.max.air_power} Max)`, true)
|
.addField('❯ Aviation', `${data.base.air_power} (${data.max.air_power} Max)`, true)
|
||||||
.addField('❯ Oil Cost', `${body.base.oil_usage} (${body.max.oil_usage} Max)`, true)
|
.addField('❯ Oil Cost', `${data.base.oil_usage} (${data.max.oil_usage} Max)`, true)
|
||||||
.addField('❯ Equipment', stripIndents`
|
.addField('❯ Equipment', stripIndents`
|
||||||
${body.equipment[0].equippable} (${body.equipment[0].efficiency})
|
${data.equipment[0].equippable} (${data.equipment[0].efficiency})
|
||||||
${body.equipment[1].equippable} (${body.equipment[1].efficiency})
|
${data.equipment[1].equippable} (${data.equipment[1].efficiency})
|
||||||
${body.equipment[2].equippable} (${body.equipment[2].efficiency})
|
${data.equipment[2].equippable} (${data.equipment[2].efficiency})
|
||||||
`)
|
`)
|
||||||
.addField('❯ Images',
|
.addField('❯ Images',
|
||||||
`${body.images.map(img => `[${img.name}](${img.url})`).join(', ')}, [Chibi](${body.chibi})`);
|
`${data.images.map(img => `[${img.name}](${img.url})`).join(', ')}, [Chibi](${data.chibi})`);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.status === 404) return msg.say('Could not find any results.');
|
if (err.status === 404) return msg.say('Could not find any results.');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "91.14.0",
|
"version": "91.14.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user