Skip to content

Commit

Permalink
Merge pull request #58 from Tian-que/br_fix_ignore_config
Browse files Browse the repository at this point in the history
修复使用类变量获取config导致的异常
  • Loading branch information
Tian-que authored Mar 11, 2024
2 parents 8bdb5b7 + 59b5ed8 commit 376d074
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions nonebot/adapters/kaiheila/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def _forward_ws(self, bot_config: BotConfig) -> None:
event = self.json_to_event(
json_data,
bot and bot.self_id,
ignore_events=self.kaiheila_config.kaiheila_ignore_events,
kaiheila_config=self.kaiheila_config,
)
if not event:
continue
Expand Down Expand Up @@ -366,7 +366,7 @@ def json_to_event(
json_data: Any,
self_id: Optional[str] = None,
*,
ignore_events: Optional[Tuple[str, ...]] = None,
kaiheila_config: Optional[KaiheilaConfig] = None,
) -> Union[OriginEvent, Event, None]:
if not isinstance(json_data, dict):
return None
Expand Down Expand Up @@ -405,7 +405,7 @@ def json_to_event(
if json_data["d"].get("author_id") == self_id :
return
# 屏蔽其他Bot消息
if json_data["d"].get("extra", {}).get("author", {}).get("bot") and cls.kaiheila_config.kaiheila_ignore_else_bots:
if json_data["d"].get("extra", {}).get("author", {}).get("bot") and kaiheila_config.kaiheila_ignore_else_bots:
return
try:
data = json_data["d"]
Expand Down Expand Up @@ -447,7 +447,7 @@ def json_to_event(
sub_type = f".{sub_type}" if sub_type else ""

event_name: str = post_type + detail_type + sub_type
if ignore_events and event_name.startswith(ignore_events):
if kaiheila_config.ignore_events and event_name.startswith(kaiheila_config.ignore_events):
return

models = cls.get_event_model(event_name)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-adapter-kaiheila"
version = "0.3.2a1"
version = "0.3.2"
description = "kaiheila adapter for nonebot2"
authors = ["Tian-que <1605206150@qq.com>", "ssttkkl <huang.wen.long@hotmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 376d074

Please sign in to comment.