Class: Discordrb::SearchedMessages

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/discordrb/data/server.rb

Overview

A set of messages collected from a search query.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messagesArray<Message> (readonly)

Returns the messages that matched the search query.

Returns:

  • (Array<Message>)

    the messages that matched the search query.



1584
1585
1586
# File 'lib/discordrb/data/server.rb', line 1584

def messages
  @messages
end

#total_resultsInteger (readonly)

Returns the total number of messages that matched the search query.

Returns:

  • (Integer)

    the total number of messages that matched the search query.



1587
1588
1589
# File 'lib/discordrb/data/server.rb', line 1587

def total_results
  @total_results
end

Instance Method Details

#[](index) ⇒ Message

Get a single message that matched the search query by its index.

Parameters:

  • index (Integer)

    The index of the message to get from the array.

Returns:

  • (Message)

    the message that was found at the specified index.



1599
1600
1601
# File 'lib/discordrb/data/server.rb', line 1599

def [](index)
  @messages[index]
end

#eachArray<Message>, Enumerable

Iterate over each message that matched the search query.

Returns:

  • (Array<Message>, Enumerable)

    The array that was iterated over.



1605
1606
1607
# File 'lib/discordrb/data/server.rb', line 1605

def each(...)
  @messages.each(...)
end