29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
from .types import BlueskyAccount
|
|
|
|
|
|
def list_bluesky_account_ids(config: dict) -> list[str]:
|
|
accounts = config.get("channels", {}).get("bluesky", {}).get("accounts", {})
|
|
if accounts:
|
|
return list(accounts.keys())
|
|
return ["default"]
|
|
|
|
|
|
def resolve_bluesky_account(config: dict, account_id: str = "default") -> BlueskyAccount:
|
|
bluesky_cfg = config.get("channels", {}).get("bluesky", {})
|
|
account_cfg = bluesky_cfg.get("accounts", {}).get(account_id, bluesky_cfg)
|
|
|
|
handle = account_cfg.get("handle", "")
|
|
app_password = account_cfg.get("appPassword", "")
|
|
|
|
return BlueskyAccount(
|
|
account_id=account_id,
|
|
handle=handle,
|
|
app_password=app_password,
|
|
session_string=account_cfg.get("sessionString", ""),
|
|
dm_policy=account_cfg.get("dmPolicy", "pairing"),
|
|
allow_from=account_cfg.get("allowFrom", []),
|
|
enable_notifications=account_cfg.get("enableNotifications", False),
|
|
enable_firehose=account_cfg.get("enableFirehose", False),
|
|
name=account_cfg.get("name", handle),
|
|
)
|