Class: Discordrb::Events::PollVoteEvent
- Defined in:
- lib/discordrb/events/polls.rb
Overview
Generic superclass for poll events.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#answer_id ⇒ Integer
readonly
The ID of the answer associated with the event.
-
#channel_id ⇒ Integer
readonly
The ID of the channel associated with the event.
-
#message_id ⇒ Integer
readonly
The ID of the message associated with the event.
-
#server_id ⇒ Integer?
readonly
The ID of the server associated with the event.
-
#user_id ⇒ Integer
readonly
The ID of the user associated with the event.
Attributes inherited from Event
Instance Method Summary collapse
-
#answer ⇒ Poll::Answer
Get the poll answer associated with the event.
-
#channel ⇒ Channel
Get the channel that the poll originates from.
-
#message ⇒ Message
Get the message that the poll originates from.
-
#poll ⇒ Poll
Get the poll associated with the event.
-
#server ⇒ Server?
Get the server that the poll originates from.
-
#user ⇒ User, Member
(also: #member)
Get the user who added or removed their poll vote.
Instance Attribute Details
#answer_id ⇒ Integer (readonly)
Returns the ID of the answer associated with the event.
17 18 19 |
# File 'lib/discordrb/events/polls.rb', line 17 def answer_id @answer_id end |
#channel_id ⇒ Integer (readonly)
Returns the ID of the channel associated with the event.
20 21 22 |
# File 'lib/discordrb/events/polls.rb', line 20 def channel_id @channel_id end |
#message_id ⇒ Integer (readonly)
Returns the ID of the message associated with the event.
23 24 25 |
# File 'lib/discordrb/events/polls.rb', line 23 def @message_id end |
#server_id ⇒ Integer? (readonly)
Returns the ID of the server associated with the event.
14 15 16 |
# File 'lib/discordrb/events/polls.rb', line 14 def server_id @server_id end |
#user_id ⇒ Integer (readonly)
Returns the ID of the user associated with the event.
10 11 12 |
# File 'lib/discordrb/events/polls.rb', line 10 def user_id @user_id end |
Instance Method Details
#answer ⇒ Poll::Answer
Get the poll answer associated with the event.
43 44 45 |
# File 'lib/discordrb/events/polls.rb', line 43 def answer poll&.answer(@answer_id) end |
#channel ⇒ Channel
Get the channel that the poll originates from.
49 50 51 |
# File 'lib/discordrb/events/polls.rb', line 49 def channel @bot.channel(@channel_id) end |
#message ⇒ Message
Get the message that the poll originates from.
61 62 63 |
# File 'lib/discordrb/events/polls.rb', line 61 def @message ||= channel.(@message_id) end |
#poll ⇒ Poll
Get the poll associated with the event.
37 38 39 |
# File 'lib/discordrb/events/polls.rb', line 37 def poll &.poll end |
#server ⇒ Server?
Get the server that the poll originates from.
55 56 57 |
# File 'lib/discordrb/events/polls.rb', line 55 def server @bot.server(@server_id) if @server_id end |