test matchergroup

This commit is contained in:
yanyongyu
2020-12-04 01:55:03 +08:00
parent 5b42454a55
commit f6806c1d55
5 changed files with 30 additions and 14 deletions

View File

@ -215,7 +215,7 @@ def run(host: Optional[str] = None,
get_driver().run(host, port, *args, **kwargs)
from nonebot.plugin import on_message, on_notice, on_request, on_metaevent, CommandGroup
from nonebot.plugin import on_message, on_notice, on_request, on_metaevent, CommandGroup, MatcherGroup
from nonebot.plugin import on_startswith, on_endswith, on_keyword, on_command, on_regex
from nonebot.plugin import load_plugin, load_plugins, load_builtin_plugins
from nonebot.plugin import export, require, get_plugin, get_loaded_plugins

View File

@ -555,8 +555,8 @@ class MatcherGroup:
"""
final_kwargs = self.base_kwargs.copy()
final_kwargs.update(kwargs)
final_kwargs["type"] = "meta_event"
matcher = Matcher.new(**final_kwargs)
final_kwargs.pop("type", None)
matcher = Matcher.new("meta_event", **final_kwargs)
self.matchers.append(matcher)
_tmp_matchers.get().add(matcher)
return matcher
@ -583,8 +583,8 @@ class MatcherGroup:
"""
final_kwargs = self.base_kwargs.copy()
final_kwargs.update(kwargs)
final_kwargs["type"] = "message"
matcher = Matcher.new(**final_kwargs)
final_kwargs.pop("type", None)
matcher = Matcher.new("message", **final_kwargs)
self.matchers.append(matcher)
_tmp_matchers.get().add(matcher)
return matcher
@ -610,8 +610,8 @@ class MatcherGroup:
"""
final_kwargs = self.base_kwargs.copy()
final_kwargs.update(kwargs)
final_kwargs["type"] = "notice"
matcher = Matcher.new(**final_kwargs)
final_kwargs.pop("type", None)
matcher = Matcher.new("notice", **final_kwargs)
self.matchers.append(matcher)
_tmp_matchers.get().add(matcher)
return matcher
@ -637,8 +637,8 @@ class MatcherGroup:
"""
final_kwargs = self.base_kwargs.copy()
final_kwargs.update(kwargs)
final_kwargs["type"] = "request"
matcher = Matcher.new(**final_kwargs)
final_kwargs.pop("type", None)
matcher = Matcher.new("request", **final_kwargs)
self.matchers.append(matcher)
_tmp_matchers.get().add(matcher)
return matcher