inputfuncs.py
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Input functions
Input functions are always called from the client (they handle server
input, hence the name).
This module is loaded by being included in the
`settings.INPUT_FUNC_MODULES` tuple.
All *global functions* included in this module are considered
input-handler functions and can be called by the client to handle
input.
An input function must have the following call signature:
cmdname(session, *args, **kwargs)
Where session will be the active session and *args, **kwargs are extra
incoming arguments and keyword properties.
A special command is the "default" command, which is will be called
when no other cmdname matches. It also receives the non-found cmdname
as argument.
default(session, cmdname, *args, **kwargs)
"""
# def oob_echo(session, *args, **kwargs):
# """
# Example echo function. Echoes args, kwargs sent to it.
#
# Args:
# session (Session): The Session to receive the echo.
# args (list of str): Echo text.
# kwargs (dict of str, optional): Keyed echo text
#
# """
# session.msg(oob=("echo", args, kwargs))
#
#
# def default(session, cmdname, *args, **kwargs):
# """
# Handles commands without a matching inputhandler func.
#
# Args:
# session (Session): The active Session.
# cmdname (str): The (unmatched) command name
# args, kwargs (any): Arguments to function.
#
# """
# pass