1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Haha-Yes/commands/fun/fakebot.js

54 lines
1.3 KiB
JavaScript

5 years ago
const { Command } = require('discord-akairo');
class fakebotCommand extends Command {
constructor() {
super('fakebot', {
aliases: ['fakebot', 'fakeuser', 'fakemember'],
category: 'fun',
clientPermissions: ['MANAGE_WEBHOOKS'],
args: [
{
id: 'member',
type: 'user',
prompt: {
start: 'Who should i fake?',
retry: 'Didn\'t find any user named like that, please try again'
5 years ago
}
},
{
id: 'message',
type: 'string',
prompt: {
start: 'What message should i send?',
5 years ago
},
match: 'rest',
}
],
description: {
content: 'Fake a bot/user with webhook',
usage: '[user] [message]',
examples: ['Supositware#1616 hello!']
5 years ago
}
});
}
async exec(message, args) {
message.channel.createWebhook(args.member.username, args.member.displayAvatarURL())
.then(webhook => {
// Have to edit after creation otherwise the picture doesn't get applied
webhook.edit({
name: args.member.username,
avatar: args.member.displayAvatarURL()
5 years ago
});
this.client.fetchWebhook(webhook.id, webhook.token)
.then(webhook => {
message.delete();
webhook.send(args.message);
setTimeout(() => {
webhook.delete();
}, 3000);
});
});
5 years ago
}
}
module.exports = fakebotCommand;