Terra › class › Channel
From Botdom Documentation
The dAmn Channel class is a custom class made when developing Terra and stored in dAmn.py. Instances of the class are used to represent channel data for channels which the bot has joined. The class contains several properties and a few methods which work towards representing the channel in the code. Instances of this object are stored in the dAmn.resource class under the dict "channel". The dict is indexed by channel namespaces.
Contents |
Properties
Instances of this class contain the following properties.
- dict title - This dict stores information about the channel's title.
- dict topic - This dict stores information about the channel's topic.
- dict pc - This dicts stores the channel privilege classes.
- list pc_order - This list maintains the order of the privilege classes.
- dict member - This dict stores the members currently in the channel.
- str namespace - This stores the properly formatted channel namespace for the channel.
- str shorthand - This stores the properly formatted shorthand for the channel's namespace.
Methods
These methods probably shouldn't be used by you, ever.
void __init__(str namespace, str shorthand)
This is called when a new instance is created. All the object properties are initiated. namespace and shorthand are stored in their respectively named properties.
void process_property(obj data)
Input parameter data should be an instance of dAmn.Packet. The processed packet should be a property packet. This method processes the data and stores it properly.
void register_user(obj user_info[, str user=None])
This method should be used when a user joins a channel. Input parameter user_info should be an instance of dAmn.Packet. The processed packet should be the userinfo for a user as provided in packet recv join or property members. If user is None, the method will retrieve the username from the user_info object if available.
str type(void)
Just for personal preference. Returns a string in the format '<dAmn channel "Channel.namespace">'.
str __repr__(void)
This method is called when repr() is used on an instance of the object. It returns a string which can be used to recreate the object.
str __str__(void)
This method is called when the object needs to be read as a string. The method returns the namespace for the channel.

