mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Stuff
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports = class DefineCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${WORDNIK_KEY}`);
|
||||
if (body.length === 0) throw new Error('No Results.');
|
||||
if (!body.length) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setTitle(body[0].word)
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = class ForecastCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`);
|
||||
if (body.query.count === 0) throw new Error('Location Not Found.');
|
||||
if (!body.query.count) throw new Error('Location Not Found.');
|
||||
const forecasts = body.query.results.channel.item.forecast;
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x0000FF)
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = class KonachanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'konachan',
|
||||
group: 'randomimg',
|
||||
group: 'search',
|
||||
memberName: 'konachan',
|
||||
description: 'Sends a random (Possibly NSFW!) anime image from Konachan, with optional query.',
|
||||
guildOnly: true,
|
||||
@@ -28,6 +28,7 @@ module.exports = class KonachanCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://konachan.net/post.json?tags=${query ? `${query}%20` : ''}order:random&limit=1`);
|
||||
if (!body.length) throw new Error('No Results.');
|
||||
return msg.channel.send(query ? `Result for ${query}:` : 'Random Image:', { files: [`https:${body[0].file_url}`] })
|
||||
.catch(err => msg.say(err));
|
||||
} catch (err) {
|
||||
@@ -29,7 +29,7 @@ module.exports = class OsuCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://osu.ppy.sh/api/get_user?k=${OSU_KEY}&u=${query}&type=string`);
|
||||
if (body.length === 0) throw new Error('No Results.');
|
||||
if (!body.length) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xFF66AA)
|
||||
.setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png')
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${SOUNDCLOUD_KEY}`);
|
||||
if (body.length === 0) throw new Error('No Results.');
|
||||
if (!body.length) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xF15A22)
|
||||
.setAuthor(body[0].title, 'https://i.imgur.com/lFIz7RU.png')
|
||||
|
||||
@@ -28,7 +28,7 @@ module.exports = class UrbanCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.urbandictionary.com/v0/define?term=${query}`);
|
||||
if (body.list.length === 0) throw new Error('No Results.');
|
||||
if (!body.list.length) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x32a8f0)
|
||||
.setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png')
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = class WattpadCommand extends Command {
|
||||
const { body } = await request
|
||||
.get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`)
|
||||
.set({ 'Authorization': `Basic ${WATTPAD_KEY}` });
|
||||
if (body.stories.length === 0) throw new Error('No Results.');
|
||||
if (!body.stories.length) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xF89C34)
|
||||
.setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png')
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = class WeatherCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`);
|
||||
if (body.query.count === 0) throw new Error('Location Not Found.');
|
||||
if (!body.query.count) throw new Error('Location Not Found.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x0000FF)
|
||||
.setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png')
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = class YouTubeCommand extends Command {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${query}&key=${GOOGLE_KEY}`);
|
||||
if (body.items.length === 0) throw new Error('No Results.');
|
||||
if (!body.items.length) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xDD2825)
|
||||
.setTitle(body.items[0].snippet.title)
|
||||
|
||||
Reference in New Issue
Block a user