diff options
| author | Rapptz <[email protected]> | 2016-11-05 16:57:52 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-03 09:51:55 -0500 |
| commit | 5cb3ad14e8501961c2684498682bfb4e0fb016ff (patch) | |
| tree | 29d314d03844af9359fb47f3f7ab3c90aaf76ab1 /discord/emoji.py | |
| parent | Make roles and guilds stateful. (diff) | |
| download | discord.py-5cb3ad14e8501961c2684498682bfb4e0fb016ff.tar.xz discord.py-5cb3ad14e8501961c2684498682bfb4e0fb016ff.zip | |
Make emojis and members stateful.
Diffstat (limited to 'discord/emoji.py')
| -rw-r--r-- | discord/emoji.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/discord/emoji.py b/discord/emoji.py index 9e90bff6..1f06c7e4 100644 --- a/discord/emoji.py +++ b/discord/emoji.py @@ -24,6 +24,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +import asyncio + from . import utils from .mixins import Hashable @@ -107,3 +109,51 @@ class Emoji(Hashable): def url(self): """Returns a URL version of the emoji.""" return "https://discordapp.com/api/emojis/{0.id}.png".format(self) + + + @asyncio.coroutine + def delete(self): + """|coro| + + Deletes the custom emoji. + + You must have :attr:`Permissions.manage_emojis` permission to + do this. + + Guild local emotes can only be deleted by user bots. + + Raises + ------- + Forbidden + You are not allowed to delete emojis. + HTTPException + An error occurred deleting the emoji. + """ + + yield from self._state.http.delete_custom_emoji(self.guild.id, self.id) + + @asyncio.coroutine + def edit(self, *, name): + """|coro| + + Edits the custom emoji. + + You must have :attr:`Permissions.manage_emojis` permission to + do this. + + Guild local emotes can only be edited by user bots. + + Parameters + ----------- + name: str + The new emoji name. + + Raises + ------- + Forbidden + You are not allowed to edit emojis. + HTTPException + An error occurred editing the emoji. + """ + + yield from self._state.http.edit_custom_emoji(self.guild.id, self.id, name=name) |