generated from Baipyrus/DiscordJS-Template
Compare commits
No commits in common. "ab6ca9edeb0dff29184e957443bb7c84c17fafb7" and "9f3bceeade126ead8416c278a007d5aa2dbab159" have entirely different histories.
ab6ca9edeb
...
9f3bceeade
@ -5,7 +5,7 @@ import { Message } from '../../../database.js';
|
||||
/**
|
||||
* Sends a `Message` in the current channel and registers for self roles.
|
||||
* @param {ChatInputCommandInteraction} interaction
|
||||
* @returns {Promise<string>}
|
||||
* @returns {string}
|
||||
*/
|
||||
const createSelfRoles = async (interaction) => {
|
||||
const { options, channel } = interaction;
|
||||
@ -14,11 +14,9 @@ const createSelfRoles = async (interaction) => {
|
||||
const text = options.getString('text');
|
||||
const id = (await channel.send(text)).id;
|
||||
|
||||
// Reply successfully to acknowledge command
|
||||
await interaction.reply({
|
||||
content: `Successfully sent message! Add roles to it with reference ID '${id}'.`,
|
||||
ephemeral: true
|
||||
});
|
||||
// Reply and delete to acknowledge command
|
||||
await interaction.deferReply();
|
||||
await interaction.deleteReply();
|
||||
|
||||
return id;
|
||||
};
|
||||
|
@ -33,13 +33,7 @@ export async function execute(reaction, user) {
|
||||
// Deny if unregistered
|
||||
if (rep === null) {
|
||||
// Remove reaction and quit
|
||||
try {
|
||||
reaction.remove();
|
||||
} catch (error) {
|
||||
// Missing permissions
|
||||
console.error(error)
|
||||
await user.send('Unable to remove reaction. Please contact server staff.');
|
||||
}
|
||||
await reaction.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ const saveMessageData = async (id, role, emoji) => {
|
||||
);
|
||||
|
||||
// Create database entry for pair
|
||||
await RoleEmojiPair.create({ message: id, role: role.id, emoji: emoji.replace(/:(\s*[^:]*\s*):/, ":_:") });
|
||||
await RoleEmojiPair.create({ message: id, role: role.id, emoji });
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user