2022-08-28 17:03:15 +02:00
|
|
|
import { SlashCommandBuilder } from 'discord.js';
|
|
|
|
import { PermissionFlagsBits } from 'discord.js';
|
2022-08-18 01:46:04 +02:00
|
|
|
export default {
|
|
|
|
data: new SlashCommandBuilder()
|
|
|
|
.setName('fakeuser')
|
|
|
|
.setDescription('Fake a user with webhooks')
|
|
|
|
.addMentionableOption(option =>
|
|
|
|
option.setName('user')
|
|
|
|
.setDescription('Who do you want to fake?')
|
|
|
|
.setRequired(true))
|
|
|
|
.addStringOption(option =>
|
|
|
|
option.setName('message')
|
|
|
|
.setDescription('What message do you want me to send?')
|
|
|
|
.setRequired(true))
|
|
|
|
.addAttachmentOption(option =>
|
|
|
|
option.setName('image')
|
|
|
|
.setDescription('Optional attachment.')
|
|
|
|
.setRequired(false)),
|
2022-08-28 17:03:15 +02:00
|
|
|
category: 'fun',
|
|
|
|
clientPermissions: [ PermissionFlagsBits.ManageWebhooks ],
|
|
|
|
async execute(interaction, args) {
|
2022-08-18 01:46:04 +02:00
|
|
|
await interaction.deferReply({ ephemeral: true });
|
2022-09-14 21:31:31 +02:00
|
|
|
await interaction.guild.members.fetch();
|
2022-09-01 01:43:59 +02:00
|
|
|
const member = args.user;
|
|
|
|
const message = args.message;
|
|
|
|
const attachment = args.image;
|
2022-11-24 21:11:24 +01:00
|
|
|
const username = member.nickname ? member.nickname : member.user.username;
|
2022-08-28 17:03:15 +02:00
|
|
|
|
2022-09-01 01:43:59 +02:00
|
|
|
const webhook = await interaction.channel.createWebhook({
|
2022-11-24 21:11:24 +01:00
|
|
|
name: username,
|
2022-08-18 01:46:04 +02:00
|
|
|
avatar: member.user.displayAvatarURL(),
|
|
|
|
reason: `Fakebot/user command triggered by: ${interaction.user.username}`,
|
|
|
|
});
|
|
|
|
if (attachment) {
|
|
|
|
await webhook.send({ content: message, files: [attachment] });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
await webhook.send({ content: message });
|
|
|
|
}
|
|
|
|
await webhook.delete(`Fakebot/user command triggered by: ${interaction.user.username}`);
|
2022-11-24 21:11:24 +01:00
|
|
|
if (interaction.isMessage) {
|
|
|
|
await interaction.delete();
|
|
|
|
await interaction.deleteReply();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
await interaction.editReply({ content: `Faked the user ${member}` });
|
|
|
|
}
|
2022-08-18 01:46:04 +02:00
|
|
|
},
|
|
|
|
};
|