refactor: await all asynchronous function calls

This commit is contained in:
Baipyrus 2024-02-05 03:01:48 +01:00
parent 1e716d5f5e
commit 3fa0bd9c1f
2 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ export async function execute(interaction) {
try { try {
// Create database entry // Create database entry
Message.create({ id }); await Message.create({ id });
// Reply successfully to acknowledge command // Reply successfully to acknowledge command
await interaction.reply({ await interaction.reply({

View File

@ -10,8 +10,8 @@ const createSelfRoles = async (interaction) => {
const id = (await channel.send(text)).id; const id = (await channel.send(text)).id;
// Reply and delete to acknowledge command // Reply and delete to acknowledge command
interaction.deferReply(); await interaction.deferReply();
interaction.deleteReply(); await interaction.deleteReply();
return id; return id;
}; };
@ -83,7 +83,7 @@ const addSelfRoles = async (interaction) => {
if (rep !== null) throw new Error(); if (rep !== null) throw new Error();
// Create database entry for pair // Create database entry for pair
RoleEmojiPair.create({ message: id, role: role.id, emoji }); await RoleEmojiPair.create({ message: id, role: role.id, emoji });
step = 'react to'; step = 'react to';
// React with emoji to message // React with emoji to message
@ -116,8 +116,8 @@ export const data = new SlashCommandBuilder()
.setDescription('Creates new message in channel.') .setDescription('Creates new message in channel.')
.addStringOption(option => .addStringOption(option =>
option option
.setRequired(true)
.setName('text') .setName('text')
.setRequired(true)
.setDescription('The text to be displayed in the message.'))) .setDescription('The text to be displayed in the message.')))
.addSubcommand(subcommand => .addSubcommand(subcommand =>
subcommand subcommand
@ -171,7 +171,7 @@ export async function execute(interaction) {
if (createNew) { if (createNew) {
try { try {
// Create database entry // Create database entry
Message.create({ id }); await Message.create({ id });
} catch (error) { } catch (error) {
console.error(error); console.error(error);