Futurism › class › dAmnPacketO
From Botdom Documentation
The dAmnPacketO class (short for dAmn Packet Outgoing) is used to construct a raw dAmn packet string from the inputted variables.
Contents |
Properties
- dict args — A dictionary of the packet arguments.
- str body — The main body of the packet.
- str cmd — The packet command name.
- str param — The packet's main parameter.
Initialization
__init__(str cmd, str param, str args, str body)
The class accepts the four arguments mentioned above in its initialization method, and it stores them as object properties inside the object instance.
ns = dAmn.unformatns("#Botdom") pkt = dAmnPacketO("join", ns) # pkt.cmd is: join # pkt.param is: chat:Botdom
String
When the packet is displayed as a string (either in concatenation with a string or converted to one), it generates the raw packet str from the values found in the instance's four properties, and returns it.
s = str(pkt) # s is: join chat:Botdom\n s = "this %s is scratched." % pkt # s is: this join chat:Botdom\n is scratched.

