mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
Add type hints for config items
This commit is contained in:
@ -86,11 +86,10 @@ async def handle_natural_language(bot: NoneBot, ctx: Dict[str, Any]) -> bool:
|
||||
msg = str(ctx['message'])
|
||||
if bot.config.NICKNAME:
|
||||
# check if the user is calling me with my nickname
|
||||
if not isinstance(bot.config.NICKNAME, Iterable):
|
||||
# noinspection PyUnusedLocal
|
||||
if isinstance(bot.config.NICKNAME, str) or \
|
||||
not isinstance(bot.config.NICKNAME, Iterable):
|
||||
nicknames = (bot.config.NICKNAME,)
|
||||
else:
|
||||
# noinspection PyUnusedLocal
|
||||
nicknames = filter(lambda n: n, bot.config.NICKNAME)
|
||||
m = re.search(rf'^({"|".join(nicknames)})[\s,,]+', msg, re.IGNORECASE)
|
||||
if m:
|
||||
|
Reference in New Issue
Block a user