Ignore case when checking nicknames

This commit is contained in:
Richard Chien 2018-07-21 22:01:14 +08:00
parent 2caf90646b
commit 2b85a43956

View File

@ -87,7 +87,7 @@ async def handle_natural_language(bot: NoneBot, ctx: Dict[str, Any]) -> bool:
else: else:
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
nicknames = filter(lambda n: n, bot.config.NICKNAME) nicknames = filter(lambda n: n, bot.config.NICKNAME)
m = re.search(rf'^({"|".join(nicknames)})[\s,]+', msg) m = re.search(rf'^({"|".join(nicknames)})[\s,]+', msg, re.IGNORECASE)
if m: if m:
logger.debug(f'User is calling me {m.group(1)}') logger.debug(f'User is calling me {m.group(1)}')
ctx['to_me'] = True ctx['to_me'] = True