chore: 些細な修正

pull/125/head
yupix 7 months ago
parent 99f0d55325
commit 42d128389e
No known key found for this signature in database
GPG Key ID: 2FF705F5C56D9C06

@ -54,10 +54,10 @@ class FollowActions(AbstractAction):
user_id = user_id or self.__user_id
data = {"userId": user_id}
res = await self.__session.request(
raw_user: IPartialUser = await self.__session.request(
Route("POST", "/api/following/delete"), json=data, auth=True
)
return PartialUser(res, client=self.__client)
return PartialUser(raw_user=raw_user, client=self.__client)
async def invalidate(self, user_id: str | None = None) -> PartialUser:
"""

@ -1287,13 +1287,13 @@ class NoteActions(ClientNoteActions):
Note
取得したートID
"""
res = await self._session.request(
raw_note: INote = await self._session.request(
Route("POST", "/api/notes/show"),
json={"noteId": note_id},
auth=True,
lower=True,
)
return Note(res, client=self._client)
return Note(raw_note=raw_note, client=self._client)
@cache(group="get_note", override=True)
async def fetch(self, note_id: str) -> Note:
@ -1313,13 +1313,13 @@ class NoteActions(ClientNoteActions):
Note
note
"""
res = await self._session.request(
raw_note: INote = await self._session.request(
Route("POST", "/api/notes/show"),
json={"noteId": note_id},
auth=True,
lower=True,
)
return Note(res, client=self._client)
return Note(raw_note=raw_note, client=self._client)
async def gets(
self,

@ -14,9 +14,9 @@ class APIError(Exception):
if isinstance(data, dict):
error = data.get("error", {})
if isinstance(error, dict):
self.code: str | None = error.get("code", "")
self.id: str | None = error.get("id")
self.message: str | None = error.get("message", "")
self.code = error.get("code", "")
self.id = error.get("id")
self.message = error.get("message", "")
super().__init__(f"{self.message}\nRaw error: {self.raw} " if self.message else self.raw)
def raise_error(self):

@ -100,67 +100,67 @@ class RolePolicies:
@property
def antenna_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("antenna_limit"))
return RolePolicyValue(self.__role_policies_data["antenna_limit"])
@property
def gtl_available(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("gtl_available"))
return RolePolicyValue(self.__role_policies_data["gtl_available"])
@property
def ltl_available(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("ltl_available"))
return RolePolicyValue(self.__role_policies_data["ltl_available"])
@property
def can_public_note(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("can_public_note"))
return RolePolicyValue(self.__role_policies_data["can_public_note"])
@property
def drive_capacity_mb(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("drive_capacity_mb"))
return RolePolicyValue(self.__role_policies_data["drive_capacity_mb"])
@property
def can_invite(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("can_invite"))
return RolePolicyValue(self.__role_policies_data["can_invite"])
@property
def can_manage_custom_emojis(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("can_manage_custom_emojis"))
return RolePolicyValue(self.__role_policies_data["can_manage_custom_emojis"])
@property
def can_hide_ads(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("can_hide_ads"))
return RolePolicyValue(self.__role_policies_data["can_hide_ads"])
@property
def pin_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("pin_limit"))
return RolePolicyValue(self.__role_policies_data["pin_limit"])
@property
def word_mute_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("word_mute_limit"))
return RolePolicyValue(self.__role_policies_data["word_mute_limit"])
@property
def webhook_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("webhook_limit"))
return RolePolicyValue(self.__role_policies_data["webhook_limit"])
@property
def clip_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("clip_limit"))
return RolePolicyValue(self.__role_policies_data["clip_limit"])
@property
def note_each_clips_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("note_each_clips_limit"))
return RolePolicyValue(self.__role_policies_data["note_each_clips_limit"])
@property
def user_list_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("user_list_limit"))
return RolePolicyValue(self.__role_policies_data["user_list_limit"])
@property
def user_each_user_lists_limit(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("user_each_user_lists_limit"))
return RolePolicyValue(self.__role_policies_data["user_each_user_lists_limit"])
@property
def rate_limit_factor(self) -> RolePolicyValue:
return RolePolicyValue(self.__role_policies_data.get("rate_limit_factor"))
return RolePolicyValue(self.__role_policies_data["rate_limit_factor"])
class Role(PartialRole[IRole]):

Loading…
Cancel
Save