cog_action.py 文件源码

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

项目:Godavaru 作者: Godavaru 项目源码 文件源码
def wakeup(self, ctx):
        """A way to get your friends off of their lazy butts and wake up.

        **Usage:** `g_wakeup <user(s)>`

        **Permission:** User"""
        img = ["./images/wakeupa.gif", "./images/wakeupb.gif", "./images/wakeupc.gif", "./images/wakeupd.gif", "./images/wakeupe.gif", "./images/wakeupf.gif", "./images/wakeupg.gif", "./images/wakeuph.gif"]
        var = int(random.random() * len(img))

        if len(ctx.message.mentions) == 0:
            await ctx.send(":x: You must mention a user!")
        elif len(ctx.message.mentions) > 0:
            ments = ""
            for x in range(0, len(ctx.message.mentions)):
                if ctx.message.mentions[x].id == ctx.message.author.id:
                    msg = '<:morning:319631823766552597> What are you trying to wake up? Well, you do you I guess.'
                    await ctx.send(file=discord.File(img[var]), content=msg)
                    return
                if x == 0:
                    ments = ctx.message.mentions[x].display_name
                elif x == len(ctx.message.mentions) - 1:
                    if len(ctx.message.mentions) == 2:
                        ments = ments+" and "+ctx.message.mentions[x].display_name
                    else:
                        ments = ments+", and "+ctx.message.mentions[x].display_name
                else:
                    ments = ments+", "+ctx.message.mentions[x].display_name
            msg = '<:morning:319631823766552597> **' + ments + '**, rise and shine! **' + ctx.message.author.display_name + '** wants you to wake up!'
            await ctx.send(file=discord.File(img[var]), content=msg)
        else:
            await ctx.send("An unexpected error occurred. Please report this to Desiree#3658 on the support guild, link found in g!about.") # just in case. You never know shrug
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号