Futurismclass › botCommand

From Botdom Documentation

Jump to: navigation, search

The botCommand class holds various needed properties to an inputted bot command.

Properties

  • dict args or arguments — A dictionary of all command arguments, index 0 being the command name.
  • str argsF or argumentsF — All command arguments in a string, seperated by space.
  • instance conn — A link back to the connection this command came from (usually dAmn).
  • str name — The name of the command.
  • str ns — The ns in which the command was sent.
  • str raw — The raw text command.
  • str targetns — The ns this command is intended to be directed at (if first command argument is an ns). If there is no specific intented targetns, this will be the same as ns.
  • str user — The user who sent the command.

Initialization

__init__(instance connection, str raw, str ns, str user)

Fills in the properties found above, from the raw command found in raw, in the ns found in ns, by the user found in user in the dAmn object instance found in connection. All properties are then free to be refered to.

cmd = botCommand(dAmn, "!say I will not buy this record, it is scratched.", "chat:elec", "electricnet")
# cmd.args is: ['say', 'I', 'will', 'not', 'buy', 'this', 'record,', 'it', 'is', 'scratched.']
# cmd.argsF is: I will not buy this record, it is scratched.
# cmd.arguments is: ['say', 'I', 'will', 'not', 'buy', 'this', 'record,', 'it', 'is', 'scratched.']
# cmd.argumentsF is: I will not buy this record, it is scratched.
# cmd.conn is: <__main__.dAmnConnection instance at 0x798a0>
# cmd.name is: say
# cmd.ns is: chat:elec
# cmd.raw is: say I will not buy this record, it is scratched.
# cmd.targetns is: chat:elec
# cmd.user is: electricnet
Personal tools