#🔒 Button with embed

20 messages · Page 1 of 1 (latest)

hoary halo
#

How to make a button with embed?

bronze hillBOT
#

@hoary halo

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

kind dagger
#

As far as i know they can coexist the bigger problem how to make buttons

hoary halo
kind dagger
hoary halo
#
class acceptbutton(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
        discord.ui.Button(label="Откликнуться", style=discord.ButtonStyle.green)
        
        async def accept(self, intercation: discord.Interaction, button: discord.Button):
            pass


@bot.hybrid_command(name="заказ"
                    )
async def order(ctx, цель, количество_нужных_фрилансеров, тип_работы):
    embed = discord.Embed(colour=discord.Colour.green(), title="Новый заказ от" + str(ctx.author),
                          description="Цель:" + str(цель) + " \n Нужное количество работников: " + str(
                              количество_нужных_фрилансеров))
    if тип_работы == "Билдер":
        channel = bot.get_channel(1218449220487352421)
        await channel.send(embed=embed)
        await ctx.send("Заказ успешно сформирован")

    if тип_работы == "Скриптер":
        channel = bot.get_channel(1218449286388387881)
        await channel.send(content="", view=acceptbutton())
        await ctx.send("Заказ успешно сформирован")

    if тип_работы == "Моделер":
        channel = bot.get_channel(1218449340050309120)
        await channel.send(embed=embed)
        await ctx.send("Заказ успешно сформирован")
kind dagger
#

Does that work without embeds?

#

And what error u get

hoary halo
hoary halo
kind dagger
#

As far as i know u need to use view to append or something like that buttons to it and u define a button by ui.button and than overwrite the func responsible for the callback

#

Find a tutorial

kind dagger
#

Ill soon be home (max 20m) than with a computer and past code of mine i can trz to help

kind dagger
bronze hillBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.