def add_emote(self, ctx, emote: str):
"""Add a Twitch, FrankerFaceZ, BetterTTV, or Discord emote to the current guild.
Usage: add_emote [name of emote]"""
echeck_perms(ctx, ('bot_owner',))
emote = emote.replace(':', '')
with async_timeout.timeout(12):
try:
async with self.bot.cog_http.get('https://static-cdn.jtvnw.net/emoticons/v1/' + str(self.bot.emotes['twitch'][emote]['image_id']) + '/1.0') as resp:
emote_img = await resp.read()
except KeyError: # let's try frankerfacez
try:
async with self.bot.cog_http.get('https://cdn.frankerfacez.com/emoticon/' + str(self.bot.emotes['ffz'][emote]) + '/1') as resp:
emote_img = await resp.read()
except KeyError: # let's try BetterTTV
try:
async with self.bot.cog_http.get(self.bot.emotes['bttv'][emote]) as resp:
emote_img = await resp.read()
except KeyError: # let's try Discord
await ctx.send('**No such emote!** I can fetch from Twitch, FrankerFaceZ, BetterTTV, or Discord (soon).')
return False
result = ctx.guild.create_custom_emoji(emote, emote_img)
await ctx.send('Added. ' + str(result))
评论列表
文章目录