ai621_new/handlers/analyze.py

13 lines
504 B
Python

from telethon import events
@events.register(events.callbackquery.CallbackQuery(pattern=r'^analyze$'))
async def analyze_prompt(ev):
log.info(f'{(ev.input_sender.user_id, get_display_name(ev.sender))}: analyze')
res = conn.execute('SELECT * FROM pending_prompt WHERE user_id = ? LIMIT 1', (ev.input_sender.user_id,)).fetchone()
if res:
comments, quality = judge(res['prompt'])
await ev.respond("\n".join(comments), parse_mode='HTML')
else:
await ev.respond('What am i supposed to analyze?')