Compare commits

..

No commits in common. "c7b36885a3421ead1b972ee534596363fbde8c3b" and "72f4648ff96e5244dbd73dfe5bd336c1546488b8" have entirely different histories.

View file

@ -110,8 +110,6 @@ function requestReply(
else { else {
if (!request.deferred) if (!request.deferred)
return request.reply(Object.assign(message, interactionOptions)); return request.reply(Object.assign(message, interactionOptions));
else if (request.replied)
return request.followUp(Object.assign(message, interactionOptions));
else else
return request.editReply(Object.assign(message, interactionOptions)); return request.editReply(Object.assign(message, interactionOptions));
} }
@ -275,26 +273,14 @@ async function executeFromQueue(channel: string) {
const answerContent = answer.data.choices[0].message?.content; const answerContent = answer.data.choices[0].message?.content;
if (answerContent == undefined || answerContent == "") { if (answerContent != undefined || answerContent != "") {
if (message instanceof DiscordApi.Message) message.react("😶").catch(/*it's okay*/);
}
else {
const answerMessagesContent :string[] = [""];
for (const i in answerContent.split(/\n\n/)) {
if (answerMessagesContent[answerMessagesContent.length-1].length + i.length < 2000) {
answerMessagesContent[answerMessagesContent.length-1] += "\n\n" + i;
}
else {
answerMessagesContent.push(i);
}
}
for (const i in answerMessagesContent) { const response = requestReply(message, {content: answerContent}, {allowedMentions: { repliedUser: false }});
const response = requestReply(message, {content: i}, {allowedMentions: { repliedUser: false }});
response.then(rval => Moderation.checkMessage(rval)); response.then(rval => Moderation.checkMessage(rval));
await response;
} }
else {
if (message instanceof DiscordApi.Message) message.react("😶").catch(/*it's okay*/);
} }
} catch (e) { } catch (e) {
console.error(`Error ocurred while handling chat completion request (${(e as object).constructor.name}):`); console.error(`Error ocurred while handling chat completion request (${(e as object).constructor.name}):`);