mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
Rename B command, better balloon pop, change things out of other
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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: 'text-edit',
|
||||
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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -3,10 +3,9 @@ const { Command } = require('discord.js-commando');
|
||||
module.exports = class BCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'b',
|
||||
aliases: ['🅱'],
|
||||
name: '🅱',
|
||||
group: 'text-edit',
|
||||
memberName: 'b',
|
||||
memberName: '🅱',
|
||||
description: 'Replaces b with 🅱.',
|
||||
args: [
|
||||
{
|
||||
Reference in New Issue
Block a user