mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
msg
This commit is contained in:
@@ -17,10 +17,10 @@ module.exports = class BotSearchCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { bot } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -40,9 +40,9 @@ module.exports = class BotSearchCommand extends Command {
|
||||
`[Here](${body.invite_url})`, true)
|
||||
.addField('**Prefix:**',
|
||||
body.prefix, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The bot may not have been found.');
|
||||
return msg.say('An Error Occurred. The bot may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class DefineCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -30,9 +30,9 @@ module.exports = class DefineCommand extends Command {
|
||||
.setColor(0x9797FF)
|
||||
.setTitle(body[0].word)
|
||||
.setDescription(body[0].text);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The word may not have been found.');
|
||||
return msg.say('An Error Occurred. The word may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,15 +25,15 @@ module.exports = class DiscrimCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { discrim } = args;
|
||||
const users = await this.client.users.filter(u => u.discriminator === discrim).map(u => u.username).sort();
|
||||
const embed = new RichEmbed()
|
||||
.setTitle(`${users.length} Users with the discriminator: ${discrim}`)
|
||||
.setDescription(users.join(', '));
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,10 +17,10 @@ module.exports = class ForecastCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -45,9 +45,9 @@ module.exports = class ForecastCommand extends Command {
|
||||
`**High:** ${forecasts[5].high}°F, **Low:** ${forecasts[5].low}°F, **Condition:** ${forecasts[5].text}`)
|
||||
.addField(`**${forecasts[6].day} - ${forecasts[6].date}:**`,
|
||||
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The location may not have been found.');
|
||||
return msg.say('An Error Occurred. The location may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,9 +19,9 @@ module.exports = class GoogleCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(msg, args) {
|
||||
const { query } = args;
|
||||
const msg = await message.say('Searching...');
|
||||
const message = await msg.say('Searching...');
|
||||
try {
|
||||
const { text } = await request
|
||||
.get(`https://www.google.com/search?q=${query}`);
|
||||
@@ -29,9 +29,9 @@ module.exports = class GoogleCommand extends Command {
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
if (!href) throw new Error('No Results');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return msg.edit(href.q);
|
||||
return message.edit(href.q);
|
||||
} catch (err) {
|
||||
return msg.edit('No Results Found.');
|
||||
return message.edit('No Results Found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class IMDBCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -46,9 +46,9 @@ module.exports = class IMDBCommand extends Command {
|
||||
body.Writer)
|
||||
.addField('**Actors:**',
|
||||
body.Actors);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The film may not have been found.');
|
||||
return msg.say('An Error Occurred. The film may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,8 +16,8 @@ module.exports = class LMGTFYCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
run(message, args) {
|
||||
run(msg, args) {
|
||||
const { query } = args;
|
||||
return message.say(`http://lmgtfy.com/?iie=1&q=${query}`);
|
||||
return msg.say(`http://lmgtfy.com/?iie=1&q=${query}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,17 +26,17 @@ module.exports = class MapCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
const { zoom, query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
|
||||
return message.channel.send({files: [{attachment: body}]});
|
||||
return msg.channel.send({files: [{attachment: body}]});
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The location may not have been found.');
|
||||
return msg.say('An Error Occurred. The location may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = class NeopetCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(msg, args) {
|
||||
const { query } = args;
|
||||
try {
|
||||
const { text } = await request
|
||||
@@ -26,10 +26,10 @@ module.exports = class NeopetCommand extends Command {
|
||||
const $ = cheerio.load(text);
|
||||
const link = $('textarea').first().text();
|
||||
if (!link.includes('cp'))
|
||||
return message.say('This is not a valid pet name.');
|
||||
return message.say(link);
|
||||
return msg.say('This is not a valid pet name.');
|
||||
return msg.say(link);
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class OsuCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -54,9 +54,9 @@ module.exports = class OsuCommand extends Command {
|
||||
body[0].count_rank_s, true)
|
||||
.addField('**A:**',
|
||||
body[0].count_rank_a, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The user may not have been found.');
|
||||
return msg.say('An Error Occurred. The user may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -41,9 +41,9 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
body[0].playback_count, true)
|
||||
.addField('**Favorited Count:**',
|
||||
body[0].favoritings_count, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The song may not have been found.');
|
||||
return msg.say('An Error Occurred. The song may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class UrbanCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -34,9 +34,9 @@ module.exports = class UrbanCommand extends Command {
|
||||
.setDescription(body.list[0].definition.substr(0, 2000))
|
||||
.addField('**Example:**',
|
||||
body.list[0].example.substr(0, 2000) || 'None');
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The word may not have been found.');
|
||||
return msg.say('An Error Occurred. The word may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class WattpadCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -47,9 +47,9 @@ module.exports = class WattpadCommand extends Command {
|
||||
body.stories[0].readCount, true)
|
||||
.addField('**Comments:**',
|
||||
body.stories[0].commentCount, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The book may not have been found.');
|
||||
return msg.say('An Error Occurred. The book may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,10 +17,10 @@ module.exports = class WeatherCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -54,9 +54,9 @@ module.exports = class WeatherCommand extends Command {
|
||||
body.query.results.channel.wind.direction, true)
|
||||
.addField('**Wind Speed:**',
|
||||
body.query.results.channel.wind.speed, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The location may not have been found.');
|
||||
return msg.say('An Error Occurred. The location may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class WikipediaCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -31,10 +31,10 @@ module.exports = class WikipediaCommand extends Command {
|
||||
.setTitle(body.query.pages[0].title)
|
||||
.setURL(`https://en.wikipedia.org/wiki/${query}`)
|
||||
.setAuthor('Wikipedia', 'https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png')
|
||||
.setDescription(body.query.pages[0].extract.substr(0, 2000).split('\n').join('\n\n'));
|
||||
return message.embed(embed);
|
||||
.setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n'));
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The page may not have been found.');
|
||||
return msg.say('An Error Occurred. The page may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class YouTubeCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -33,9 +33,9 @@ module.exports = class YouTubeCommand extends Command {
|
||||
.setAuthor(`YouTube - ${body.items[0].snippet.channelTitle}`, 'https://cdn3.iconfinder.com/data/icons/social-icons-5/607/YouTube_Play.png')
|
||||
.setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`)
|
||||
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The video may not have been found.');
|
||||
return msg.say('An Error Occurred. The video may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -44,7 +44,7 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
body.data.def, true)
|
||||
.addField('**Level:**',
|
||||
body.data.level, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xBE5F1F)
|
||||
@@ -53,9 +53,9 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
.setAuthor('Yu-Gi-Oh!', 'http://vignette3.wikia.nocookie.net/yugioh/images/1/10/Back-TF-EN-VG.png/revision/latest?cb=20120824043558')
|
||||
.addField('**Card Type:**',
|
||||
body.data.card_type, true);
|
||||
return message.embed(embed);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The card may not have been found.');
|
||||
return msg.say('An Error Occurred. The card may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user