2019-08-12 13:47:15 +02:00
|
|
|
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?',
|
2019-08-13 23:31:35 +02:00
|
|
|
retry: 'Didn\'t find any user named like that, please say the name again.'
|
2019-08-12 13:47:15 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'message',
|
|
|
|
type: 'string',
|
|
|
|
prompt: {
|
2019-08-12 14:18:45 +02:00
|
|
|
start: 'What message should i send?',
|
2019-08-12 13:47:15 +02:00
|
|
|
},
|
|
|
|
match: 'rest',
|
|
|
|
}
|
|
|
|
],
|
|
|
|
description: {
|
|
|
|
content: 'Fake a bot/user with webhook',
|
2019-08-12 18:41:15 +02:00
|
|
|
usage: '[user] [message]',
|
|
|
|
examples: ['Supositware#1616 hello!']
|
2019-08-12 13:47:15 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async exec(message, args) {
|
2019-10-05 19:51:05 +02:00
|
|
|
|
|
|
|
console.log(args.member);
|
|
|
|
message.channel.createWebhook(message.guild.members.get(args.member.id).nickname, {
|
2019-08-17 11:40:36 +02:00
|
|
|
avatar: args.member.displayAvatarURL(),
|
|
|
|
reason: `Fakebot/user command triggered by: ${message.author.username}`
|
|
|
|
})
|
2019-08-12 18:07:03 +02:00
|
|
|
.then(webhook => {
|
2019-08-12 18:46:33 +02:00
|
|
|
// Have to edit after creation otherwise the picture doesn't get applied
|
2019-08-12 18:07:03 +02:00
|
|
|
webhook.edit({
|
2019-10-05 19:51:05 +02:00
|
|
|
name: message.guild.members.get(args.member.id).nickname,
|
2019-08-17 11:40:36 +02:00
|
|
|
avatar: args.member.displayAvatarURL(),
|
|
|
|
reason: `Fakebot/user command triggered by: ${message.author.username}`
|
2019-08-12 13:47:15 +02:00
|
|
|
});
|
2019-08-12 18:07:03 +02:00
|
|
|
this.client.fetchWebhook(webhook.id, webhook.token)
|
|
|
|
.then(webhook => {
|
|
|
|
message.delete();
|
|
|
|
webhook.send(args.message);
|
|
|
|
setTimeout(() => {
|
|
|
|
webhook.delete();
|
|
|
|
}, 3000);
|
2019-08-12 14:05:39 +02:00
|
|
|
});
|
2019-08-12 18:07:03 +02:00
|
|
|
});
|
2019-08-12 13:47:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = fakebotCommand;
|