Class: LibDiscord::Poll

Inherits:
Resource show all
Defined in:
lib/lib_discord/poll.rb

Overview

Poll Resource

Do not instantiate a Poll directly. Instead request one from an instance of Client.

client = LibDiscord::Client.new("Bot auth.token")
p = client["poll"]

To create a poll, use Channel#create_message.

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from LibDiscord::Resource

Instance Method Details

#end_poll(channel_id:, message_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



58
59
60
# File 'lib/lib_discord/poll.rb', line 58

def end_poll(channel_id:, message_id:)
  send_request(:post, "/channels/#{channel_id}/polls/#{message_id}/expire")
end

#get_answer_voters(channel_id:, message_id:, answer_id:, params: {}) ⇒ Response

Parameters:

Returns:

Raises:

  • (TimeoutError)

    if the HTTP request times out

  • (ConstraintError)

    if params cannot be coerced into a valid query parameters string

See Also:



40
41
42
# File 'lib/lib_discord/poll.rb', line 40

def get_answer_voters(channel_id:, message_id:, answer_id:, params: {})
  send_request(:get, "/channels/#{channel_id}/polls/#{message_id}/answers/#{answer_id}", params:)
end