question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement Slash commands

See original GitHub issue

Summary

Implement slash commands as per Discord docs.

Details

  • Implement registering a command
  • Implement updating and deleting a command
    • A Cache for used commands? Code migrations? From what it seems, old commands would need to be manually removed from Discord, so if slash commands are used similarly to CommandsNext the library should handle when a change in code is made.
    • Updating a command can be done with the same POST request that a create uses, as Discord treats it as an upsert.
  • Receive information from the Gateway
  • Respond to Interactions (slash commands)
    • This needs to be over HTTP, it is not a command over the gateway (see here)
    • Handle followup messages and/or editing the original response.
  • Further endpoints would need to be added.

I haven’t worked much on editing DSharpPlus, so correct me if I am wrong, but from Discord’s Docs it seems a lot is different to handle slash commands than it is for regular bot commands. Would this be best as a new project, something like DSharpPlus.SlashCommands?

Edit 2020-12-17

Example Interaction from Discord when an interaction command is run: This command takes no additional attributes and is not a subcommand.

{
   "channel_id":"750486424901386330",
   "data":{
      "id":"789290437416189955",
      "name":"hello"
   },
   "guild_id":"750486424469372970",
   "id":"789298197872377876",
   "member":{
      "deaf":false,
      "is_pending":false,
      "joined_at":"2020-09-01T22:45:07.036000+00:00",
      "mute":false,
      "nick":null,
      "pending":false,
      "permissions":"2147483647",
      "premium_since":null,
      "roles":[
         
      ],
      "user":{
         "avatar":"27690e2da064e8bdb9c0cef91b2d3a46",
         "discriminator":"8016",
         "id":"133735496479145984",
         "public_flags":131200,
         "username":"Soyvolon"
      }
   },
   "token":"aW50ZXJhY3Rpb246Nzg5Mjk4MTk3ODcyMzc3ODc2OjdEWVNvQkI1OXExb21vYjRXRUc2SERtdjc0Nk1aZzBxa2d0dm9tTnpXb1ptUnZ4a2s0a20xVkhzVjdZUW13N1kyR2xBVzlYRmwzcDZ4MWc4eW81QmY2bm55ZTJOUmZIb1djSUw3MzFrZklZOE8wdjJwVzNreDNvS2RqTTlZSW9U",
   "type":2,
   "version":1
}

Edit 2020-12-24

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

5reactions
Lulalabycommented, Apr 7, 2021

Just wanted to say. great work so far @Soyvolon

3reactions
Neuheitcommented, Dec 16, 2020

This would be a major change for the lib so it will be on hold for the time being.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating slash commands
Slash commands provide a huge number of benefits over manual message parsing, including: Integration with the Discord client interface.
Read more >
Enabling interactivity with Slash Commands
Slash Commands allow users to invoke your app by typing a string into the message composer box. By enabling Slash Commands, your app...
Read more >
Slash Commands - Pycord Guide
Learn all about Slash Commands and how to implement them into your Discord Bot with Pycord!
Read more >
Set up slash commands to interact with Google Chat users
A slash command is a common way that users invoke and interact with a Chat app. Slash commands also help users discover and...
Read more >
Introduction to slash commands
Slash commands are made up of a name, description, and a block of options, which you can think of like arguments to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found