#Missing 1 required positional argument: 'self'
1 messages · Page 1 of 1 (latest)
Oh, I did it and everything works although while everything executes correctly after clicking the button, bot says This interaction failed
;/
is it because it all takes longer than 3 secs or what
show your code
class MyView(discord.ui.View):
def __init__(self, ctx):
self.ctx = ctx
@discord.ui.button(label="A button", style=discord.ButtonStyle.primary)
async def button_callback(self, button, interaction):
button.disabled = True # set button.disabled to True to disable the button
button.label = "No more pressing!" # change the button's label to something else
await self.ctx.send("You pressed the button!") # send a message to the context
@bot.slash_command(guilds=serwery)
async def wyznaj(
ctx: discord.ApplicationContext,
treść: Option(
str, "Treść anonimowej wiadomości którą chcesz wysłać.",
min_length=1,
max_length=2000)):
# Get the current confession number and increment it by 1 for the preview purposes.
preview_number = Confession.get_last_confession_number()
preview_number += 1
# Preview the message before sending it
await ctx.respond(f"**You're sure you want to send this?**", view=MyView(ctx), embed=Confession.preview_message(treść, preview_number), ephemeral=True)```
i'd do interaction.channel.send but doesnt matter
can you show what you see in discord
When it comes to console, nothing
Docs are complicated to read, and I don't know what's the difference
I mean I see a lot of things such as fetch_channel, get_channel, get_channel_or_thread and by simply looking at those docs I can't see what differs them
you need to use interaction.response.send_message to respond to the button interaction
ctx.send is related to the slash command, not the button
I know, but I want to send an embed to channel anonymously, so others don't necessarily see who has executed command
you can use ephemeral=True on send_message