mirror of
https://github.com/uhIgnacio/EmoteManager.git
synced 2024-08-15 02:23:13 +00:00
Merge branch 'master' into metrics
This commit is contained in:
commit
b0a3913391
1 changed files with 2 additions and 6 deletions
|
@ -10,6 +10,7 @@ import datetime
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
from discord import PartialEmoji
|
||||||
import utils.image as image_utils
|
import utils.image as image_utils
|
||||||
from utils.errors import RateLimitedError
|
from utils.errors import RateLimitedError
|
||||||
from discord import HTTPException, Forbidden, NotFound, DiscordServerError
|
from discord import HTTPException, Forbidden, NotFound, DiscordServerError
|
||||||
|
@ -60,8 +61,6 @@ class EmoteClient:
|
||||||
'Authorization': 'Bot ' + bot.config['tokens']['discord'],
|
'Authorization': 'Bot ' + bot.config['tokens']['discord'],
|
||||||
'X-Ratelimit-Precision': 'millisecond',
|
'X-Ratelimit-Precision': 'millisecond',
|
||||||
})
|
})
|
||||||
# internals 🤫
|
|
||||||
self._connection_state = bot._connection
|
|
||||||
|
|
||||||
async def request(self, method, path, guild_id, **kwargs):
|
async def request(self, method, path, guild_id, **kwargs):
|
||||||
self._check_rl(method, guild_id)
|
self._check_rl(method, guild_id)
|
||||||
|
@ -133,10 +132,7 @@ class EmoteClient:
|
||||||
json=dict(name=name, image=image_utils.image_to_base64_url(image), roles=role_ids),
|
json=dict(name=name, image=image_utils.image_to_base64_url(image), roles=role_ids),
|
||||||
reason=reason,
|
reason=reason,
|
||||||
)
|
)
|
||||||
# internals 🤫
|
return PartialEmoji(animated=data.get('animated', False), name=data.get('name'), id=data.get('id'))
|
||||||
# this is A) so we can return a bona-fide, authentic, Emoji object,
|
|
||||||
# and B) because it's what dpy does to keep the emoji cache up to date for s
|
|
||||||
return self._connection_state.store_emoji(guild, data)
|
|
||||||
|
|
||||||
async def delete(self, *, guild_id, emote_id, reason=None):
|
async def delete(self, *, guild_id, emote_id, reason=None):
|
||||||
return await self.request('DELETE', f'/guilds/{guild_id}/emojis/{emote_id}', guild_id, reason=reason)
|
return await self.request('DELETE', f'/guilds/{guild_id}/emojis/{emote_id}', guild_id, reason=reason)
|
||||||
|
|
Loading…
Reference in a new issue