Browse Source

Add GuildMember.modify

pull/21/head
Andrei 8 years ago
parent
commit
12031c3d73
  1. 2
      disco/api/client.py
  2. 3
      disco/types/guild.py

2
disco/api/client.py

@ -240,7 +240,7 @@ class APIClient(LoggingClass):
return GuildMember.create(self.client, r.json(), guild_id=guild)
def guilds_members_modify(self, guild, member, **kwargs):
self.http(Routes.GUILDS_MEMBERS_MODIFY, dict(guild=guild, member=member), json=kwargs)
self.http(Routes.GUILDS_MEMBERS_MODIFY, dict(guild=guild, member=member), json=optional(**kwargs))
def guilds_members_roles_add(self, guild, member, role):
self.http(Routes.GUILDS_MEMBERS_ROLES_ADD, dict(guild=guild, member=member, role=role))

3
disco/types/guild.py

@ -200,6 +200,9 @@ class GuildMember(SlottedModel):
else:
self.client.api.guilds_members_modify(self.guild.id, self.user.id, nick=nickname or '')
def modify(self, **kwargs):
self.client.api.guilds_members_modify(self.guild.id, self.user.id, **kwargs)
def add_role(self, role):
self.client.api.guilds_members_roles_add(self.guild.id, self.user.id, to_snowflake(role))

Loading…
Cancel
Save