Remove more commands

This commit is contained in:
Dragon Fire
2024-03-21 21:01:13 -04:00
parent 706ba4c179
commit a72bb293fe
19 changed files with 0 additions and 741 deletions
-70
View File
@@ -1,70 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, pickWhenMany } = require('../../util/Util');
const { TMDB_KEY } = process.env;
module.exports = class MovieCommand extends Command {
constructor(client) {
super(client, {
name: 'movie',
aliases: ['tmdb-movie', 'imdb'],
group: 'search',
memberName: 'movie',
description: 'Searches TMDB for your query, getting movie results.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'The Movie Database',
url: 'https://www.themoviedb.org/',
reason: 'API',
reasonURL: 'https://www.themoviedb.org/documentation/api'
}
],
args: [
{
key: 'query',
prompt: 'What movie would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const search = await request
.get('http://api.themoviedb.org/3/search/movie')
.query({
api_key: TMDB_KEY,
include_adult: msg.channel.nsfw || false,
query
});
if (!search.body.results.length) return msg.say('Could not find any results.');
let find = search.body.results.find(m => m.title.toLowerCase() === query.toLowerCase())
|| search.body.results[0];
if (search.body.results.length > 1) {
const resultListFunc = (movie, i) => `**${i + 1}.** ${movie.title} (${movie.release_date || 'TBA'})`;
find = await pickWhenMany(msg, search.body.results, find, resultListFunc);
}
const { body } = await request
.get(`https://api.themoviedb.org/3/movie/${find.id}`)
.query({ api_key: TMDB_KEY });
const embed = new MessageEmbed()
.setColor(0x00D474)
.setTitle(body.title)
.setURL(`https://www.themoviedb.org/movie/${body.id}`)
.setAuthor('TMDB', 'https://i.imgur.com/3K3QMv9.png', 'https://www.themoviedb.org/')
.setDescription(body.overview ? shorten(body.overview) : 'No description available.')
.setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null)
.addField(' Runtime', body.runtime ? `${body.runtime} mins.` : '???', true)
.addField(' Release Date', body.release_date || '???', true)
.addField(' Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???')
.addField(' Production Companies',
body.production_companies.length ? body.production_companies.map(c => c.name).join(', ') : '???');
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
-58
View File
@@ -1,58 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const moment = require('moment');
const { formatNumber } = require('../../util/Util');
module.exports = class RedditCommand extends Command {
constructor(client) {
super(client, {
name: 'reddit',
aliases: ['u/'],
group: 'search',
memberName: 'reddit',
description: 'Responds with information on a Reddit user.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'Reddit',
url: 'https://www.reddit.com/',
reason: 'API',
reasonURL: 'https://www.reddit.com/dev/api/'
}
],
args: [
{
key: 'user',
prompt: 'What user would you like to get information on?',
type: 'string',
parse: user => encodeURIComponent(user)
}
]
});
}
async run(msg, { user }) {
try {
const { body } = await request.get(`https://www.reddit.com/user/${user}/about.json`);
const { data } = body;
if (data.hide_from_robots) return msg.say('This user is hidden from bots.');
const embed = new MessageEmbed()
.setColor(0xFF4500)
.setAuthor('Reddit', 'https://i.imgur.com/DSBOK0P.png', 'https://www.reddit.com/')
.setThumbnail(data.icon_img)
.setURL(`https://www.reddit.com/user/${user}`)
.setTitle(`/u/${data.name}`)
.addField(' Username', data.name, true)
.addField(' ID', data.id, true)
.addField(' Karma', formatNumber(data.link_karma + data.comment_karma), true)
.addField(' Creation Date', moment.utc(data.created_utc * 1000).format('MM/DD/YYYY h:mm A'), true)
.addField(' Gold?', data.is_gold ? 'Yes' : 'No', true)
.addField(' Verified?', data.verified ? 'Yes' : 'No', true);
return msg.embed(embed);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
-64
View File
@@ -1,64 +0,0 @@
const Command = require('../../framework/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { shorten } = require('../../util/Util');
const { UNSPLASH_KEY } = process.env;
module.exports = class StockPhotoCommand extends Command {
constructor(client) {
super(client, {
name: 'stock-photo',
aliases: ['unsplash', 'stock-image', 'stock-img'],
group: 'search',
memberName: 'stock-photo',
description: 'Searches for stock photos based on your query.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'Unsplash',
url: 'https://unsplash.com/',
reason: 'API',
reasonURL: 'https://unsplash.com/developers'
}
],
args: [
{
key: 'query',
prompt: 'What image would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const { body } = await request
.get('https://api.unsplash.com/photos/random')
.set({ Authorization: `Client-ID ${UNSPLASH_KEY}` })
.query({
query,
content_filter: msg.channel.nsfw ? 'low' : 'high'
});
await this.triggerDownload(body);
const embed = new MessageEmbed()
.setTitle(body.description ? shorten(body.description, 256) : 'Unnamed Image')
.setURL(body.user.links.html)
.setColor(body.color)
.setAuthor(body.user.name || body.user.username, undefined, body.user.links.html)
.setImage(body.urls.raw)
.setFooter(`Photo by ${body.user.name || body.user.username} on Unsplash`)
.setTimestamp(new Date(body.updated_at));
return msg.embed(embed);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
triggerDownload(body) {
return request
.get(body.links.download_location)
.set({ Authorization: `Client-ID ${UNSPLASH_KEY}` });
}
};
-72
View File
@@ -1,72 +0,0 @@
const Command = require('../../framework/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, formatNumber, pickWhenMany } = require('../../util/Util');
const { TMDB_KEY } = process.env;
module.exports = class TvShowCommand extends Command {
constructor(client) {
super(client, {
name: 'tv-show',
aliases: ['tmdb-tv-show', 'tv', 'tmdb-tv'],
group: 'search',
memberName: 'tv-show',
description: 'Searches TMDB for your query, getting TV show results.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'The Movie Database',
url: 'https://www.themoviedb.org/',
reason: 'API',
reasonURL: 'https://www.themoviedb.org/documentation/api'
}
],
args: [
{
key: 'query',
prompt: 'What TV show would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const search = await request
.get('http://api.themoviedb.org/3/search/tv')
.query({
api_key: TMDB_KEY,
include_adult: msg.channel.nsfw || false,
query
});
if (!search.body.results.length) return msg.say('Could not find any results.');
let find = search.body.results.find(m => m.name.toLowerCase() === query.toLowerCase())
|| search.body.results[0];
if (search.body.results.length > 1) {
const resultListFunc = (show, i) => `**${i + 1}.** ${show.name} (${show.first_air_date || 'TBA'})`;
find = await pickWhenMany(msg, search.body.results, find, resultListFunc);
}
const { body } = await request
.get(`https://api.themoviedb.org/3/tv/${find.id}`)
.query({ api_key: TMDB_KEY });
const embed = new MessageEmbed()
.setColor(0x00D474)
.setTitle(body.name)
.setURL(`https://www.themoviedb.org/tv/${body.id}`)
.setAuthor('TMDB', 'https://i.imgur.com/3K3QMv9.png', 'https://www.themoviedb.org/')
.setDescription(body.overview ? shorten(body.overview) : 'No description available.')
.setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null)
.addField(' First Air Date', body.first_air_date || '???', true)
.addField(' Last Air Date', body.last_air_date || '???', true)
.addField(' Seasons', body.number_of_seasons ? formatNumber(body.number_of_seasons) : '???', true)
.addField(' Episodes', body.number_of_episodes ? formatNumber(body.number_of_episodes) : '???', true)
.addField(' Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???')
.addField(' Production Companies',
body.production_companies.length ? body.production_companies.map(c => c.name).join(', ') : '???');
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};