Skip to content
Snippets Groups Projects
Commit 6072c421 authored by Iori Ichinose's avatar Iori Ichinose :speech_balloon:
Browse files

grep without at is pointed to sender

parent 476c2ab2
No related branches found
No related tags found
No related merge requests found
......@@ -77,13 +77,18 @@ async def handle_rank(bot: Bot, event: Event, state: T_State):
@grep.handle()
async def handle_grep(bot: Bot, event: Event, state: T_State):
group_id = event.dict()['group_id']
text = event.dict()['raw_message']
configs = event.dict()
group_id = configs['group_id']
text = configs['raw_message'].strip()
if text == 'grep':
await grep.finish()
return
print(text)
if m := at_re.findall(text):
user_id = int(m[0])
else:
await grep.finish()
user_id = configs['user_id']
keyword = text.split(maxsplit=2)[-1]
state['args'] = (user_id, group_id, keyword)
......@@ -92,4 +97,5 @@ async def handle_grep(bot: Bot, event: Event, state: T_State):
async def handle_args(bot: Bot, event: Event, state: T_State):
uid, gid, keyword = state['args']
print(state['args'])
await grep.finish(count(gid, uid, keyword))
state['_send'] = count(gid, uid, keyword)
await grep.finish()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment