Exemplo n.º 1
0
 async def info(self, ctx, id: int):
     """Shows you info on a todo"""
     results = await self.bot.db.fetch("SELECT * FROM todo WHERE id = $1", id)
     if not results:
         raise commands.BadArgument(f'{id} is not a valid todo!')
     results = results[0]
     embed = discord.Embed(colour=self.bot.colour)
     embed.title = f"{results['todo']} » `{results['id']}`"
     time = dt.utcfromtimestamp(results['time'])
     since = nt(dt.utcnow() - time)
     embed.description = f'{results["description"] or ""}\n'
     embed.description += f"<:clock:738186842343735387> **{since}**\n"
     embed.description += f"**{time.strftime('%A %B %d, %Y at %I:%M %p')}**"
     await ctx.send(embed=embed)
Exemplo n.º 2
0
 async def list(self, ctx):
     """Shows your todo list"""
     items = []
     results = sorted((await self.get_all_todo(ctx.author.id)),
                      key=lambda x: x['time'])
     for each in results:
         time = dt.utcfromtimestamp(each['time'])
         since = nt(dt.utcnow() - time)
         items.append(
             f"[{each['todo']}]({each['message_url']}) (ID: {each['id']} | Created {since})"
         )
     source = paginator.IndexedListSource(
         data=items,
         embed=discord.Embed(colour=self.bot.colour),
         title="Items")
     menu = paginator.CatchAllMenu(source=source)
     await menu.start(ctx)
Exemplo n.º 3
0
 async def todo(self, ctx):
     """Shows your current todo list"""
     items = []
     results = sorted((await self.get_all_todo(ctx.author.id)), key=lambda x: x['time'])
     for each in results:
         time = dt.utcfromtimestamp(each['time'])
         since = nt(dt.utcnow() - time)
         if each['description']:
             desc_em = "❔"
         else:
             desc_em = ""
         items.append(f"[{each['todo']}]({each['message_url']}) (ID: {each['id']} | Created {since}) {desc_em}")
     source = paginator.IndexedListSource(data=items, embed=discord.Embed(colour=self.bot.colour),
                                          title="Items (`❔` indicates that the todo has a description)", per_page=5)
     menu = paginator.CatchAllMenu(source=source)
     menu.add_info_fields({"❔": "Indicates that the todo has a description"})
     await menu.start(ctx)