Skip to content

Commit

Permalink
🐛 fix config.ensure
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Nov 5, 2024
1 parent a8c2b12 commit 2a58b6f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def administrators(self, channel: Optional[str] = None) -> list[Selector]:
return [Selector.from_follows_pattern(f"land(qq).group({channel}).member({admin})") for admin in self.admins]

def ensure(self, account: OneBot11Account):
return int(self.account) in account.connection.accounts
return isinstance(account, OneBot11Account) and int(self.account) in account.connection.accounts


class ElizabethConfig(BotConfig[ElizabethAccount]):
Expand Down Expand Up @@ -277,7 +277,7 @@ def administrators(self, channel: Optional[str] = None) -> list[Selector]:
return [Selector.from_follows_pattern(f"land(qq).group({channel}).member({admin})") for admin in self.admins]

def ensure(self, account: ElizabethAccount):
return account.connection.account_id == int(self.account)
return isinstance(account, ElizabethAccount) and account.connection.account_id == int(self.account)


class Intents(BaseConfig):
Expand Down Expand Up @@ -343,7 +343,7 @@ def administrators(self, channel: Optional[str] = None) -> list[Selector]:
return [Selector.from_follows_pattern(f"land(qq).channel({channel}).member({admin})") for admin in self.admins]

def ensure(self, account: QQAPIAccount):
return account.connection.config.id == self.account # type: ignore
return isinstance(account, QQAPIAccount) and account.connection.config.id == self.account # type: ignore


class RaianConfig(BaseConfig):
Expand Down
2 changes: 1 addition & 1 deletion plugins/learn_repeat/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ async def handle(ctx: Context, message: MessageChain, db: DatabaseService):
msg = str(message)
for rec in records:
try:
if re.fullmatch(rec.key, msg):
if rec.key == msg:
content = deserialize_message(rec.content)
await ctx.scene.send_message(content)
raise PropagationCancelled
Expand Down
2 changes: 1 addition & 1 deletion plugins/weibo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def _handle_dynamic(
page = await pw.get_interface(PlaywrightBrowser).browser.new_page(viewport={"width": 800, "height": 2400})
try:
await page.click("html")
await page.goto(data.url, timeout=60000, wait_until="networkidle")
await page.goto(data.url, timeout=10000, wait_until="networkidle")
elem = page.locator("//div[@class='card-wrap']", has=page.locator("//header[@class='weibo-top m-box']")).first
elem1 = page.locator("//article[@class='weibo-main']").first
bounding = await elem.bounding_box()
Expand Down

0 comments on commit 2a58b6f

Please sign in to comment.