cog_utils.py 文件源码

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

项目:Godavaru 作者: Godavaru 项目源码 文件源码
def quote(self, ctx):
        """Get a message from either the current channel or a specified channel.

        **Usage:** `g_quote [channel id] <message id>`

        **Permission:** User"""
        umsg = ctx.message.content
        args = umsg.split(' ')
        if '--s' in umsg:
            await ctx.message.delete()
        if len(args) > 1:
            try:
                if len(args) > 2:
                    channel = self.bot.get_channel(int(args[1]))
                    msg = await channel.get_message(int(args[2]))
                else:
                    channel = ctx.message.channel
                    msg = await channel.get_message(int(args[1]))
                em = discord.Embed(title="Found message!",description=msg.content,color=self.randomColour())
                em.set_footer(text='Author: {}'.format(str(msg.author)))
                em.timestamp = msg.created_at
                await ctx.send(embed=em)
            except ValueError:
                await ctx.send(":x: Please enter an id (or multiple) to find a message.")
            except discord.NotFound:
                await ctx.send(":x: I'm sorry, but I couldn't find that message. :sob:")
        else:
            await ctx.send("Improper arguments.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号