Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to Master Merge #159

Merged
merged 5 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@ bot.api.config.use(autoRetry());

bot.use(
limit({
// Allow only 20 message to be handled every 1 minute.
timeFrame: 60000,
limit: 20,
// Allow only 3 message to be handled every 3 seconds.
timeFrame: 3000,
limit: 3,

// This is called when the limit is exceeded.
onLimitExceeded: async (ctx) => {
// await ctx.reply("Please refrain from sending too many requests")
logger.error(`@${ctx.from?.username} has exceeded the message limit`);
logger.error(`onLimitExceeded: ${ctx.message?.text}`)
// await ctx.reply("");
},

Expand Down
6 changes: 3 additions & 3 deletions src/modules/open-ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,19 @@ export class OpenAIBot {
// }

if (ctx.message!.text === "/ask harmony.one/dear") {
await ctx.reply(askTemplates.dear);
ctx.reply(askTemplates.dear);
return;
}

if (ctx.hasCommand(SupportedCommands.ask.name)) {
ctx.session.openAi.chatGpt.model = ChatGPTModelsEnum.GPT_4;
await this.onChat(ctx);
this.onChat(ctx);
return;
}

if (ctx.hasCommand(SupportedCommands.ask35.name)) {
ctx.session.openAi.chatGpt.model = ChatGPTModelsEnum.GPT_35_TURBO;
await this.onChat(ctx);
this.onChat(ctx);
return;
}

Expand Down