Skip to content

Commit

Permalink
shade message
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-flip committed Sep 27, 2024
1 parent 9d58aca commit 0cda23d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions commands/ping copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports.run = async (interaction) => {
await interaction.deferReply({ ephemeral: true });
// only guild command
if (!await interaction.inGuild()) return messageFail(interaction, 'This command is for servers only.');
// check if user is owner
if (!interaction.member.roles.cache.find(({ id }) => id === '542778181556502540')) return messageFail(interaction, 'You don\'t have access to this command! òwó');

// prepare username, avatar and message
const content = await interaction.channel.send(interaction.options.getString('message', true)).catch(ERR);
const username = message.member.nickname || message.author.username;
const avatarURL = message.member.displayAvatarURL({ format: 'png', dynamic: true, size: 512 });

// get webhook and send message
const channel = message.channel;
const channelWebhooks = await channel.fetchWebhooks();
let hook = channelWebhooks.find((hook) => hook.owner.id === client.user.id);
if (!hook) hook = await channel.createWebhook({ name: config.name }).catch(ERR);
hook.send({
content, username, avatarURL,
}).catch(ERR);
};

module.exports.data = new CmdBuilder()
.setName('red')
.setDescription('For Shade.')
.addStringOption((option) => option.setName('message').setDescription('Tell me what to say.').setRequired(true));

0 comments on commit 0cda23d

Please sign in to comment.