Infinity.ChatBuffer¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
The maxmimum number of messages saved |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted whenever a message has been added to buffer. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Infinity.ChatBuffer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Infinity.ChatBuffer
is an opaque data type. You should only access it via the public API functions.- classmethod new(size)¶
- Parameters:
size (
int
) – The number of messages to store.- Returns:
A new
Infinity.ChatBuffer
.- Return type:
Creates a new
Infinity.ChatBuffer
which contains no initial messages. size specifies how many messages to store before dropping old messages.
- add_emote_message(by, message, time, flags)¶
- Parameters:
by (
Infinity.User
) – AInfinity.User
who wrote the message.message ([
str
]) – The message text.time (
int
) – The time at which the user has written the message.flags (
Infinity.ChatBufferMessageFlags
) – Flags to set for the message to add.
Adds a new emote message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all.
- add_message(by, message, time, flags)¶
- Parameters:
by (
Infinity.User
) – AInfinity.User
who wrote the message.message ([
str
]) – The message text.time (
int
) – The time at which the user has written the message.flags (
Infinity.ChatBufferMessageFlags
) – Flags to set for the message to add.
Adds a new message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all.
- add_userjoin_message(user, time, flags)¶
- Parameters:
user (
Infinity.User
) – AInfinity.User
who wrote the message.time (
int
) – The time at which the user has written the message.flags (
Infinity.ChatBufferMessageFlags
) – Flags to set for the message to add.
Adds a new userjoin message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all.
- add_userpart_message(user, time, flags)¶
- Parameters:
user (
Infinity.User
) – AInfinity.User
who wrote the message.time (
int
) – The time at which the user has written the message.flags (
Infinity.ChatBufferMessageFlags
) – Flags to set for the message to add.
Adds a new userpart message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all.
- get_message(n)¶
- Parameters:
n (
int
) – The index of the message to obtain.- Returns:
The
Infinity.ChatBufferMessage
with the given index.- Return type:
Returns the message with the given index from the buffer. The oldest message in the buffer has index 0, and the most recent one has index
Infinity.ChatBuffer.get_n_messages
() - 1.
- get_n_messages()¶
- Returns:
The number of messages in the buffer.
- Return type:
Returns the number of messages in the buffer.
- get_size()¶
- Returns:
The number of messages in the chat buffer.
- Return type:
Returns the size of the chat buffer, which is the maximum number of messages that can be stored in the buffer.
- do_add_message(message) virtual¶
- Parameters:
message (
Infinity.ChatBufferMessage
) –
Signal Details¶
- Infinity.ChatBuffer.signals.add_message(chat_buffer, message)¶
- Signal Name:
add-message
- Flags:
- Parameters:
chat_buffer (
Infinity.ChatBuffer
) – The object which received the signalmessage (
Infinity.ChatBufferMessage
) – TheInfinity.ChatBufferMessage
that was received.
This signal is emitted whenever a message has been added to buffer.
Property Details¶
- Infinity.ChatBuffer.props.size¶
- Name:
size
- Type:
- Default Value:
256
- Flags:
The maxmimum number of messages saved