mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 15:19:14 +02:00
Fix lint
This commit is contained in:
@@ -32,11 +32,12 @@ module.exports = class CountryCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
const { body } = await request.get(`https://restcountries.eu/rest/v2/name/${encodeURIComponent(query)}`);
|
const { body } = await request.get(`https://restcountries.eu/rest/v2/name/${encodeURIComponent(query)}`);
|
||||||
const data = body.find(country => {
|
const data = body.find(country => {
|
||||||
return country.name.toLowerCase() === query.toLowerCase()
|
const search = query.toLowerCase();
|
||||||
|| country.altSpellings.some(alt => alt.toLowerCase() === query.toLowerCase())
|
return country.name.toLowerCase() === search
|
||||||
|| country.alpha2Code.toLowerCase() === query.toLowerCase()
|
|| country.altSpellings.some(alt => alt.toLowerCase() === search)
|
||||||
|| country.alpha3Code.toLowerCase() === query.toLowerCase()
|
|| country.alpha2Code.toLowerCase() === search
|
||||||
|| country.nativeName.toLowerCase() === query.toLowerCase()
|
|| country.alpha3Code.toLowerCase() === search
|
||||||
|
|| country.nativeName.toLowerCase() === search
|
||||||
}) || body[0];
|
}) || body[0];
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0x00AE86)
|
.setColor(0x00AE86)
|
||||||
|
|||||||
Reference in New Issue
Block a user