2022-05-22 19:42:30 +08:00
|
|
|
from typing import Union
|
|
|
|
|
2021-12-20 00:28:02 +08:00
|
|
|
from nonebot.adapters import Bot
|
|
|
|
|
|
|
|
|
2022-03-20 19:40:43 +08:00
|
|
|
async def get_bot(b: Bot) -> Bot:
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
2022-05-22 19:42:30 +08:00
|
|
|
async def legacy_bot(bot):
|
|
|
|
return bot
|
|
|
|
|
|
|
|
|
|
|
|
async def not_legacy_bot(bot: int):
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
class FooBot(Bot):
|
2022-03-20 19:40:43 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2022-05-22 19:42:30 +08:00
|
|
|
async def sub_bot(b: FooBot) -> FooBot:
|
2021-12-20 00:28:02 +08:00
|
|
|
return b
|
2022-05-22 19:42:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
class BarBot(Bot):
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
async def union_bot(b: Union[FooBot, BarBot]) -> Union[FooBot, BarBot]:
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
async def not_bot(b: Union[int, Bot]):
|
|
|
|
...
|