diff --git a/src/command/commands/add_nick.ts b/src/command/commands/add_nick.ts index 853d74d..f036439 100755 --- a/src/command/commands/add_nick.ts +++ b/src/command/commands/add_nick.ts @@ -17,6 +17,6 @@ export default { async execute(interaction: ChatInputCommandInteraction) { const discord_id = interaction.user.id; const mcid = interaction.options.getString("minecraft_id") as string; - add_user(interaction, discord_id, mcid, mojangAPI, firebase); + await add_user(interaction, discord_id, mcid, mojangAPI, firebase); }, }; diff --git a/src/command/commands/add_nick_super.ts b/src/command/commands/add_nick_super.ts index 5ef56b0..c07f56b 100755 --- a/src/command/commands/add_nick_super.ts +++ b/src/command/commands/add_nick_super.ts @@ -29,6 +29,6 @@ export default { async execute(interaction: ChatInputCommandInteraction) { const discord_id = interaction.options.getUser("discord")?.id as string; const mcid = interaction.options.getString("minecraft_id") as string; - add_user(interaction, discord_id, mcid, mojangAPI, firebase); + await add_user(interaction, discord_id, mcid, mojangAPI, firebase); }, }; diff --git a/src/main.ts b/src/main.ts index 05709db..e1f419a 100755 --- a/src/main.ts +++ b/src/main.ts @@ -28,7 +28,7 @@ client.once(Events.ClientReady, async (event) => { try { await guild.members.fetch(data.discord_id); } catch { - doc.ref.delete(); + await doc.ref.delete(); await send_embed(client, process.env.LOG_CHANNEL_ID, [ new EmbedBuilder() .setTitle("Auto Removed") @@ -78,7 +78,7 @@ client.on(Events.GuildMemberRemove, async (interaction) => { .get(); for (const doc of exited_user.docs) { const data = doc.data() as TUser; - doc.ref.delete(); + await doc.ref.delete(); await send_embed(client, process.env.LOG_CHANNEL_ID, [ new EmbedBuilder() .setTitle("Auto Removed") diff --git a/src/wrapper/mojang-api.ts b/src/wrapper/mojang-api.ts index 97532fa..429f13c 100644 --- a/src/wrapper/mojang-api.ts +++ b/src/wrapper/mojang-api.ts @@ -24,7 +24,7 @@ export class MojangAPI { const get_by_id = await this.firestore.where("id", "==", id).get(); get_by_id.forEach((doc) => doc.ref.delete()); - this.firestore.add({ uuid: minecraft_uuid, id: id }); + await this.firestore.add({ uuid: minecraft_uuid, id: id }); this.cache.remove_by_second(id); this.cache.set_by_first(minecraft_uuid, id); @@ -43,7 +43,7 @@ export class MojangAPI { const get_by_uuid = await this.firestore.where("uuid", "==", uuid).get(); get_by_uuid.forEach((doc) => doc.ref.delete()); - this.firestore.add({ uuid: uuid, id: minecraft_id }); + await this.firestore.add({ uuid: uuid, id: minecraft_id }); this.cache.remove_by_first(uuid); this.cache.set_by_second(uuid, minecraft_id);