Skip to content

Commit

Permalink
feat: typing indicator
Browse files Browse the repository at this point in the history
Closes #23.
  • Loading branch information
Mesteery committed May 8, 2021
1 parent 56e453f commit fc4dd57
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/helpers/sendBinEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function sendBinEmbed(
extender(embed);
}

const waitMessage = await message.channel.send("Transformation du message en cours...").catch(noop);
message.channel.startTyping();
const files: MessageAttachment[] = [];

if (attachments) {
Expand All @@ -33,18 +33,14 @@ export async function sendBinEmbed(
}
}

const botMessage = await message.channel.send({ embed, files }).catch(noop);

if (waitMessage?.deletable) {
await waitMessage.delete().catch(noop);
}
const botMessage = await message.channel.send({ embed, files }).catch(() => message.channel.stopTyping());

if (!botMessage) {
return;
}

if (message.deletable) {
await message.delete().catch(noop);
message.delete().catch(noop);
}

await botMessage.react("🗑️");
Expand Down

0 comments on commit fc4dd57

Please sign in to comment.