mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 02:15:10 +02:00
Fix currency, add reason URL to credit
This commit is contained in:
@@ -15,7 +15,7 @@ module.exports = class CurrencyCommand extends Command {
|
|||||||
name: 'Fawaz Ahmed',
|
name: 'Fawaz Ahmed',
|
||||||
url: 'https://github.com/fawazahmed0',
|
url: 'https://github.com/fawazahmed0',
|
||||||
reason: 'API',
|
reason: 'API',
|
||||||
reasonURL: 'https://github.com/fawazahmed0/currency-api'
|
reasonURL: 'https://github.com/fawazahmed0/exchange-api'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
args: [
|
args: [
|
||||||
@@ -54,7 +54,7 @@ module.exports = class CurrencyCommand extends Command {
|
|||||||
|
|
||||||
async fetchCurrencies() {
|
async fetchCurrencies() {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get('https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json');
|
.get('https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies.json');
|
||||||
this.currencies = body;
|
this.currencies = body;
|
||||||
setTimeout(() => { this.currencies = null; }, 1.8e+6);
|
setTimeout(() => { this.currencies = null; }, 1.8e+6);
|
||||||
return this.currencies;
|
return this.currencies;
|
||||||
@@ -62,7 +62,7 @@ module.exports = class CurrencyCommand extends Command {
|
|||||||
|
|
||||||
async fetchRate(base, target) {
|
async fetchRate(base, target) {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get(`https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/${base}/${target}.json`);
|
.get(`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${base}/${target}.json`);
|
||||||
return body[target];
|
return body[target];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,9 +25,10 @@ module.exports = class GenerateCreditCommand extends Command {
|
|||||||
.sort((a, b) => a.name.localeCompare(b.name));
|
.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
if (!commands.size) return null;
|
if (!commands.size) return null;
|
||||||
return commands.map(c => {
|
return commands.map(c => {
|
||||||
|
const reason = cred.reasonURL ? `[${cred.reason}](${cred.reasonURL})` : cred.reason;
|
||||||
const credits = c.credit
|
const credits = c.credit
|
||||||
.filter(cred => cred.name !== 'Dragon Fire')
|
.filter(cred => cred.name !== 'Dragon Fire')
|
||||||
.map(cred => `[${cred.name}](${cred.url}) (${cred.reason})`);
|
.map(cred => `[${cred.name}](${cred.url}) (${reason})`);
|
||||||
return `* **${c.name}:**\n - ${credits.join('\n - ')}`;
|
return `* **${c.name}:**\n - ${credits.join('\n - ')}`;
|
||||||
}).join('\n');
|
}).join('\n');
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user