async def display_leaderboard(self, ctx): records = db.records("SELECT UserID, XP, Level FROM exp ORDER BY XP DESC") menu = MenuPages(source=HelpMenu(ctx, records), clear_reactions_after=True, timeout=60.0) await menu.start(ctx)
async def rich_users(self, ctx): records = db.records( "SELECT UserID, Wallet FROM economy ORDER BY Wallet DESC") menu = MenuPages(source=HelpMenu(ctx, records), clear_reactions_after=True, timeout=60.0) await menu.start(ctx)
async def on_ready(self): self.log_channel = utils.get(self.bot.guild.channels, name='log') self.mute_role = self.bot.guild.get_role(789384900242833440) if not self.bot.ready: unmutes = [] active_mutes = db.records("SELECT UserID, EndTime FROM mutes") for userid, endtime in active_mutes: if endtime and datetime.utcnow() > (et := datetime.fromisoformat(endtime)): unmutes.append(self.bot.guild.get_member(userid)) else: self.bot.scheduler.add_job(self.unmute_members, 'date', run_date=et, args=[self.bot.guild, [self.bot.guild.get_member(userid)]]) if len(unmutes): await self.unmute_members(self.bot.guild, unmutes) self.bot.cogs_ready.ready_up('mod')
async def assignment_display_all_command( self, ctx, target: t.Optional[t.Union[discord.Member, str]]): target = target or ctx.author if target != ctx.author and self.bot.guild.get_role( 832910076972630106 ) not in target.roles and self.bot.guild.get_role( 832910125329022977) in target.roles: await ctx.send("That user's list is private") return assignments = db.records( "SELECT Name, DueDate, Completed FROM assignments WHERE UserID = ?", target.id) embed = Embed(title=f"{target.name}'s Assignments") for assignment in assignments: embed.add_field( name=f"{assignment[0]}", value=f"Due on {assignment[1]}\nCompleted: {assignment[2]}", inline=False) await ctx.send(embed=embed)
async def reminds(self): now = datetime.now() date_string = now.strftime("%m/%d/%Y %H:%M") current_date = date_string.replace(":", "/") current_date = current_date.replace(" ", "/") current_date = current_date.split("/") if current_date[0].startswith("0") and len(current_date[0]) == 2: current_date[0] = current_date[0].replace("0", "") if current_date[1].startswith("0") and len(current_date[1]) > 1: current_date[1] = current_date[1].replace("0", "") assignments = db.records("SELECT UserID, Name, DueDate FROM assignments") for assignment in assignments: due_date = assignment[2].replace(":", "/") due_date = due_date.replace(" ", "/") due_date = due_date.split("/") if due_date[0] == current_date[0] and due_date[1] == current_date[1] and due_date[2] == current_date[2]: if int(due_date[3]) - int(current_date[3]) == 1 and int(due_date[4]) - int(current_date[4]) == 0: member = await self.bot.guild.fetch_member(assignment[0]) await member.send(f"{assignment[1]} is due in an hour!")