-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
117 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,6 @@ | |
"nonebot_plugin_session", | ||
"nonebot_plugin_userinfo", | ||
), | ||
extra={ | ||
"unique_name": "memes_api", | ||
"author": "meetwq <[email protected]>", | ||
"version": "0.3.0", | ||
}, | ||
) | ||
|
||
memes_cache_dir = get_cache_dir("nonebot_plugin_memes_api") | ||
|
@@ -247,6 +242,7 @@ async def process( | |
texts: List[str], | ||
user_infos: List[UserInfo], | ||
args: Dict[str, Any] = {}, | ||
show_info: bool = False, | ||
): | ||
images: List[bytes] = [] | ||
|
||
|
@@ -282,7 +278,11 @@ async def process( | |
logger.warning(traceback.format_exc()) | ||
await matcher.finish("出错了,请稍后再试") | ||
|
||
msg = UniMessage.image(raw=result) | ||
msg = UniMessage() | ||
if show_info: | ||
keywords = "、".join([f'"{keyword}"' for keyword in meme.keywords]) | ||
msg += f"关键词:{keywords}" | ||
msg += UniMessage.image(raw=result) | ||
await msg.send() | ||
|
||
|
||
|
@@ -357,7 +357,14 @@ async def random_handler(state: T_State, matcher: Matcher): | |
) | ||
] | ||
) | ||
await process(matcher, random_meme, image_sources, texts, user_infos) | ||
await process( | ||
matcher, | ||
random_meme, | ||
image_sources, | ||
texts, | ||
user_infos, | ||
show_info=memes_config.memes_random_meme_show_info, | ||
) | ||
|
||
|
||
random_matcher = on_message(command_rule(["随机表情"]), block=False, priority=12) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.