E
E
Elvinchik2021-11-28 12:38:30
Python
Elvinchik, 2021-11-28 12:38:30

Interop Error: discord.py?

Hello! I have an interaction error here. I use the DiscordComponents library, namely SelectMenu.

So, when I select a category in the menu, it displays a message for me, and when I want to change this category, it displays "Interaction error"

Code:

@bot.command()
async def help(ctx):
home = discord .Embed(
title=' Help',
description='To get help on bot command categories, use the menu below the message.\n\n'
'Menu doesn't work? Type ``s.help Moderation/Rating/Activities/Economy /Info/Entertainment/Other``',
colour=discord.Color.purple()
)

home.set_footer(icon_url=ctx.author.avatar_url, text=f"Requested by {ctx.author}")

await ctx.send(
embed=home,
components=[
Select(
placeholder="Select Category",
options=[
SelectOption (label="Moderation", value="Moderation"),
SelectOption(label="Rating", value="Rating"),
SelectOption(label="Activities", value="Activities"),
SelectOption(label="Economy ", value="Economy"),
SelectOption(label="Information", value="Information"),
SelectOption(label="Entertainment", value="Entertainment"),
SelectOption(label="Other", value="Other")
]
)
]
)

interaction = await bot.wait_for("select_option")
selected = interaction.values[ 0]
if selected == "Moderation":
moderation = discord.Embed(
title=" Moderation",
description=f"``{p}ban [member] [reason]`` - Ban member\n ``{p} kick [member]`` - Kick member\n"
f"``{p}mute [member]`` - Mute chat for member\n``{p}unmute [member]`` - Unmute chat for member\n"
f"``{p}warn [member]`` — Warn member\n``{p}unwarn [member]`` — Clear member warning\n"
f"``{p}resetwarns [member]`` — Remove all member warnings\n``{p} clear [number]`` - Clear the chat\n"
f"``{p}warns [member]`` - View your member warning/warnings\n"
f"``{p}antilink on/off`` — Enable/disable antilink system\n``{p}lvlsystem on/off`` — Enable/disable level system"
f"``\n{p}addrole [role] [price]`` - Add a role to the store\n``{p}removerole [role]`` - Remove a role from the store\n"
f"``{p }set`` — Setting",
colour=discord.Color.purple()
)
moderation.set_footer(icon_url=ctx.author.avatar_url, text=f"Requested by {ctx.author}")
await interaction.edit_origin(embed= moderation)
elif selected == "Rating":
rating = discord.Embed(
title=" Rating",
description=f"``{p}leaderboards balance/level`` — Top by balance/level",
color=discord.Color .purple()
)
rating.set_footer(icon_url=ctx.author.avatar_url, text=f"Requested by {ctx.author}")
await interaction.edit_origin(embed=rating)
elif selected == "Activities":
activities = discord.Embed(
title= " Activities",
description=f"``{p}youtube`` — YouTube Together\n``{p}poker`` — Poker\n``{p}betroyal`` — BetRoyal.io\n"
f" ``{p}fishington`` - Fishington.io\n``{p}chess`` - Chess",
colour=discord.Color.purple()
)
activities.set_footer(icon_url=ctx.author.avatar_url, text= f"Requested from {ctx.author}")
await interaction.edit_origin(embed=activities)
elif selected == "Economy":
economy = discord.Embed(
title=" Economy",
description=f"``{p}balance [member]`` - Shows the member's balance\n``{p}tobank [amount] `` - Put money in the bank\n"
f"``{p}withdraw [amount]`` - Withdraw money from the bank\n``{p}beg`` - Beg for coins\n"
f"``{p }hunt`` — Go hunting\n``{p}fish`` — Go fishing\n``{p}work`` — Work\n"
f"``{p}daily`` — Daily reward \n``{p}weekly`` - Weekly Reward\n``{p}reward`` - Reward\n"
f"``{p}slots [amount]`` - Casino\n``{p}roulette [color] [amount]`` - Roulette\n``{p}shop`` - Shop\n``{ p}buy [category] [item]`` - Buy something from the store\n"
f"``{p}sell [category] [item]`` - Sell property\n``{p}buyrole [role ]`` - Buy a role\n``{p}roleshop`` - Role store\n"
f"``{p}addmoney [member] [amount]`` - Give money to a member\n``{p}takemoney [member] [amount]`` - Take money from a member\n"
f"``{p}bonus`` - Bonus for **Premium** users",
color=discord.Color.purple()
)
economy.set_footer (icon_url=ctx.author.avatar_url, text=f"Requested from {ctx.author}")
await interaction.edit_origin(embed=economy)
elif selected == "Info":
info = discord.Embed(
title="Info",
description=f"``{p}help`` — Get a list of bot commands\n`` {p}profile`` - Get your profile\n"
f"``{p}avatar [member]`` - Get member/own avatar\n``{p}ping`` - Get bot latency\n"
f "``{p}version`` - Get bot version\n``{p}server`` - Get server information\n"
f"``{p}bot`` - Get bot information",
color= discord.Color.purple()
)
info.set_footer(icon_url=ctx.author.avatar_url, text=f"Requested by {ctx.author}")
await interaction.edit_origin(embed=info)
elif selected == "Entertainment":
fun = discord.Embed(
title= " Entertainment",
description=f"``{p}8ball [question]`` — Ask the ball\n``{p}coin`` — Flip a coin\n"
f"``{p}knb [item] `` - Play rock-paper-scissors with the bot\n"
f"``{p}iq [participant]`` - Find out the participant's IQ\n``{p}try [action]`` - Try to do something \n"
f"``{p}kill [member]`` - Kill member\n``{p}kiss [member]`` - Kiss member\n"
f"``{p}pat [member]`` - Pat member\n``{p}poke [member]`` - Poke member\n"
f"``{p}hug [member]`` - Hug member\n``{p}eat [member]`` - Eat",
colour=discord.Color.purple()
)
fun.set_footer(icon_url=ctx.author.avatar_url, text=f"Requested by {ctx.author }")
await interaction.edit_origin(embed=fun)
elif selected == "Other":
other = discord.Embed(
title=" Miscellaneous",
description=f"``{p}afk`` — Depart\n`` {p}say`` - Say as a bot\n``{p}tinyurl [link]`` - Shorten link\n"
f"``{p}rand [number] [number]`` — Random number",
colour=discord.Color.purple()
)
other.set_footer(icon_url=ctx.author.avatar_url, text=f"Requested by { ctx.author}")
await interaction.edit_origin(embed=other)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question