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)
评论列表
文章目录