mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 17:36:15 +00:00
Drop support for Python 3.4 and make minimum version 3.5.2.
This commit is contained in:
@ -171,8 +171,7 @@ class Role(Hashable):
|
||||
|
||||
return [member for member in all_members if self in member.roles]
|
||||
|
||||
@asyncio.coroutine
|
||||
def _move(self, position, reason):
|
||||
async def _move(self, position, reason):
|
||||
if position <= 0:
|
||||
raise InvalidArgument("Cannot move role to position 0 or below")
|
||||
|
||||
@ -196,10 +195,9 @@ class Role(Hashable):
|
||||
roles.append(self.id)
|
||||
|
||||
payload = [{"id": z[0], "position": z[1]} for z in zip(roles, change_range)]
|
||||
yield from http.move_role_position(self.guild.id, payload, reason=reason)
|
||||
await http.move_role_position(self.guild.id, payload, reason=reason)
|
||||
|
||||
@asyncio.coroutine
|
||||
def edit(self, *, reason=None, **fields):
|
||||
async def edit(self, *, reason=None, **fields):
|
||||
"""|coro|
|
||||
|
||||
Edits the role.
|
||||
@ -240,7 +238,7 @@ class Role(Hashable):
|
||||
|
||||
position = fields.get('position')
|
||||
if position is not None:
|
||||
yield from self._move(position, reason=reason)
|
||||
await self._move(position, reason=reason)
|
||||
self.position = position
|
||||
|
||||
try:
|
||||
@ -256,11 +254,10 @@ class Role(Hashable):
|
||||
'mentionable': fields.get('mentionable', self.mentionable)
|
||||
}
|
||||
|
||||
data = yield from self._state.http.edit_role(self.guild.id, self.id, reason=reason, **payload)
|
||||
data = await self._state.http.edit_role(self.guild.id, self.id, reason=reason, **payload)
|
||||
self._update(data)
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete(self, *, reason=None):
|
||||
async def delete(self, *, reason=None):
|
||||
"""|coro|
|
||||
|
||||
Deletes the role.
|
||||
@ -281,4 +278,4 @@ class Role(Hashable):
|
||||
Deleting the role failed.
|
||||
"""
|
||||
|
||||
yield from self._state.http.delete_role(self.guild.id, self.id, reason=reason)
|
||||
await self._state.http.delete_role(self.guild.id, self.id, reason=reason)
|
||||
|
Reference in New Issue
Block a user