app/logical/discord_slash_command.rb
# Called when we receive a command from Discord. Instantiates a
# DiscordSlashCommand and calls the `call` method.
# https://discord.com/developers/docs/interactions/slash-commands#interaction
Called when we receive a command from Discord. Instantiates a
DiscordSlashCommand and calls the `call` method.
Called when we receive a command from Discord . Instantiates a DiscordSlashCommand and calls the ` call ` method .
def receive_webhook(request)
        data = verify_request!(request)
        case data[:type]
        when InteractionType::Ping
          { type: InteractionType::Ping }
        when InteractionType::ApplicationCommand
          name = data.dig(:data, :name)
          klass = COMMANDS.fetch(name&.to_sym)
          klass.new(data: data).call
        else
          raise NotImplementedError, "unknown Discord interaction type #{data[:type]}"
        end
      end
def receive_webhook ( request ) data = verify_request! ( request ) case data [ :type ] when InteractionType :: Ping { type : InteractionType :: Ping } when InteractionType :: ApplicationCommand name = data . dig ( :data , :name ) klass = COMMANDS . fetch ( name &. to_sym ) klass . new ( data : data ) . call else raise NotImplementedError , "unknown Discord interaction type #{data[:type]}" end end
Called when we receive a command from Discord.
Called when we receive a command from Discord .
request