Net::A...::State(3pm)
π Net::Async::Matrix::Room::State π
okay bestie, so this is Net::Async::Matrix::Room::State β a Perl module (that's the 3pm vibe, it lives in the User Contributed Perl Documentation) and it's literally the keeper of all the state events in a Matrix room π¦
β¨ NAME β¨
Net::Async::Matrix::Room::State β no cap, it represents the state events in a matrix room π
πΈ DESCRIPTION πΈ
So here's the tea β β instances of this class are holding down all of the known state events in a Net::Async::Matrix::Room at some instant in time. Like, a lil snapshot of the room's whole situation.
And here's the important part: these objects are mutable π₯ So if you grabbed a "live" state object from a room, it's not gonna just sit there being stale β it will change to keep track of newly received state events. It's giving main character energy, always updating, always aware π
π METHODS π
get_event
$event = $state->get_event( $type, $state_key )
Returns a HASH reference containing the raw event stored for the given type name and optional state_key. That's it, that's the whole vibe β¨
get_events
$events = $state->get_events( $type )
Returns a multi-level HASH reference mapping all of the known state keys for a given event type name to their raw stored events π«Ά
Typically this is useful for m.room.member events, because the state keys will be user IDs. iykyk π
π CONVENIENCE ACCESSORS π
okay so these next ones all fetch single values out of certain events, because that's just. so commonly used. they're here to make your life easier, periodt π
name
$name = $state->name
Returns the name field of the m.room.name event, if it exists. π
join_rule
$join_rule = $state->join_rule
Returns the join_rule field of the m.room.join_rules event, if it exists. πͺ
topic
$topic = $state->topic
Returns the topic field of the m.room.topic event, if it exists. π¬
aliases
@aliases = $state->aliases
Returns a list of the room alias from all the m.room.aliases events, in no particular order. so like, don't come for me about the ordering, it's just vibes π¦
members
@members = $state->members
Returns a list of Member instances representing all of the members of the room from the m.room.member events whose membership state is not leave. everyone still in the group chat, basically π
all_members
@members = $state->members
Similar to members but even includes members in leave state. π
Not gonna lie bestie β this is not normally what you want. It's the "everyone who was ever here" list. Use with intention. π
member
$member = $state->member( $user_id )
Returns a Member instance representing a room member of the given user_id, or undef if none exists. π
member_level
$level = $state->member_level( $user_id )
Returns a number indicating the power level that the given user_id would have according to room state, taken from the m.room.power_levels event. β¨
This takes into account the users_default field, if no specific level exists for the given user_id. so it's not just gonna ghost you with a nothing answer π
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β an icon, honestly π«Ά
aaaand that's the whole page, bestie!! this was perl v5.36.0, dated 2022-12-10, and it's filed under Net::A...::State(3pm) in the User Contributed Perl Documentation. go forth and slay your Matrix state π
β¨πΈ
π¦ where this page comes from
- debian bookworm: libnet-async-matrix-perl 0.19-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-async-matrix-perl 0.19-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-async-matrix-perl 0.19-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-async-matrix-perl 0.19-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-async-matrix-perl 0.19-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms