I wanna remove buttons in message after clicking it.
i use message.edit(components = None)
but it doest works, in Disnake i use message.edit(view = None)
and it works, i no need for disabled buttons, i want to remove there
`import interactions as inter
from interactions.api.events import Component
import datetime
bot = inter.Client(intents = inter.Intents.DEFAULT)
@inter.listen()
async def on_ready():
print(f"Bot {bot.user} is ready to work!")
finish = inter.Button(
custom_id="finish",
style=inter.ButtonStyle.RED,
label="Закрыть отчёт",
)
async def check(component: Component) -> bool:
finish.disabled = True
return True
@inter.slash_command(name = "start", description = "Начать модерить!")
@inter.slash_option(
name = "server",
description = "Выберите сервер для начала модерации",
required = True,
opt_type = inter.OptionType.STRING,
choices=[
inter.SlashCommandChoice(name="Universe", value="Universe"),
inter.SlashCommandChoice(name="Atlas", value="Atlas")
]
)
@inter.slash_option(
name = "online",
description = "Введите текущий онлайн сервера",
required = True,
opt_type = inter.OptionType.INTEGER
)
async def start(ctx: inter.SlashContext, server: str, online: int):
await ctx.send("Вам выдана роль!", ephemeral = True)
start_time = datetime.datetime.now()
role = inter.utils.get(ctx.author.guild.roles, name = "Модератор онлайн")
channel = bot.get_channel(ctx.channel.id)
await ctx.author.add_role(role)
message = await channel.send(f":green_circle: {ctx.author.mention} начал модерить на сервере !n1. {server}n2. {online}", components = finish)
await bot.wait_for_component(components=finish,check = check)
await message.edit(components = None) # This
await ctx.author.remove_role(role)
bot.start("Token")`
New contributor
Bezarm is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.