selfbot_goodies.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:goldmine 作者: Armored-Dragon 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号