From f941a73a51417d9ef7b2acb47400a4d8d21b00bd Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 22 Mar 2024 13:01:10 -0400 Subject: [PATCH] Fix ygo --- commands/search/youtube.js | 63 ------------------------------------- commands/search/yu-gi-oh.js | 6 ++-- 2 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 commands/search/youtube.js diff --git a/commands/search/youtube.js b/commands/search/youtube.js deleted file mode 100644 index cdcef069..00000000 --- a/commands/search/youtube.js +++ /dev/null @@ -1,63 +0,0 @@ -const Command = require('../../framework/Command'); -const moment = require('moment'); -const { MessageEmbed } = require('discord.js'); -const request = require('node-superfetch'); -const { GOOGLE_KEY } = process.env; - -module.exports = class YoutubeCommand extends Command { - constructor(client) { - super(client, { - name: 'youtube', - aliases: ['y-tube', 'u-tube', 'yt'], - group: 'search', - memberName: 'youtube', - description: 'Searches YouTube for your query.', - clientPermissions: ['EMBED_LINKS'], - credit: [ - { - name: 'Google', - url: 'https://www.google.com/', - reason: 'YouTube Data API', - reasonURL: 'https://developers.google.com/youtube/v3/' - } - ], - args: [ - { - key: 'query', - prompt: 'What video would you like to search for?', - type: 'string' - } - ] - }); - } - - async run(msg, { query }) { - try { - const { body } = await request - .get('https://www.googleapis.com/youtube/v3/search') - .query({ - part: 'snippet', - type: 'video', - maxResults: 1, - q: query, - safeSearch: msg.channel.nsfw ? 'none' : 'strict', - key: GOOGLE_KEY - }); - if (!body.items.length) return msg.say('Could not find any results.'); - const data = body.items[0]; - const embed = new MessageEmbed() - .setColor(0xDD2825) - .setTitle(data.snippet.title) - .setDescription(data.snippet.description) - .setAuthor('YouTube', 'https://i.imgur.com/kKHJg9Q.png', 'https://www.youtube.com/') - .setURL(`https://www.youtube.com/watch?v=${data.id.videoId}`) - .setThumbnail(data.snippet.thumbnails.default ? data.snippet.thumbnails.default.url : null) - .addField('❯ ID', data.id.videoId, true) - .addField('❯ Publish Date', moment.utc(data.snippet.publishedAt).format('MM/DD/YYYY h:mm A'), true) - .addField('❯ Channel', data.snippet.channelTitle, true); - return msg.embed(embed); - } catch (err) { - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } -}; diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js index ed5d84e1..6a74e433 100644 --- a/commands/search/yu-gi-oh.js +++ b/commands/search/yu-gi-oh.js @@ -58,11 +58,11 @@ module.exports = class YuGiOhCommand extends Command { if (data.type.includes('Monster')) { embed .addField('❯ Attribute', data.attribute, true) - .addField('❯ Level', data.level || 'N/A', true) - .addField('❯ ATK', formatNumber(data.atk), true) + .addField('❯ Level', data.level?.toString() || 'N/A', true) + .addField('❯ ATK', formatNumber(data.atk).toString(), true) .addField( data.type === 'Link Monster' ? '❯ Link Value' : '❯ DEF', - formatNumber(data.type === 'Link Monster' ? data.linkval : data.def), + formatNumber(data.type === 'Link Monster' ? data.linkval : data.def).toString(), true ); }