Add drop shadow to who-pokemon

This commit is contained in:
Dragon Fire
2024-03-24 13:10:26 -04:00
parent ef5386ddb8
commit b92eb79621
11 changed files with 2 additions and 582 deletions
-5
View File
@@ -33,14 +33,9 @@ NAME_RATER_EMOJI_ID=
ANILIST_USERNAME=
BITLY_KEY=
CLEVERBOT_KEY=
DEVIANTART_ID=
DEVIANTART_SECRET=
GIPHY_KEY=
GITHUB_ACCESS_TOKEN=
GOOGLE_KEY=
GOV_KEY=
OPENWEATHERMAP_KEY=
OSU_KEY=
SPOTIFY_KEY=
SPOTIFY_SECRET=
USPS_USERID=
-34
View File
@@ -1,34 +0,0 @@
const Command = require('../../framework/Command');
const { randomRange } = require('../../util/Util');
const fishes = require('../../assets/json/fishy');
module.exports = class FishyCommand extends Command {
constructor(client) {
super(client, {
name: 'fishy',
aliases: ['fishing', 'fish'],
group: 'games-sp',
memberName: 'fishy',
description: 'Go fishing.',
credit: [
{
name: 'Tatsumaki',
url: 'https://tatsumaki.xyz/',
reason: 'Concept'
}
]
});
}
run(msg) {
const fishID = Math.floor(Math.random() * 10) + 1;
let rarity;
if (fishID < 5) rarity = 'junk';
else if (fishID < 8) rarity = 'common';
else if (fishID < 10) rarity = 'uncommon';
else rarity = 'rare';
const fish = fishes[rarity];
const worth = randomRange(fish.min, fish.max);
return msg.reply(`You caught a ${fish.symbol}. I bet it'd sell for around $${worth}.`);
}
};
+2
View File
@@ -144,6 +144,8 @@ module.exports = class WhosThatPokemonCommand extends Command {
ctx.lineWidth = 8;
ctx.strokeStyle = '#3c5aa6';
ctx.strokeText(pokemon.name, 362, 158, 240);
ctx.fillStyle = 'black';
ctx.fillText(pokemon.name, 357, 163, 240);
ctx.fillStyle = '#ffcb05';
ctx.fillText(pokemon.name, 362, 158, 240);
}
-62
View File
@@ -1,62 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten } = require('../../util/Util');
module.exports = class BulbapediaCommand extends Command {
constructor(client) {
super(client, {
name: 'bulbapedia',
aliases: ['bulba'],
group: 'search',
memberName: 'bulbapedia',
description: 'Searches Bulbapedia for your query.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'Bulbapedia',
url: 'https://bulbapedia.bulbagarden.net/wiki/Main_Page',
reason: 'API',
reasonURL: 'https://bulbapedia.bulbagarden.net/w/api.php'
}
],
args: [
{
key: 'query',
prompt: 'What article would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const { body } = await request
.get('https://bulbapedia.bulbagarden.net/w/api.php')
.query({
action: 'query',
prop: 'extracts|pageimages',
format: 'json',
titles: query,
exintro: '',
explaintext: '',
pithumbsize: 150,
redirects: '',
formatversion: 2
});
const data = body.query.pages[0];
if (data.missing) return msg.say('Could not find any results.');
const embed = new MessageEmbed()
.setColor(0x3E7614)
.setTitle(data.title)
.setAuthor('Bulbapedia', 'https://i.imgur.com/ePpoeFA.png', 'https://bulbapedia.bulbagarden.net/')
.setThumbnail(data.thumbnail ? data.thumbnail.source : null)
.setURL(`https://bulbapedia.bulbagarden.net/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`)
.setDescription(shorten(data.extract.replaceAll('\n', '\n\n')));
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
-74
View File
@@ -1,74 +0,0 @@
const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { list } = require('../../util/Util');
const { DEVIANTART_ID, DEVIANTART_SECRET } = process.env;
const sections = ['dailydeviations', 'hot', 'newest', 'popular', 'undiscovered'];
module.exports = class DeviantartCommand extends Command {
constructor(client) {
super(client, {
name: 'deviantart',
group: 'search',
memberName: 'deviantart',
description: 'Responds with an image from a DeviantArt section, with optional query.',
details: `**Sections:** ${sections.join(', ')}`,
credit: [
{
name: 'DeviantArt',
url: 'https://www.deviantart.com/',
reason: 'API',
reasonURL: 'https://www.deviantart.com/developers/'
}
],
args: [
{
key: 'section',
prompt: `What section would you like to search? Either ${list(sections, 'or')}.`,
type: 'string',
oneOf: sections,
parse: section => section.toLowerCase()
},
{
key: 'query',
prompt: 'What image would you like to search for?',
type: 'string',
default: ''
}
]
});
this.token = null;
}
async run(msg, { section, query }) {
try {
if (!this.token) await this.fetchToken();
const { body } = await request
.get(`https://www.deviantart.com/api/v1/oauth2/browse/${section}`)
.query({
q: query,
limit: 120,
access_token: this.token,
mature_content: msg.channel.nsfw || false
});
const images = body.results.filter(image => image.content && image.content.src);
if (!images.length) return msg.say('Could not find any results.');
return msg.say(images[Math.floor(Math.random() * images.length)].content.src);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async fetchToken() {
const { body } = await request
.get('https://www.deviantart.com/oauth2/token')
.query({
grant_type: 'client_credentials',
client_id: DEVIANTART_ID,
client_secret: DEVIANTART_SECRET
});
this.token = body.access_token;
setTimeout(() => { this.token = null; }, body.expires_in * 1000);
return body;
}
};
-46
View File
@@ -1,46 +0,0 @@
const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { GIPHY_KEY } = process.env;
module.exports = class GiphyCommand extends Command {
constructor(client) {
super(client, {
name: 'giphy',
aliases: ['gif'],
group: 'search',
memberName: 'giphy',
description: 'Searches Giphy for your query.',
credit: [
{
name: 'GIPHY',
url: 'https://giphy.com/',
reason: 'API',
reasonURL: 'https://developers.giphy.com/'
}
],
args: [
{
key: 'query',
prompt: 'What GIF would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const { body } = await request
.get('http://api.giphy.com/v1/gifs/search')
.query({
q: query,
api_key: GIPHY_KEY,
rating: msg.channel.nsfw ? 'r' : 'pg'
});
if (!body.data.length) return msg.say('Could not find any results.');
return msg.say(body.data[Math.floor(Math.random() * body.data.length)].images.original.url);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
-78
View File
@@ -1,78 +0,0 @@
const Command = require('../../framework/Command');
const moment = require('moment');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
module.exports = class ItunesCommand extends Command {
constructor(client) {
super(client, {
name: 'itunes',
group: 'search',
memberName: 'itunes',
description: 'Searches iTunes for your query.',
details: '**Codes:** <https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'Apple',
url: 'https://www.apple.com/',
reason: 'iTunes Search API',
reasonURL: 'https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/'
},
{
name: 'Wikipedia',
url: 'https://www.wikipedia.org/',
reasonURL: 'https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes',
reason: 'Language Code Data'
}
],
args: [
{
key: 'country',
prompt: 'What country code should results be obtained for?',
type: 'string',
parse: country => country.toLowerCase()
},
{
key: 'query',
prompt: 'What song would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { country, query }) {
try {
const { text } = await request
.get('https://itunes.apple.com/search')
.query({
term: query,
media: 'music',
entity: 'song',
limit: 1,
explicit: msg.channel.nsfw ? 'yes' : 'no',
country
});
const body = JSON.parse(text);
if (!body.results.length) return msg.say('Could not find any results.');
const data = body.results[0];
const embed = new MessageEmbed()
.setColor(0xFEFEFE)
.setAuthor('iTunes', 'https://i.imgur.com/PR29ow0.jpg', 'https://www.apple.com/itunes/')
.setURL(data.trackViewUrl)
.setThumbnail(data.artworkUrl100)
.setTitle(data.trackName)
.addField(' Artist', data.artistName, true)
.addField(' Album', data.collectionName, true)
.addField(' Release Date', moment.utc(data.releaseDate).format('MM/DD/YYYY'), true)
.addField(' Genre', data.primaryGenreName, true);
return msg.embed(embed);
} catch (err) {
if (err.status === 400) {
return msg.reply('Invalid country code. Refer to <https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>.');
}
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
-83
View File
@@ -1,83 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { formatNumber } = require('../../util/Util');
module.exports = class SteamCommand extends Command {
constructor(client) {
super(client, {
name: 'steam',
group: 'search',
memberName: 'steam',
description: 'Searches Steam for your query.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'Steam',
url: 'https://store.steampowered.com/',
reason: 'API'
}
],
args: [
{
key: 'query',
prompt: 'What game would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const id = await this.search(query);
if (!id) return msg.say('Could not find any results.');
const data = await this.fetchGame(id);
const current = data.price_overview ? `$${data.price_overview.final / 100}` : 'Free';
const original = data.price_overview ? `$${data.price_overview.initial / 100}` : 'Free';
const price = current === original ? current : `~~${original}~~ ${current}`;
const platforms = [];
if (data.platforms) {
if (data.platforms.windows) platforms.push('Windows');
if (data.platforms.mac) platforms.push('Mac');
if (data.platforms.linux) platforms.push('Linux');
}
const embed = new MessageEmbed()
.setColor(0x101D2F)
.setAuthor('Steam', 'https://i.imgur.com/xxr2UBZ.png', 'http://store.steampowered.com/')
.setTitle(data.name)
.setURL(`http://store.steampowered.com/app/${data.steam_appid}`)
.setThumbnail(data.header_image)
.addField(' Price', price, true)
.addField(' Metascore', data.metacritic ? data.metacritic.score : '???', true)
.addField(' Recommendations', data.recommendations ? formatNumber(data.recommendations.total) : '???', true)
.addField(' Platforms', platforms.join(', ') || 'None', true)
.addField(' Release Date', data.release_date ? data.release_date.date : '???', true)
.addField(' DLC Count', data.dlc ? formatNumber(data.dlc.length) : 0, true)
.addField(' Developers', data.developers ? data.developers.join(', ') || '???' : '???')
.addField(' Publishers', data.publishers ? data.publishers.join(', ') || '???' : '???');
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async search(query) {
const { body } = await request
.get('https://store.steampowered.com/api/storesearch')
.query({
cc: 'us',
l: 'en',
term: query
});
if (!body.items.length) return null;
return body.items[0].id;
}
async fetchGame(id) {
const { body } = await request
.get('https://store.steampowered.com/api/appdetails')
.query({ appids: id });
return body[id.toString()].data;
}
};
-66
View File
@@ -1,66 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { OPENWEATHERMAP_KEY } = process.env;
module.exports = class WeatherCommand extends Command {
constructor(client) {
super(client, {
name: 'weather',
aliases: ['open-weather-map', 'owm'],
group: 'search',
memberName: 'weather',
description: 'Responds with weather information for a specific location.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'OpenWeatherMap',
url: 'https://openweathermap.org/',
reason: 'API',
reasonURL: 'https://openweathermap.org/api'
}
],
args: [
{
key: 'location',
prompt: 'What location would you like to get the weather of?',
type: 'string',
parse: location => {
if (/^[0-9]+$/.test(location)) return { type: 'zip', data: location };
return { type: 'q', data: location };
}
}
]
});
}
async run(msg, { location }) {
try {
const { body } = await request
.get('https://api.openweathermap.org/data/2.5/weather')
.query({
q: location.type === 'q' ? location.data : '',
zip: location.type === 'zip' ? location.data : '',
units: 'imperial',
appid: OPENWEATHERMAP_KEY
});
const embed = new MessageEmbed()
.setColor(0xFF7A09)
.setAuthor(
`${body.name}, ${body.sys.country}`,
'https://i.imgur.com/NjMbE9o.png',
'https://openweathermap.org/city'
)
.setURL(`https://openweathermap.org/city/${body.id}`)
.setTimestamp()
.addField(' Condition', body.weather.map(data => `${data.main} (${data.description})`).join('\n'))
.addField(' Temperature', `${body.main.temp}°F`, true)
.addField(' Humidity', `${body.main.humidity}%`, true)
.addField(' Wind Speed', `${body.wind.speed} mph`, true);
return msg.embed(embed);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
-80
View File
@@ -1,80 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
module.exports = class WikiaCommand extends Command {
constructor(client) {
super(client, {
name: 'wikia',
aliases: ['fandom'],
group: 'search',
memberName: 'wikia',
description: 'Searches a specific Wikia wiki for your query.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'FANDOM',
url: 'https://www.fandom.com/',
reason: 'API',
reasonURL: 'https://www.wikia.com/api/v1/'
}
],
args: [
{
key: 'wiki',
prompt: 'What is the subdomain of the wiki you want to search?',
type: 'string',
parse: wiki => encodeURIComponent(wiki)
},
{
key: 'query',
prompt: 'What article would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { wiki, query }) {
try {
const id = await this.search(wiki, query);
if (!id) return msg.say('Could not find any results.');
const { data, basePath } = await this.fetchArticle(wiki, id);
const embed = new MessageEmbed()
.setColor(0x002D54)
.setTitle(data.title)
.setURL(`${basePath}${data.url}`)
.setAuthor('FANDOM', 'https://i.imgur.com/kBDqFIN.png', 'https://www.fandom.com/')
.setDescription(data.abstract)
.setThumbnail(data.thumbnail);
return msg.embed(embed);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Perhaps you entered an invalid wiki?`);
}
}
async search(wiki, query) {
const { body } = await request
.get(`https://${wiki}.fandom.com/api.php`)
.query({
action: 'query',
titles: query,
redirects: '',
format: 'json',
formatversion: 2
});
if (!body.query || body.query.pages[0].missing) return null;
return body.query.pages[0].pageid;
}
async fetchArticle(wiki, id) {
const { body } = await request
.get(`https://${wiki}.fandom.com/api/v1/Articles/Details`)
.query({
ids: id,
abstract: 500
});
return { data: body.items[id.toString()], basePath: body.basepath };
}
};
-54
View File
@@ -1,54 +0,0 @@
const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
module.exports = class WikihowCommand extends Command {
constructor(client) {
super(client, {
name: 'wikihow',
aliases: ['how-to', 'how'],
group: 'search',
memberName: 'wikihow',
description: 'Searches Wikihow for your query.',
credit: [
{
name: 'wikiHow',
url: 'https://www.wikihow.com/Main-Page',
reason: 'API',
reasonURL: 'https://www.wikihow.com/api.php'
}
],
args: [
{
key: 'query',
prompt: 'What article would you like to search for?',
type: 'string',
parse: query => query.replace(/^((how )?to )/i, '')
}
]
});
}
async run(msg, { query }) {
try {
const { body } = await request
.get('https://www.wikihow.com/api.php')
.query({
action: 'query',
prop: 'info',
format: 'json',
titles: query,
inprop: 'url',
redirects: ''
});
const data = body.query.pages[Object.keys(body.query.pages)[0]];
if (data.missing === '') return msg.say('Could not find any results.');
return msg.say(stripIndents`
How to ${data.title}
${data.fullurl}
`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};