MessageIterator

An asynchronous message iterator over the given text channel.

Attributes

channel : Channel

The channel, what's messages the message iterator will iterates over.

chunk_size : int

The amount of messages, what the message iterator will extend it's channel's message history, each time, the loaded messages are exhausted.

client : Client

The client, who will do the api requests for requesting more messages.

_can_read_history : bool

Tells the message iterator, whether it's client can read the history if it's channel.

_index : int

The index of the message, what will be yielded.

Methods

__new__(client, channel, ...)

Creates a message iterator.

This method is a coroutine.

ParameterTypeOptionalDescription
client

Client

The client, who will do the api requests for requesting more messages.

channel

Channel, int

The channel, what's messages the message iterator will iterates over.

chunk_size

int

The amount of messages, what the message iterator will extend it's channel's message history, each time, the loaded messages are exhausted. Limited to 97 as a maximal value.

Raises

TypeError

If channel was not given neither as Channel nor int.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

AssertionError

  • If chunk_size was not given as int.
  • If chunk_size is out of range [1:].

__aiter__()

Returns self and resets the .index.

__anext__()

Yields the next message of the iterator's channel.

This method is a coroutine.

__repr__()

Returns the representation of the message iterator.