Skip to content

Nonebot Plugin Alconna 0.42.1

Compare
Choose a tag to compare
@RF-Tar-Railt RF-Tar-Railt released this 07 Apr 02:02
· 183 commits to master since this release
  • Target 的 selector 与 从 scope 获得的 selector 现在是独立的(即二者会组合)
  • 新增 apply_fetch_targets,调用后会在 nonebot 启动后为每个 bot 运行一次发送对象列表拉取
  • Target 的 selector 的默认函数现在为从拉取到的对象列表中判断是否符合
  • 新增配置项 alconna_apply_fetch_targets,控制是否启动时拉取一次发送对象列表
  • Target 增加 dump, load 方法,用来存储与读取

附1:target 上 adapter,scope等的优先级为 adapter & platform > scope > selector
附2:自定义 selector:

async def is_friend(target: Target, bot: Bot):
    if not target.private:
        return False
    friends = await bot.get_friend_list()
    return target.id in [friend["user_id"] for friend in friends]

user_target = Target("123", private=True, selector=is_friend, adapter=SupportAdapter.onebot11)

Full Changelog: v0.42.0...v0.42.1