Fix discord list_by_channel API call
This commit is contained in:
parent
358b3cc24c
commit
45731bda80
2 changed files with 9 additions and 6 deletions
|
|
@ -135,16 +135,19 @@ class Api:
|
|||
def delete(channel_id: int, message_id: int) -> tuple[ApiAction, str]:
|
||||
return ApiAction.DELETE, f'/channels/{channel_id}/messages/{message_id}'
|
||||
|
||||
@staticmethod
|
||||
def list_by_channel(channel_id: int) -> tuple[ApiAction, str]:
|
||||
return ApiAction.GET, f'/channels/{channel_id}/messages'
|
||||
|
||||
class ListMessageParams(TypedDict, total=False):
|
||||
around: int # Get messages around this message ID
|
||||
before: int # Get messages before this message ID
|
||||
after: int # Get messages after this message ID
|
||||
limit: int # Max number of messages to return (1-100), default=50
|
||||
|
||||
@staticmethod
|
||||
def list_by_channel(channel_id: int, params: ListMessageParams | None = None) -> tuple[ApiAction, str]:
|
||||
url = f'/channels/{channel_id}/messages'
|
||||
if params:
|
||||
url += f"?{'&'.join([f'{k}={v}' for k, v in params.items()])}"
|
||||
return ApiAction.GET, url
|
||||
|
||||
class User:
|
||||
@staticmethod
|
||||
def get_current() -> tuple[ApiAction, str]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue