示例#1
0
 def __init__(self, join_button: Button, message: str, *args,
              **kwargs) -> None:
     super().__init__(*args, **kwargs)
     self.message = message
     join_button.callback = self.button_pressed
     self.add_item(join_button)
     self.joined: set[User] = set()
示例#2
0
 def __init__(self,
              future: Future[User],
              join_button: Button,
              allowed: User | None = None,
              prohibited: User | None = None,
              check: Callable[[User], Awaitable[bool]] | None = None,
              check_fail_message: str | None = None,
              *args,
              **kwargs) -> None:
     super().__init__(*args, **kwargs)
     join_button.callback = self.button_pressed
     self.add_item(join_button)
     self.future = future
     self.allowed = allowed
     self.prohibited = prohibited
     self.check = check
     self.check_fail_message = check_fail_message
示例#3
0
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)