class Discordrb::Components::Button
An interactable button component.
Attributes
custom_id[R]
@return [String]
disabled[R]
@return [true, false]
emoji[R]
@return [Emoji, nil]
label[R]
@return [String]
style[R]
@return [Integer]
url[R]
@return [String, nil]
Public Class Methods
new(data, bot)
click to toggle source
@!visibility private
# File lib/discordrb/data/component.rb, line 81 def initialize(data, bot) @bot = bot @label = data['label'] @style = data['style'] @custom_id = data['custom_id'] @disabled = data['disabled'] @url = data['url'] @emoji = Emoji.new(data['emoji'], @bot) if data['emoji'] end
Public Instance Methods
await_click(key, **attributes, &block)
click to toggle source
Await
a button click
# File lib/discordrb/data/component.rb, line 109 def await_click(key, **attributes, &block) @bot.add_await(key, Discordrb::Events::ButtonEvent, { custom_id: @custom_id }.merge(attributes), &block) end
await_click!(**attributes, &block)
click to toggle source
Await
a button click, blocking.
# File lib/discordrb/data/component.rb, line 114 def await_click!(**attributes, &block) @bot.add_await!(Discordrb::Events::ButtonEvent, { custom_id: @custom_id }.merge(attributes), &block) end