10.1.7. Class cerebro.aclasses.Message

class cerebro.aclasses.Message(message_id)[source]

Bases: cerebro.aclasses.AbstractMessage

Message class.

Methods

message = cerebro.core.current_message()
message = cerebro.core.message(message_id)
add_hashtags(hashtags)[source]
Parameters:hashtags (string, set(string, ) or list(string, )) – hashtag or array of hashtags (every hashtag should be written in one word without spaces).

Adds hashtags to the message.

See also

remove_hashtags().

attachments()[source]
Returns:a list of attachments to the message.
Return type:list(cerebro.aclasses.Attachment,)
creator_id()[source]
Returns:message author’s ID.
Return type:int
data()[source]
Returns:data tuple on the message.
Return type:tuple

Actually, the most part of the methods of this class are interfaces to this tuple. Therefore, you can use its data directly from the tuple.

message.creator_id() == message.data()[message.DATA_CREATOR_ID]
message.is_client_visible() == cerebro.core.has_flag(message.data()[message.DATA_FLAGS], message.FLAG_CLIENT_VISIBLE)
# etc.                  
id()[source]
Returns:message ID.
Return type:int
moderator_id()[source]
Returns:message moderator’s ID.
Return type:int
modification_time()[source]
Returns:time when the message was changed.
Return type:datetime
remove_hashtags(hashtags)[source]
Parameters:hashtags (string, set(string, ) or list(string, )) – hashtag or array of hashtags (every hashtag should be written in one word without spaces).

Remove hashtags from the message.

See also

add_hashtags().