Skip to content

Commit

Permalink
Merge pull request #20 from noelzappy/update-002
Browse files Browse the repository at this point in the history
chore: minor refinement
  • Loading branch information
noelzappy authored Jan 31, 2024
2 parents 61b3fde + 88015f2 commit 33b985e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/handlers/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const handler = async (message: Message): Promise<void> => {
const prompt: ChatMessage = {
message: prefix.message.trim(),
systemMessage: prefix.systemMessage,
quotedMessage: quotedMessage.body
quotedMessage: quotedMessage?.body
};

if (!prefix.isPrefix && chat.isGroup) return;
Expand All @@ -31,10 +31,12 @@ const handler = async (message: Message): Promise<void> => {

Logger.info(`Received prompt from ${message.from}: ${prompt.message}`);



const promptLength = countWords(prompt.message);
if (promptLength > 70) {
message.reply(
'MAXIMUM OF 70 WORDS PER MESSAGE ONLY.\nFor longer messages please visit \nhttps://chat.openai.com/ \nOr contact Wordnox.com for a custom solution.',
'MAXIMUM OF 70 WORDS PER MESSAGE ONLY.\nFor longer messages please contact Wordnox.com for a custom solution.',
);
return;
}
Expand Down

0 comments on commit 33b985e

Please sign in to comment.