Use JSON for logos

This commit is contained in:
Dragon Fire
2024-03-30 13:13:01 -04:00
parent a135cac031
commit ec38daefa3
18 changed files with 48 additions and 21 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"github": "https://i.imgur.com/e4HunUm.png",
"eslint": "https://i.imgur.com/04GhEhU.png",
"npm": "https://i.imgur.com/ErKf5Y0.png",
"googleTranslate": "https://i.imgur.com/h3RoHyp.png",
"nasa": "https://i.imgur.com/Wh8jY9c.png",
"anilist": "https://i.imgur.com/iUIRC7v.png",
"kym": "https://i.imgur.com/WvcH4Z2.png",
"neopets": "https://i.imgur.com/BP8qxJH.png",
"urban": "https://i.imgur.com/Fo0nRTe.png",
"wikipedia": "https://i.imgur.com/Z7NJBK2.png",
"yugioh": "https://i.imgur.com/AJNBflD.png",
"youtube": "https://i.imgur.com/kKHJg9Q.png"
}
+2 -1
View File
@@ -3,6 +3,7 @@ const moment = require('moment');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, formatNumber } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const { GITHUB_ACCESS_TOKEN } = process.env;
module.exports = class GithubCommand extends Command {
@@ -44,7 +45,7 @@ module.exports = class GithubCommand extends Command {
.set({ Authorization: `token ${GITHUB_ACCESS_TOKEN}` });
const embed = new MessageEmbed()
.setColor(0xFFFFFF)
.setAuthor('GitHub', 'https://i.imgur.com/e4HunUm.png', 'https://github.com/')
.setAuthor('GitHub', logos.github, 'https://github.com/')
.setTitle(body.full_name)
.setURL(body.html_url)
.setDescription(body.description ? shorten(body.description) : 'No description.')
+2 -1
View File
@@ -1,5 +1,6 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const logos = require('../../assets/json/logos');
const { Linter } = require('eslint');
const linter = new Linter();
const rules = linter.getRules();
@@ -27,7 +28,7 @@ module.exports = class LintRuleCommand extends Command {
if (!rules.has(rule)) return msg.say('Could not find any results.');
const data = rules.get(rule).meta;
const embed = new MessageEmbed()
.setAuthor('ESLint', 'https://i.imgur.com/04GhEhU.png', 'https://eslint.org/')
.setAuthor('ESLint', logos.eslint, 'https://eslint.org/')
.setColor(0x3A33D1)
.setTitle(rule)
.setURL(data.docs.url)
+2 -1
View File
@@ -3,6 +3,7 @@ const moment = require('moment');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { trimArray } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class NPMCommand extends Command {
constructor(client) {
@@ -39,7 +40,7 @@ module.exports = class NPMCommand extends Command {
const dependencies = version.dependencies ? trimArray(Object.keys(version.dependencies)) : null;
const embed = new MessageEmbed()
.setColor(0xCB0000)
.setAuthor('NPM', 'https://i.imgur.com/ErKf5Y0.png', 'https://www.npmjs.com/')
.setAuthor('NPM', logos.npm, 'https://www.npmjs.com/')
.setTitle(body.name)
.setURL(`https://www.npmjs.com/package/${pkg}`)
.setDescription(body.description || 'No description.')
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const translate = require('@vitalets/google-translate-api');
const { list } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const codes = Object.keys(translate.languages).filter(code => typeof translate.languages[code] !== 'function');
module.exports = class TranslateCommand extends Command {
@@ -55,7 +56,7 @@ module.exports = class TranslateCommand extends Command {
const { text: result, from } = await translate(text, { to: target, from: base });
const embed = new MessageEmbed()
.setColor(0x4285F4)
.setFooter('Powered by Google Translate', 'https://i.imgur.com/h3RoHyp.png')
.setFooter('Powered by Google Translate', logos.googleTranslate)
.addField(` From: ${translate.languages[from.language.iso]}`, from.text.value || text)
.addField(` To: ${translate.languages[target]}`, result);
return msg.embed(embed);
+2 -5
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { shorten } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const { GOV_KEY } = process.env;
module.exports = class ApodCommand extends Command {
@@ -32,11 +33,7 @@ module.exports = class ApodCommand extends Command {
.setTitle(body.title)
.setDescription(shorten(body.explanation))
.setColor(0x2E528E)
.setAuthor(
'Astronomy Picture of the Day',
'https://i.imgur.com/Wh8jY9c.png',
'https://apod.nasa.gov/apod/astropix.html'
)
.setAuthor('Astronomy Picture of the Day', logos.nasa, 'https://apod.nasa.gov/apod/astropix.html')
.setImage(body.media_type === 'image' ? body.url : null)
.setURL(body.url)
.setFooter(`Image Credits: ${body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain'}`)
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const logos = require('../../assets/json/logos');
const searchGraphQL = stripIndents`
query ($page: Int, $type: MediaType, $isAdult: Boolean) {
Page (page: $page) {
@@ -60,7 +61,7 @@ module.exports = class AnimeScoreCommand extends Command {
const anime = await this.getRandomAnime(msg.channel.nsfw);
const embed = new MessageEmbed()
.setColor(0x02A9FF)
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
.setImage(anime.coverImage.large || anime.coverImage.medium || null)
.setTitle(anime.title.english || anime.title.romaji)
.setDescription(`_${anime.startDate.year}, ${formats[anime.format]}_`)
+2 -1
View File
@@ -3,6 +3,7 @@ const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { embedURL, cleanAnilistHTML, trimArray } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const searchGraphQL = stripIndents`
query ($search: String) {
characters: Page (perPage: 1) {
@@ -76,7 +77,7 @@ module.exports = class AnimeCharacterCommand extends Command {
const character = await this.fetchCharacter(id);
const embed = new MessageEmbed()
.setColor(0x02A9FF)
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
.setURL(character.siteUrl)
.setThumbnail(character.image.large || character.image.medium || null)
.setTitle(`${character.name.first || ''}${character.name.last ? ` ${character.name.last}` : ''}`)
+2 -1
View File
@@ -3,6 +3,7 @@ const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { embedURL, cleanAnilistHTML, trimArray } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const searchGraphQL = stripIndents`
query ($search: String) {
staff: Page (perPage: 1) {
@@ -96,7 +97,7 @@ module.exports = class AnimeStaffCommand extends Command {
const staff = await this.fetchStaff(id);
const embed = new MessageEmbed()
.setColor(0x02A9FF)
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
.setURL(staff.siteUrl)
.setThumbnail(staff.image.large || staff.image.medium || null)
.setTitle(`${staff.name.first || ''}${staff.name.last ? ` ${staff.name.last}` : ''}`)
+2 -1
View File
@@ -4,6 +4,7 @@ const request = require('node-superfetch');
const cheerio = require('cheerio');
const { stripIndents } = require('common-tags');
const { cleanAnilistHTML, embedURL } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const ANILIST_USERNAME = process.env.ANILIST_USERNAME || 'dragonfire535';
const searchGraphQL = stripIndents`
query ($search: String, $type: MediaType, $isAdult: Boolean) {
@@ -119,7 +120,7 @@ module.exports = class AnimeCommand extends Command {
const malURL = `https://myanimelist.net/anime/${anime.idMal}`;
const embed = new MessageEmbed()
.setColor(0x02A9FF)
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
.setURL(anime.siteUrl)
.setThumbnail(anime.coverImage.large || anime.coverImage.medium || null)
.setTitle(anime.title.english || anime.title.romaji)
+2 -1
View File
@@ -3,6 +3,7 @@ const request = require('node-superfetch');
const cheerio = require('cheerio');
const { MessageEmbed } = require('discord.js');
const { shorten } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class KnowYourMemeCommand extends Command {
constructor(client) {
@@ -35,7 +36,7 @@ module.exports = class KnowYourMemeCommand extends Command {
const data = await this.fetchMeme(location);
const embed = new MessageEmbed()
.setColor(0x12133F)
.setAuthor('Know Your Meme', 'https://i.imgur.com/WvcH4Z2.png', 'https://knowyourmeme.com/')
.setAuthor('Know Your Meme', logos.kym, 'https://knowyourmeme.com/')
.setTitle(data.name)
.setDescription(shorten(data.description || 'No description available.'))
.setURL(data.url)
+2 -1
View File
@@ -4,6 +4,7 @@ const request = require('node-superfetch');
const cheerio = require('cheerio');
const { stripIndents } = require('common-tags');
const { cleanAnilistHTML, embedURL } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const ANILIST_USERNAME = process.env.ANILIST_USERNAME || 'dragonfire535';
const searchGraphQL = stripIndents`
query ($search: String, $type: MediaType, $isAdult: Boolean) {
@@ -112,7 +113,7 @@ module.exports = class MangaCommand extends Command {
const malURL = `https://myanimelist.net/manga/${manga.idMal}`;
const embed = new MessageEmbed()
.setColor(0x02A9FF)
.setAuthor('AniList', 'https://i.imgur.com/iUIRC7v.png', 'https://anilist.co/')
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
.setURL(manga.siteUrl)
.setThumbnail(manga.coverImage.large || manga.coverImage.medium || null)
.setTitle(manga.title.english || manga.title.romaji)
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { shorten, embedURL } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class NASACommand extends Command {
constructor(client) {
@@ -42,7 +43,7 @@ module.exports = class NASACommand extends Command {
.setTitle(shorten(data.data[0].title, 256))
.setDescription(shorten(this.cleanHTML(data.data[0].description)))
.setColor(0x2E528E)
.setAuthor('NASA', 'https://i.imgur.com/Wh8jY9c.png', 'https://www.nasa.gov/multimedia/imagegallery/index.html')
.setAuthor('NASA', logos.nasa, 'https://www.nasa.gov/multimedia/imagegallery/index.html')
.setImage(`https://images-assets.nasa.gov/image/${data.data[0].nasa_id}/${data.data[0].nasa_id}~thumb.jpg`)
.setFooter(`Image Credits: ${data.data[0].center || 'Public Domain'}`)
.setTimestamp(new Date(data.data[0].date_created));
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { formatNumber } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class NeopetsItemCommand extends Command {
constructor(client) {
@@ -38,7 +39,7 @@ module.exports = class NeopetsItemCommand extends Command {
if (!data) return msg.say('Could not find any results.');
const embed = new MessageEmbed()
.setColor(0xFFCE31)
.setAuthor('Neopets', 'https://i.imgur.com/BP8qxJH.png', 'http://www.neopets.com/')
.setAuthor('Neopets', logos.neopets, 'http://www.neopets.com/')
.setTitle(data.name)
.setDescription(data.details)
.setURL(data.url)
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, formatNumber } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class UrbanCommand extends Command {
constructor(client) {
@@ -37,7 +38,7 @@ module.exports = class UrbanCommand extends Command {
const data = body.list[0];
const embed = new MessageEmbed()
.setColor(0x32A8F0)
.setAuthor('Urban Dictionary', 'https://i.imgur.com/Fo0nRTe.png', 'https://www.urbandictionary.com/')
.setAuthor('Urban Dictionary', logos.urban, 'https://www.urbandictionary.com/')
.setURL(data.permalink)
.setTitle(data.word)
.setDescription(shorten(data.definition.replace(/\[|\]/g, '')))
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class WikipediaCommand extends Command {
constructor(client) {
@@ -46,7 +47,7 @@ module.exports = class WikipediaCommand extends Command {
const embed = new MessageEmbed()
.setColor(0xE7E7E7)
.setTitle(data.title)
.setAuthor('Wikipedia', 'https://i.imgur.com/Z7NJBK2.png', 'https://www.wikipedia.org/')
.setAuthor('Wikipedia', logos.wikipedia, 'https://www.wikipedia.org/')
.setURL(`https://en.wikipedia.org/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`)
.setDescription(shorten(data.extract.replaceAll('\n', '\n\n')));
return msg.embed(embed);
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, formatNumber } = require('../../util/Util');
const logos = require('../../assets/json/logos');
module.exports = class YuGiOhCommand extends Command {
constructor(client) {
@@ -48,7 +49,7 @@ module.exports = class YuGiOhCommand extends Command {
.setTitle(data.name)
.setURL(`https://db.ygoprodeck.com/card/?search=${data.id}`)
.setDescription(data.type === 'Normal Monster' ? `_${shorten(data.desc)}_` : shorten(data.desc))
.setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/AJNBflD.png', 'http://www.yugioh-card.com/')
.setAuthor('Yu-Gi-Oh!', logos.yugioh, 'http://www.yugioh-card.com/')
.setThumbnail(data.card_images[0].image_url)
.setFooter(data.id.toString())
.addField(' Type', data.type, true)
+2 -1
View File
@@ -3,6 +3,7 @@ const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const ytdl = require('ytdl-core');
const { shorten, verify } = require('../../util/Util');
const logos = require('../../assets/json/logos');
const { GOOGLE_KEY } = process.env;
module.exports = class PlayCommand extends Command {
@@ -88,7 +89,7 @@ module.exports = class PlayCommand extends Command {
.setColor(0xDD2825)
.setTitle(shorten(data.videoDetails.title, 70))
.setDescription(shorten(data.videoDetails.description, 100))
.setAuthor('YouTube', 'https://i.imgur.com/kKHJg9Q.png', 'https://www.youtube.com/')
.setAuthor('YouTube', logos.youtube, 'https://www.youtube.com/')
.setURL(data.videoDetails.video_url)
.setThumbnail(data.videoDetails.thumbnails.length ? data.videoDetails.thumbnails[0].url : null)
.addField(' ID', data.videoDetails.videoId, true)