mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 22:40:55 +00:00
status适配satori
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
from .user_info import user_infos
|
||||
from .get_message_type import get_message_type
|
||||
from .event_tools import *
|
||||
from .count_friends import count_friends
|
||||
from .count_groups import count_groups
|
||||
|
13
liteyuki/utils/satori_utils/count_friends.py
Normal file
13
liteyuki/utils/satori_utils/count_friends.py
Normal file
@ -0,0 +1,13 @@
|
||||
from nonebot.adapters import satori
|
||||
|
||||
|
||||
async def count_friends(bot: satori.Bot) -> int:
|
||||
cnt: int = 0
|
||||
|
||||
friend_response = await bot.friend_list()
|
||||
while friend_response.next is not None:
|
||||
cnt += len(friend_response.data)
|
||||
friend_response = await bot.friend_list(next_token=friend_response.next)
|
||||
|
||||
cnt += len(friend_response.data)
|
||||
return cnt - 1
|
13
liteyuki/utils/satori_utils/count_groups.py
Normal file
13
liteyuki/utils/satori_utils/count_groups.py
Normal file
@ -0,0 +1,13 @@
|
||||
from nonebot.adapters import satori
|
||||
|
||||
|
||||
async def count_groups(bot: satori.Bot) -> int:
|
||||
cnt: int = 0
|
||||
|
||||
group_response = await bot.guild_list()
|
||||
while group_response.next is not None:
|
||||
cnt += len(group_response.data)
|
||||
group_response = await bot.friend_list(next_token=group_response.next)
|
||||
|
||||
cnt += len(group_response.data)
|
||||
return cnt - 1
|
Reference in New Issue
Block a user