Skip to content

Commit f729609

Browse files
committed
inline debounce by forcing users to enter . or ?
1 parent 0fa8432 commit f729609

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/worker/src/worker.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,21 @@ export default {
220220
}
221221

222222
case 'inline': {
223+
const query = bot.update.inline_query?.query.toString() ?? '';
224+
225+
// Check if query ends with proper punctuation
226+
if (!query.endsWith('.') && !query.endsWith('?')) {
227+
await bot.replyInline(
228+
"Please complete your sentence",
229+
"End your sentence with a period (.) or question mark (?) to get an AI response",
230+
'HTML'
231+
);
232+
break;
233+
}
234+
223235
const messages = [
224236
{ role: 'system', content: SYSTEM_PROMPTS.TUX_ROBOT },
225-
{ role: 'user', content: bot.update.inline_query?.query.toString() ?? '' },
237+
{ role: 'user', content: query },
226238
];
227239

228240
try {

0 commit comments

Comments
 (0)