mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Rename B command, better balloon pop, change things out of other
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { GOOGLE_KEY } = process.env;
|
||||
|
||||
module.exports = class ShortenURLCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'shorten-url',
|
||||
aliases: ['short-url', 'url-shorten'],
|
||||
group: 'other',
|
||||
memberName: 'shorten-url',
|
||||
description: 'Creates a goo.gl short URL from another URL.',
|
||||
args: [
|
||||
{
|
||||
key: 'url',
|
||||
prompt: 'What url do you want to shorten?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { url }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.post('https://www.googleapis.com/urlshortener/v1/url')
|
||||
.query({ key: GOOGLE_KEY })
|
||||
.send({ longUrl: url });
|
||||
return msg.say(`<${body.id}>`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class SpoopyLinkCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'spoopy-link',
|
||||
group: 'other',
|
||||
memberName: 'spoopy-link',
|
||||
description: 'Determines if a link is spoopy or not.',
|
||||
args: [
|
||||
{
|
||||
key: 'site',
|
||||
prompt: 'What site do you think is spoopy?',
|
||||
type: 'string',
|
||||
parse: site => encodeURIComponent(site)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { site }) {
|
||||
try {
|
||||
const { body } = await snekfetch.get(`https://spoopy.link/api/${site}`);
|
||||
return msg.say(stripIndents`
|
||||
${body.safe ? 'Safe!' : 'Not safe...'}
|
||||
${body.chain.map(url => `<${url.url}> ${url.safe ? '✅' : `❌ (${url.reasons.join(', ')})`}`).join('\n')}
|
||||
`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user