general.py 文件源码

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

项目:Excalibot 作者: endreman0 项目源码 文件源码
def timer_list(self, ctx):
        """Lists all of your currently active timers."""
        with db.Session() as session:
            timers = session.get(Timer, user_id=ctx.author.id).all()
        now = datetime.utcnow()
        e = discord.Embed(color=discord.Color.blurple())
        def format_timer(timer):
            channel = ctx.bot.get_channel(timer.channel_id)
            return 'ID {id}, in {channel}: {message} (in {duration})'.format(
                id=timer.id,
                channel='DMs' if isinstance(channel, discord.DMChannel) else channel.mention,
                message=timer.message or 'no message',
                duration=format.time(timer.end_time - now)
            )
        e.description = '\n'.join(map(format_timer, timers)) if timers else 'No timers set.'
        await ctx.send(embed=e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号