Compare commits
3 commits
5138ddd8ad
...
abe4fe7756
Author | SHA1 | Date | |
---|---|---|---|
abe4fe7756 | |||
d1217f05d0 | |||
c782c2bbd7 |
4 changed files with 56 additions and 2 deletions
38
commands/fun/fakeuser.js
Normal file
38
commands/fun/fakeuser.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
|
|
||||||
|
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)),
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
const attachment = interaction.options.getAttachment('image');
|
||||||
|
const message = interaction.options.getString('message');
|
||||||
|
const member = interaction.options.getMentionable('user');
|
||||||
|
|
||||||
|
const webhook = await interaction.channel.createWebhook(member.user.username, {
|
||||||
|
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}`);
|
||||||
|
await interaction.editReply({ content: `Faked the user ${member}` });
|
||||||
|
},
|
||||||
|
};
|
|
@ -61,7 +61,7 @@ export default {
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
|
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default {
|
||||||
status = status + ' | Now with slash commands!';
|
status = status + ' | Now with slash commands!';
|
||||||
|
|
||||||
console.log(`Setting status to: ${status}`);
|
console.log(`Setting status to: ${status}`);
|
||||||
client.user.setActivity(status + ' | Now with slash commands!', { type: 'PLAYING' });
|
client.user.setActivity(status, { type: 'PLAYING' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -85,6 +85,22 @@ const commands = [
|
||||||
new SlashCommandBuilder()
|
new SlashCommandBuilder()
|
||||||
.setName('stats')
|
.setName('stats')
|
||||||
.setDescription('Show some stats about the bot'),
|
.setDescription('Show some stats about the bot'),
|
||||||
|
|
||||||
|
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 (Image only.)')
|
||||||
|
.setRequired(false)),
|
||||||
]
|
]
|
||||||
.map(command => command.toJSON());
|
.map(command => command.toJSON());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue