Browse Source

feature - add guild emoji management routes

pull/11/head
Andrei 8 years ago
parent
commit
5d2d20a42b
  1. 17
      disco/api/client.py
  2. 4
      disco/api/http.py

17
disco/api/client.py

@ -5,7 +5,7 @@ from disco.util.logging import LoggingClass
from disco.types.user import User
from disco.types.message import Message
from disco.types.guild import Guild, GuildMember, Role
from disco.types.guild import Guild, GuildMember, Role, GuildEmoji
from disco.types.channel import Channel
from disco.types.invite import Invite
from disco.types.webhook import Webhook
@ -263,6 +263,21 @@ class APIClient(LoggingClass):
r = self.http(Routes.GUILDS_WEBHOOKS_LIST, dict(guild=guild))
return Webhook.create_map(self.client, r.json())
def guilds_emojis_list(self, guild):
r = self.http(Routes.GUILDS_EMOJIS_LIST, dict(guild=guild))
return GuildEmoji.create_map(self.client, r.json())
def guilds_emojis_create(self, guild, **kwargs):
r = self.http(Routes.GUILDS_EMOJIS_CREATE, dict(guild=guild), json=kwargs)
return GuildEmoji.create(self.client, r.json())
def guilds_emojis_modify(self, guild, emoji, **kwargs):
r = self.http(Routes.GUILDS_EMOJIS_MODIFY, dict(guild=guild, emoji=emoji), json=kwargs)
return GuildEmoji.create(self.client, r.json())
def guilds_emojis_delete(self, guild, emoji):
self.http(Routes.GUILDS_EMOJIS_DELETE, dict(guild=guild, emoji=emoji))
def invites_get(self, invite):
r = self.http(Routes.INVITES_GET, dict(invite=invite))
return Invite.create(self.client, r.json())

4
disco/api/http.py

@ -98,6 +98,10 @@ class Routes(object):
GUILDS_EMBED_GET = (HTTPMethod.GET, GUILDS + '/embed')
GUILDS_EMBED_MODIFY = (HTTPMethod.PATCH, GUILDS + '/embed')
GUILDS_WEBHOOKS_LIST = (HTTPMethod.GET, GUILDS + '/webhooks')
GUILDS_EMOJIS_LIST = (HTTPMethod.GET, GUILDS + '/emojis')
GUILDS_EMOJIS_CREATE = (HTTPMethod.POST, GUILDS + '/emojis')
GUILDS_EMOJIS_MODIFY = (HTTPMethod.PATCH, GUILDS + '/emojis/{emoji}')
GUILDS_EMOJIS_DELETE = (HTTPMethod.DELETE, GUILDS + '/emojis/{emoji}')
# Users
USERS = '/users'

Loading…
Cancel
Save