Compare commits

..

No commits in common. "ab6ca9edeb0dff29184e957443bb7c84c17fafb7" and "9f3bceeade126ead8416c278a007d5aa2dbab159" have entirely different histories.

3 changed files with 6 additions and 14 deletions

View File

@ -5,7 +5,7 @@ import { Message } from '../../../database.js';
/** /**
* Sends a `Message` in the current channel and registers for self roles. * Sends a `Message` in the current channel and registers for self roles.
* @param {ChatInputCommandInteraction} interaction * @param {ChatInputCommandInteraction} interaction
* @returns {Promise<string>} * @returns {string}
*/ */
const createSelfRoles = async (interaction) => { const createSelfRoles = async (interaction) => {
const { options, channel } = interaction; const { options, channel } = interaction;
@ -14,11 +14,9 @@ const createSelfRoles = async (interaction) => {
const text = options.getString('text'); const text = options.getString('text');
const id = (await channel.send(text)).id; const id = (await channel.send(text)).id;
// Reply successfully to acknowledge command // Reply and delete to acknowledge command
await interaction.reply({ await interaction.deferReply();
content: `Successfully sent message! Add roles to it with reference ID '${id}'.`, await interaction.deleteReply();
ephemeral: true
});
return id; return id;
}; };

View File

@ -33,13 +33,7 @@ export async function execute(reaction, user) {
// Deny if unregistered // Deny if unregistered
if (rep === null) { if (rep === null) {
// Remove reaction and quit // Remove reaction and quit
try { await reaction.remove();
reaction.remove();
} catch (error) {
// Missing permissions
console.error(error)
await user.send('Unable to remove reaction. Please contact server staff.');
}
return; return;
} }

View File

@ -66,7 +66,7 @@ const saveMessageData = async (id, role, emoji) => {
); );
// Create database entry for pair // 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 });
}; };
/** /**