Sending a normal message after a slash command is run

Question:

Im trying to make my discord.py bot send a normal message after a user runs a certain slash command. Ive tried looking for others with this issue, but none of them are using nextcord. Im using nextcord, in a cog. Any help is appreciated.

I tried things like interaction.send, interaction.send_message, self.bot.send_message, and others like that. All of them resulted in errors like "Interaction has no type "send_message".

Asked By: Pure.

||

Answers:

Quick disclaimer: I am using discord.py, but this should work for nextcord too.

If you have an Interaction, you can get the channel from it and then use send to send a message in there.

await interaction.channel.send("whatever")

Or, you could also use followup to send messages with a Webhook:

await interaction.followup.send("whatever")

Docs: https://docs.nextcord.dev/en/stable/api.html?highlight=interaction#nextcord.Interaction

Hope this helps.

Answered By: moinierer3000
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.