'Discord Slash Message Command Not Working
I am trying to implement a discord "message slash" command https://discord.com/developers/docs/interactions/application-commands#message-commands
There doesnt seem to be any tutorials showing how to proerpyl use slash command with discord cogs, after a bunch of searching I found this code which does setup a 'CHAT_INPUT' slash command.
intents = discord.Intents.all()
client = discord.Client(intents=discord.Intents.all())
slash = SlashCommand(client, sync_commands=True) # Declares slash commands through the client.
guilds = [id]
@slash.slash(name="pingpong")
async def _ping(ctx):
await ctx.send("Pong!")
client.run("token")
When running the above it does create a slash command, so I can type "/pinppong" but I can not figure out how to make this command appear when I right click on the message. From what I am seeing online need to change the @slash.slash to
@slash.slash(name="pingpong", type=3)
But this causes the error
TypeError: slash() got an unexpected keyword argument 'type'
Im not sure what i'm doing wrong here, how can I get the "right click on message" application to work.
Does anyone have any better working examples on how to implement slash commands with discord cogs?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
