|
@ -339,8 +339,7 @@ class HTTPClient: |
|
|
return self.request(r, data=form) |
|
|
return self.request(r, data=form) |
|
|
|
|
|
|
|
|
async def ack_message(self, channel_id, message_id): |
|
|
async def ack_message(self, channel_id, message_id): |
|
|
r = Route('POST', '/channels/{channel_id}/messages/{message_id}/ack', channel_id=channel_id, |
|
|
r = Route('POST', '/channels/{channel_id}/messages/{message_id}/ack', channel_id=channel_id, message_id=message_id) |
|
|
message_id=message_id) |
|
|
|
|
|
data = await self.request(r, json={'token': self._ack_token}) |
|
|
data = await self.request(r, json={'token': self._ack_token}) |
|
|
self._ack_token = data['token'] |
|
|
self._ack_token = data['token'] |
|
|
|
|
|
|
|
@ -348,8 +347,7 @@ class HTTPClient: |
|
|
return self.request(Route('POST', '/guilds/{guild_id}/ack', guild_id=guild_id)) |
|
|
return self.request(Route('POST', '/guilds/{guild_id}/ack', guild_id=guild_id)) |
|
|
|
|
|
|
|
|
def delete_message(self, channel_id, message_id, *, reason=None): |
|
|
def delete_message(self, channel_id, message_id, *, reason=None): |
|
|
r = Route('DELETE', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id, |
|
|
r = Route('DELETE', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id, message_id=message_id) |
|
|
message_id=message_id) |
|
|
|
|
|
return self.request(r, reason=reason) |
|
|
return self.request(r, reason=reason) |
|
|
|
|
|
|
|
|
def delete_messages(self, channel_id, message_ids, *, reason=None): |
|
|
def delete_messages(self, channel_id, message_ids, *, reason=None): |
|
@ -361,8 +359,7 @@ class HTTPClient: |
|
|
return self.request(r, json=payload, reason=reason) |
|
|
return self.request(r, json=payload, reason=reason) |
|
|
|
|
|
|
|
|
def edit_message(self, message_id, channel_id, **fields): |
|
|
def edit_message(self, message_id, channel_id, **fields): |
|
|
r = Route('PATCH', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id, |
|
|
r = Route('PATCH', '/channels/{channel_id}/messages/{message_id}', channel_id=channel_id, message_id=message_id) |
|
|
message_id=message_id) |
|
|
|
|
|
return self.request(r, json=fields) |
|
|
return self.request(r, json=fields) |
|
|
|
|
|
|
|
|
def add_reaction(self, message_id, channel_id, emoji): |
|
|
def add_reaction(self, message_id, channel_id, emoji): |
|
@ -382,7 +379,7 @@ class HTTPClient: |
|
|
|
|
|
|
|
|
def get_reaction_users(self, message_id, channel_id, emoji, limit, after=None): |
|
|
def get_reaction_users(self, message_id, channel_id, emoji, limit, after=None): |
|
|
r = Route('GET', '/channels/{channel_id}/messages/{message_id}/reactions/{emoji}', |
|
|
r = Route('GET', '/channels/{channel_id}/messages/{message_id}/reactions/{emoji}', |
|
|
channel_id=channel_id, message_id=message_id, emoji=emoji) |
|
|
channel_id=channel_id, message_id=message_id, emoji=emoji) |
|
|
|
|
|
|
|
|
params = {'limit': limit} |
|
|
params = {'limit': limit} |
|
|
if after: |
|
|
if after: |
|
@ -415,11 +412,11 @@ class HTTPClient: |
|
|
|
|
|
|
|
|
def pin_message(self, channel_id, message_id): |
|
|
def pin_message(self, channel_id, message_id): |
|
|
return self.request(Route('PUT', '/channels/{channel_id}/pins/{message_id}', |
|
|
return self.request(Route('PUT', '/channels/{channel_id}/pins/{message_id}', |
|
|
channel_id=channel_id, message_id=message_id)) |
|
|
channel_id=channel_id, message_id=message_id)) |
|
|
|
|
|
|
|
|
def unpin_message(self, channel_id, message_id): |
|
|
def unpin_message(self, channel_id, message_id): |
|
|
return self.request(Route('DELETE', '/channels/{channel_id}/pins/{message_id}', |
|
|
return self.request(Route('DELETE', '/channels/{channel_id}/pins/{message_id}', |
|
|
channel_id=channel_id, message_id=message_id)) |
|
|
channel_id=channel_id, message_id=message_id)) |
|
|
|
|
|
|
|
|
def pins_from(self, channel_id): |
|
|
def pins_from(self, channel_id): |
|
|
return self.request(Route('GET', '/channels/{channel_id}/pins', channel_id=channel_id)) |
|
|
return self.request(Route('GET', '/channels/{channel_id}/pins', channel_id=channel_id)) |
|
@ -584,7 +581,7 @@ class HTTPClient: |
|
|
return self.request(Route('GET', '/guilds/{guild_id}/vanity-url', guild_id=guild_id)) |
|
|
return self.request(Route('GET', '/guilds/{guild_id}/vanity-url', guild_id=guild_id)) |
|
|
|
|
|
|
|
|
def change_vanity_code(self, guild_id, code, *, reason=None): |
|
|
def change_vanity_code(self, guild_id, code, *, reason=None): |
|
|
payload = { 'code': code } |
|
|
payload = {'code': code} |
|
|
return self.request(Route('PATCH', '/guilds/{guild_id}/vanity-url', guild_id=guild_id), json=payload, reason=reason) |
|
|
return self.request(Route('PATCH', '/guilds/{guild_id}/vanity-url', guild_id=guild_id), json=payload, reason=reason) |
|
|
|
|
|
|
|
|
def prune_members(self, guild_id, days, *, reason=None): |
|
|
def prune_members(self, guild_id, days, *, reason=None): |
|
@ -622,7 +619,7 @@ class HTTPClient: |
|
|
return self.request(r, json=payload, reason=reason) |
|
|
return self.request(r, json=payload, reason=reason) |
|
|
|
|
|
|
|
|
def get_audit_logs(self, guild_id, limit=100, before=None, after=None, user_id=None, action_type=None): |
|
|
def get_audit_logs(self, guild_id, limit=100, before=None, after=None, user_id=None, action_type=None): |
|
|
params = { 'limit': limit } |
|
|
params = {'limit': limit} |
|
|
if before: |
|
|
if before: |
|
|
params['before'] = before |
|
|
params['before'] = before |
|
|
if after: |
|
|
if after: |
|
|