Compare commits

..

2 commits

Author SHA1 Message Date
13d8f73356 Fix crash on reaction blocked
should fix #7
2023-07-23 06:28:56 +02:00
31097e03ce Add newline for limit reached message 2023-07-23 06:28:24 +02:00

View file

@ -134,12 +134,14 @@ export async function queueRequest(request: apiRequest) {
if (userLimit !== false && userLimit.remaining <= 0) {
if (request instanceof DiscordApi.Message) {
request.react("🛑");
request.react("🛑").catch(/*it's okay*/);
if (!request.author.dmChannel) await request.author.createDM();
request.author.dmChannel?.send({
embeds: [{
color: 0xff0000,
description: `You've used up your message limit for today, ${userLimit.limit} requests in last 24 hours`,
description:
"You've used up your message limit for today,\n" +
`${userLimit.limit} requests in last 24 hours`,
}]
});
}
@ -264,7 +266,7 @@ async function executeFromQueue(channel: string) {
response.then(rval => Moderation.checkMessage(rval));
}
else {
if (message instanceof DiscordApi.Message) message.react("😶");
if (message instanceof DiscordApi.Message) message.react("😶").catch(/*it's okay*/);
}
} catch (e) {
console.error(`Error ocurred while handling chat completion request (${(e as object).constructor.name}):`);