royalnet.utils

royalnet.utils.asyncify(function: Callable, *args, **kwargs)
class royalnet.utils.Call(channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, **kwargs)

A command call. Still an abstract class, subbots should create a new call from this.

__init__(channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

alchemy = NotImplemented
get_author(error_if_none=False)

Try to find the universal identifier of the user that sent the message. That probably means, the database row identifying the user. Raise a UnregisteredError if error_if_none is set to True and no author is found.

interface_name = NotImplemented
interface_obj = NotImplemented
interface_prefix = NotImplemented
net_request(message: royalnet.network.messages.Message, destination: str)

Send data to the rest of the Royalnet, and optionally wait for an answer. The data must be pickleable.

reply(text: str)

Send a text message to the channel the call was made.

run()
session_end()
session_init()
class royalnet.utils.Command

A generic command, called from any source.

command_description = NotImplemented
command_name = NotImplemented
command_syntax = NotImplemented
classmethod common(call: Call)
classmethod network_handler_dict()
network_handlers = {}
require_alchemy_tables = {}
royalnet.utils.safeformat(string: str, ignore_escaping: bool = False, **words) → str
royalnet.utils.cdj(class_) → dict

Return the cleaned class attributes in a dict.

royalnet.utils.sleep_until(dt: datetime.datetime)
royalnet.utils.plusformat(i: int) → str
class royalnet.utils.CommandArgs

The arguments of a command. Raises InvalidInputError if the requested argument does not exist.

joined(*, require_at_least=0)
match(pattern: Pattern[AnyStr]) → Sequence[AnyStr]
optional(index: int, default=None) → Optional
class royalnet.utils.NetworkHandler

The NetworkHandler functions are called when a specific Message type is received.

message_type = NotImplemented
royalnet.utils.safefilename(string: str)