I’ve created a test slash (application) command for my discord bot, and whenever the slash command is run, it says this: https://imgur.com/a/JP4duRi
There’s more code to it that I’d not like to share, but here’s some snippits from the parts that have to do with this problem
# imports and other important stuff
import discord
from discord import app_commands
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
intents.presences = True
intents.integrations = True
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
# command function
@tree.command(name="sigma", description="ermmmmm")
async def sigma(interaction: discord.Interaction):
await interaction.response.send_message("erm, what the sigma")
# when the bot starts
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
try:
synced = await tree.sync()
print(f"Synced {len(synced)} commands")
except Exception as e:
print(e)
# stuff to connect to discord
try:
client.run(token)
except discord.HTTPException as e:
if e.status == 429:
print(
"The Discord servers denied the connection for making too many requests"
)
else:
raise e
I’ve ran the code, no errors, as you can see i added print(f"Synced {len(synced)} commands")
to prove the command properly went through, and starting the bot said it synced 1 command, as i said with no errors. Going into discord, i ran the command /sigma and it gave me this: https://imgur.com/a/JP4duRi (the text also changes to “The application did not respond” if you click into another channel and go back, odd)
again, no errors before and after running the command! i waited a little bit for the commands to register into discord’s system, if that’s something you have to do, I tried the command right after i started my server and 3-4 hours after, same thing every time. It was working but now for some reason it’s not working. There’s no code in my script that would interfere with this or anything. Very frustrating!
I’ve Googled this problem at least 10-20 times, to no avail. I have given the bot all the permissions it needs, tried it in public/private channels, no luck. You can see that it’s a very simple script and it should not be having these issues…
Chez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.