Compare commits

..

No commits in common. "d1f8768b15b8608d9ea90183fe5eb2b26233a927" and "e7bce7abd2ab1d1ef39826d1abeb771c2ca8ecf5" have entirely different histories.

2 changed files with 1 additions and 28 deletions

View File

@ -32,5 +32,6 @@ See [tests](src/devranta/tests.py) for [examples](src/devranta/tests.py) on how
## Todo
- voting comment
- edit message

View File

@ -1,11 +1,5 @@
from typing import Literal, Optional
import aiohttp
from enum import Enum
class VoteReason(Enum):
NOT_FOR_ME = 0
REPOST = 1
OFFENSIVE_SPAM = 2
class Api:
@ -174,28 +168,6 @@ class Api:
obj = await response.json()
return obj.get("success", False)
async def vote_rant(self, rant_id: int, vote: Literal[-1, 0, 1], reason: Optional[VoteReason] = None):
if not await self.ensure_login():
return None
async with self as session:
response = await session.post(
url=self.patch_url(f"devrant/rants/{rant_id}/vote"),
data=self.patch_auth({"vote": vote, "reason": reason.value if reason else None}),
)
obj = await response.json()
return obj.get("success", False)
async def vote_comment(self, comment_id: int, vote: Literal[-1, 0, 1], reason: Optional[VoteReason] = None):
if not await self.ensure_login():
return None
async with self as session:
response = await session.post(
url=self.patch_url(f"comments/{comment_id}/vote"),
data=self.patch_auth({"vote": vote, "reason": reason.value if reason else None}),
)
obj = await response.json()
return obj.get("success", False)
@property
async def notifs(self):
response = None