mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-31 23:51:28 +08:00
13 lines
325 B
Python
13 lines
325 B
Python
from typing import Dict, Any
|
|
|
|
|
|
def context_source(ctx: Dict[str, Any]) -> str:
|
|
src = ''
|
|
if ctx.get('group_id'):
|
|
src += f'/group/{ctx["group_id"]}'
|
|
elif ctx.get('discuss_id'):
|
|
src += f'/discuss/{ctx["discuss_id"]}'
|
|
if ctx.get('user_id'):
|
|
src += f'/user/{ctx["user_id"]}'
|
|
return src
|