class Discorb::Command::Command
Represents a application command. @abstract
Attributes
types[R]
@!visibility private
block[R]
@return [Proc] The block of the command.
guild_ids[R]
@return [Array<#to_s>] The guild ids that the command is enabled in.
id_map[R]
@return [Discorb::Dictionary{Discorb::Snowflake, :global => Discorb::Snowflake}] The ID mapping.
name[R]
@return [String] The name of the command.
type[R]
@return [:chat_input, :user, :message] The type of the command.
type_raw[R]
@return [Integer] The raw type of the command.
Public Class Methods
new(name, guild_ids, block, type)
click to toggle source
@!visibility private
# File lib/discorb/command.rb, line 147 def initialize(name, guild_ids, block, type) @name = name @guild_ids = guild_ids.map(&:to_s) @block = block @raw_type = type @type = Discorb::Command::Command.types[type] @type_raw = type @id_map = Discorb::Dictionary.new end
Public Instance Methods
to_hash()
click to toggle source
@!visibility private
# File lib/discorb/command.rb, line 158 def to_hash { name: @name, default_permission: @default_permission, type: @type_raw, } end