feat: add friend check module

This commit is contained in:
Soumt Nam 2023-09-15 11:43:17 +09:00
parent ad537d7d1f
commit 869f460197
No known key found for this signature in database
GPG key ID: 5F46B099DCBCA8CE

View file

@ -5,28 +5,30 @@ class Friend(ModuleInterface):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.name = "Friend" self.name = "Friend"
self.regex_pattern = None self.regex_pattern = ".*TestAreWeFriend"
self.funcs["dec_like"] = self._dec_like self.funcs["dec_like"] = self._dec_like
self.funcs["inc_like"] = self._inc_like self.funcs["inc_like"] = self._inc_like
self.funcs["get_like"] = self._get_like self.funcs["get_like"] = self._get_like
self.funcs["is_friend_async"] = self._is_friend
print("[Friend] Friend DB system, Friend V1 loaded.") print("[Friend] Friend DB system, Friend V1 loaded.")
async def execute_module(self, ctx: Note): async def execute_module(self, ctx: Note):
pass await ctx.api.action.reply("1" if await self._is_friend_async(ctx.author.id) else "0")
def _dec_like(userid: str): def _dec_like(self, userid: str):
pass pass
def _inc_like(userid: str): def _inc_like(self, userid: str):
pass pass
def _get_like(userid: str): def _get_like(self, userid: str):
pass pass
def _is_friend(userid: str): async def _is_friend_async(self, userid: str):
pass target = await self.manager.bot.user.api.action.get(userid)
return target.is_followed and target.is_following
def module_ready(self): def module_ready(self):
print("[Friend] Module Ready.") print("[Friend] Module Ready.")