Futurism › class › dAmnNs
From Botdom Documentation
The dAmnNs class is used in the bot's handling of namespaces, and provides both needed properties but also methods that manipulates these. The dAmnNs class is the general class which holds only features that all types of namespaces on dAmn can handle. In practice, you should use the dAmnChatroom and dAmnPchat classes, which both inherits from this one.
Contents |
Properties
- instance conn — A link back to the connection this command came from (usually dAmn).
- str fns — The formatted namespace.
- bool joined — Whether we've successfully joined this ns. When we recieve a property packet, this is set to True. Otherwise False.
- int jointime — A unix-style timestamp of when we joined this ns.
- dict members — A dictionary of all members in the ns, with their usernames as key and dAmnNsMember object instances as value.
- str ns — The raw namespace.
- dict properties — A dictionary of all properties in the ns, with property type as key and dAmnProperty object instances as value.
- str title — The title of the ns. None if it isn't yet loaded.
- str topic — The topic of the ns. None if it isn't yet loaded.
Initialization
__init__(instance connection, str rawNs)
Creates the dAmnNs object instance from the inputted parameters: connection as a reference to the dAmn connection instance, and rawNs as the raw unformatted ns string.
Methods
void memberJoined(str username, dict props)
Called when a member with the username found in username has joined the ns. Checks if the member was already joined, and increases their join count (found in a property in the dAmnNsMember class) if so, or adds them to the members dict if they were not.
void memberKicked(str username)
Called when a member with the username found in username has been kicked from the ns, and the member is thus removed from the members dict.
void memberParted(str username)
Called when a member with the username found in username has parted the ns, and decreases their join count. If their join count is now zero, they are removed from the members dict.
void setProperty(instance property)
Called when we receive a property for this ns, found in property which is expected to be a dAmnProperty object instance. Depending on what type of property it is, it does different things. If it's a topic or title, it assigns the topic or title property (respectively) with the property, and if it's a members property, it loads it into the members dict and creates dAmnNsMember object instances for all members.
See also
- dAmnChatroom (adds privclasses)
- dAmnPchat

