mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-30 22:46:40 +00:00 
			
		
		
		
	Allow no space nor comma between nickname and message body
This commit is contained in:
		| @@ -115,7 +115,7 @@ async def handle_natural_language(bot: NoneBot, ctx: Context_T) -> bool: | |||||||
|         else: |         else: | ||||||
|             nicknames = filter(lambda n: n, bot.config.NICKNAME) |             nicknames = filter(lambda n: n, bot.config.NICKNAME) | ||||||
|         nickname_regex = '|'.join(nicknames) |         nickname_regex = '|'.join(nicknames) | ||||||
|         m = re.search(rf'^({nickname_regex})([\s,,]|$)', msg, re.IGNORECASE) |         m = re.search(rf'^({nickname_regex})([\s,,]*|$)', msg, re.IGNORECASE) | ||||||
|         if m: |         if m: | ||||||
|             nickname = m.group(1) |             nickname = m.group(1) | ||||||
|             logger.debug(f'User is calling me {nickname}') |             logger.debug(f'User is calling me {nickname}') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user