async def resources(ctx): MathSolution = Button( label="Math Solution", url= "https://aakritsubedi9.com.np/uploads/2/SH451_2020-12-07T02:52:49.778Z_Maths%20Solution%20II%20Sem.pdf" ) view = View() view.add_item(MathSolution) await ctx.reply("**OK NERD!!**", view=view)
async def anime(self, interaction: discord.Interaction, params: str): print( f'{interaction.user}({interaction.user.id}) executed Anime command.' ) await interaction.response.send_message(embed=discord.Embed( title='Fetching Data...Please Wait.', color=self.client.guilds[0].get_member(self.client.user.id).color)) search = AnimeSearch(params) if len(search.results) > 0: anime_data = search.results[0] anime_data_2 = Anime(anime_data.mal_id) print(anime_data_2.title) embed = discord.Embed(title=anime_data.title, description=anime_data_2.title_japanese, color=self.client.guilds[0].get_member( self.client.user.id).color, url=anime_data.url) embed.set_image(url=anime_data.image_url) embed.add_field(name='Synopsis', value=anime_data.synopsis, inline=False) embed.add_field(name='Episodes', value=str(anime_data_2.episodes), inline=True) embed.add_field(name='Status', value=str(anime_data_2.status), inline=True) embed.add_field(name='Score', value=str(anime_data.score), inline=True) embed.set_footer(text=f'Aired: {anime_data_2.aired}') button = Button(label='View on site', style=discord.ButtonStyle.url, url=anime_data_2.url) view = View() view.add_item(button) await interaction.edit_original_message(embed=embed, view=view) else: await interaction.edit_original_message( embed=await helpers.embed_helper.create_error_embed( f'Could not find any anime similar to {params}'))
async def standing(self, interaction: discord.Interaction, user: discord.User): if await helpers.role_helper.has_role(interaction.guild, interaction.user.id, 'mod') or interaction.user.guild_permissions.administrator: print(f'{interaction.user}({interaction.user.id}) executed Standing command.') embed = discord.Embed( title=f'Standing for {user}', color=interaction.guild.get_member(self.client.user.id).color, description=f'Current Warning Points: {await get_warn_points(user.id)}' ) punishments = await get_punishments(user.id) embeds = [] if len(punishments) > 0: messages_per_page = 6 total_pages = math.ceil(len(punishments) / messages_per_page) for i in range(1, total_pages + 1): number = min((messages_per_page * i), len(punishments)) for j in range((messages_per_page * (i - 1)), number): t = datetime.fromisoformat(punishments[j][3]).utctimetuple() ep = calendar.timegm(t) if j == messages_per_page * (i - 1): embed.add_field(name='Type / Giver', value=f'{get_type_string(punishments[j][2])} - {interaction.guild.get_member(int(punishments[j][5])).mention}', inline=True) embed.add_field(name='Time', value=f'<t:{ep}>', inline=True) embed.add_field(name='UUID', value=punishments[j][0], inline=True) else: embed.add_field(name='\u200b', value=f'{get_type_string(punishments[j][2])} - {interaction.guild.get_member(int(punishments[j][5])).mention}', inline=True) embed.add_field(name='\u200b', value=f'<t:{ep}>', inline=True) embed.add_field(name='\u200b', value=punishments[j][0], inline=True) if total_pages > 1: embed.add_field(name='\u200b', value=f'Page [{i}/{total_pages}]', inline=True) embeds.append(embed) view = ModView(embeds, total_pages) await interaction.response.send_message( embed=embeds[0], view=(view if len(embeds) > 1 else View()) ) else: embed.add_field(name='Punishments:', value='N/A', inline=False) await interaction.response.send_message(embed=embed) else: await interaction.response.send_message( embed=await helpers.embed_helper.create_error_embed('You do not have permission to use this command.') )
async def cleanUpPrivateChannels(self, ctx): channelsToDelete = getValidChannelsToDelete(ctx.guild.voice_channels) if len(channelsToDelete) == 0: await ctx.send("There are no valid channels to delete!") return view = View(timeout=100) view.add_item(ConfirmButton(True, channelsToDelete, ctx.message.author)) view.add_item( ConfirmButton(False, channelsToDelete, ctx.message.author)) await ctx.send( f'You are about to delete {len(channelsToDelete)} private channel(s). Please Confirm that you want to do this!', view=view) return
async def remindMe(self, ctx, message, time): view = View(timeout=100) for key in self.units: view.add_item(ReminderButton(ctx.author, ctx.channel.guild.id, ctx.channel.name, message, time, key, discord.ButtonStyle.blurple, self.units.get(key))) await ctx.send(embed=generateReminderEmbed(message), view=view) return
async def logs(self, interaction: discord.Interaction, user_id: str): if await helpers.role_helper.has_role(interaction.guild, interaction.user.id, 'mod') or interaction.user.guild_permissions.administrator: print(f'{interaction.user}({interaction.user.id}) executed Logs command.') embeds = [] messages = await get_messages(user_id) if len(messages) > 0: messages_per_page = 6 total_pages = math.ceil(len(messages) / messages_per_page) for i in range(1, total_pages + 1): user = interaction.guild.get_member(int(user_id)) if user is None: user = await self.client.fetch_user(int(user_id)) embed = discord.Embed( title=f'Messages From {user}', color=interaction.guild.get_member(self.client.user.id).color ) number = min((messages_per_page * i), len(messages)) for j in range((messages_per_page * (i - 1)), number): t = datetime.fromisoformat(messages[j][5]).utctimetuple() ep = calendar.timegm(t) channel = interaction.guild.get_channel(int(messages[j][4])) if channel is None: channel = f'#{messages[j][3]}' else: channel = channel.mention if messages[j][6] == 0: deleted = '✅' else: deleted = '❌' if j == messages_per_page * (i - 1): embed.add_field(name='Message', value=messages[j][2], inline=True) embed.add_field(name='Time', value=f'<t:{ep}>', inline=True) embed.add_field(name='Message Status/Channel', value=f'{deleted} - {channel}', inline=True) else: embed.add_field(name='\u200b', value=messages[j][2], inline=True) embed.add_field(name='\u200b', value=f'<t:{ep}>', inline=True) embed.add_field(name='\u200b', value=f'{deleted} - {channel}', inline=True) if total_pages > 1: embed.add_field(name='\u200b', value=f'Page [{i}/{total_pages}]', inline=True) embeds.append(embed) view = ModView(embeds, total_pages) await interaction.response.send_message( embed=embeds[0], view=(view if total_pages > 1 else View()) ) else: await interaction.response.send_message( embed=await helpers.embed_helper.create_error_embed('This user has no message history.') ) else: await interaction.response.send_message( embed=await helpers.embed_helper.create_error_embed('You do not have permission to use this command.') )
async def qnbank(ctx): Mathematics = Button( label="Mathematics", url= "https://aakritsubedi9.com.np/uploads/que-bank/Engineering-Mathematics-II.pdf" ) Chemistry = Button( label="Chemistry", url= "https://aakritsubedi9.com.np/uploads/que-bank/Engineering-Chemistry.pdf" ) Drawing = Button( label="Drawing", url= "https://aakritsubedi9.com.np/uploads/que-bank/Engineering-Drawing-II.pdf" ) Electronics = Button( label="Electronics", url= "https://aakritsubedi9.com.np/uploads/que-bank/Basic-Electronics-Engineering.pdf" ) Thermodynamics = Button( label="Thermodynamics", url="https://aakritsubedi9.com.np/uploads/que-bank/Thermodynamics.pdf") view = View() view.add_item(Mathematics) view.add_item(Chemistry) view.add_item(Drawing) view.add_item(Electronics) view.add_item(Thermodynamics) await ctx.reply( "**Old Questions**\nPro tip: Once you click __trust this domain__, the button will directly open the url without the confirmation box", view=view)
async def routine(ctx): view = View() Sunday = Button(label="Sunday", style=discord.ButtonStyle.green) async def Sunday_callback(interaction): embed = discord.Embed(title=" ", color=0xe100ff) embed.set_author(name="-SUNDAY-") embed.add_field(name="**Test**", value="11:00 - 11:45", inline=False) embed.add_field(name="**Maths - ChD**", value="11:45 - 1:15", inline=False) embed.add_field(name="**Drawing**", value="2:00 - 5:00", inline=False) embed.set_footer(text="Hope you fail!") await interaction.response.send_message(embed=embed) Sunday.callback = Sunday_callback view.add_item(Sunday) Monday = Button(label="Monday", style=discord.ButtonStyle.green) async def Monday_callback(interaction): embed = discord.Embed(title=" ", color=0xe100ff) embed.set_author(name="-MONDAY-") embed.add_field(name="**Thermodynamics**", value="11:00 - 12:30", inline=False) embed.add_field(name="**Electronics - BRM**", value="12:30 - 1:15", inline=False) embed.add_field(name="**Drawing**", value="2:00 - 5:00", inline=False) embed.set_footer(text="Hope you fail!") await interaction.response.send_message(embed=embed) Monday.callback = Monday_callback view.add_item(Monday) Tuesday = Button(label="Tuesday", style=discord.ButtonStyle.green) async def Tuesday_callback(interaction): embed = discord.Embed(title=" ", color=0xe100ff) embed.set_author(name="-TUESDAY-") embed.add_field(name="**Math - BK**", value="11:00 - 12:30", inline=False) embed.add_field(name="**Electronics - DG**", value="12:30 - 2:00", inline=False) embed.add_field(name="**Math - ChD**", value="2:45 - 3:30", inline=False) embed.add_field(name="**Chemistry - RPD**", value="3:30 - 5:00", inline=False) await interaction.response.send_message(embed=embed) Tuesday.callback = Tuesday_callback view.add_item(Tuesday) Wednesday = Button(label="Wednesday", style=discord.ButtonStyle.green) async def Wednesday_callback(interaction): embed = discord.Embed(title=" ", color=0xe100ff) embed.set_author(name="-WEDNESDAY-") embed.add_field(name="**Thermodynamics/Elctronics Lab**", value="11:00 - 1:45", inline=False) embed.add_field(name="**Chemistry - RPD**", value="11:45 - 1:15", inline=False) embed.add_field(name="**Thermodynamics -MLP**", value="2:00 - 5:00", inline=False) embed.set_footer(text="Hope you fail!") await interaction.response.send_message(embed=embed) Wednesday.callback = Wednesday_callback view.add_item(Wednesday) Thurdsday = Button(label="Thurdsday", style=discord.ButtonStyle.green) async def Thurdsday_callback(interaction): embed = discord.Embed(title=" ", color=0xe100ff) embed.set_author(name="-THURSDAY-") embed.add_field(name="**Thermodynamics**", value="11:00 - 12:30", inline=False) embed.add_field(name="**Electronics - BRM**", value="12:30 - 1:15", inline=False) embed.add_field(name="**Chemistry**", value="2:00 - 2:45", inline=False) embed.add_field(name="**Tutorial - BK**", value="2:45 - 3:30", inline=False) embed.add_field(name="**Tutorial - MLP**", value="3:30 - 4:15", inline=False) embed.add_field(name="**Tutorial - DG**", value="4:15 - 5:00", inline=False) embed.set_footer(text="Hope you fail!") await interaction.response.send_message(embed=embed) Thurdsday.callback = Thurdsday_callback view.add_item(Thurdsday) Friday = Button(label="Friday", style=discord.ButtonStyle.green) async def Friday_callback(interaction): embed = discord.Embed(title=" ", color=0x45a1f7) embed.set_author(name="-FRIDAY-") embed.add_field(name="**Electronics - BRM**", value="11 - 12:30", inline=False) embed.add_field(name="**Maths - ChD**", value="12:30 - 1:15", inline=False) embed.add_field(name="**Chemistry - NRB**", value="2:00 - 2:45", inline=False) embed.add_field(name="**Chemistry Lab**", value="2:45 - 5:00", inline=False) embed.set_footer(text="Hope you fail!") await interaction.response.send_message(embed=embed) Friday.callback = Friday_callback view.add_item(Friday) await ctx.reply("**Routine**", view=view)