added deck.chat modules
This commit is contained in:
+1
-4
@@ -9,16 +9,13 @@ try:
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _echo(msg, state):
|
|
||||||
return msg, state
|
|
||||||
|
|
||||||
class DeckChat:
|
class DeckChat:
|
||||||
def __init__(self, start_state={}, chat_prefix='> ', command_prefix='/', paginate=0):
|
def __init__(self, start_state={}, chat_prefix='> ', command_prefix='/', paginate=0):
|
||||||
"""Init the chat class"""
|
"""Init the chat class"""
|
||||||
self.command_prefix = command_prefix # prefix that commands start with
|
self.command_prefix = command_prefix # prefix that commands start with
|
||||||
self.chat_prefix = chat_prefix # prefix to write before input
|
self.chat_prefix = chat_prefix # prefix to write before input
|
||||||
self.command_handlers = { # command handler storage
|
self.command_handlers = { # command handler storage
|
||||||
'default': _echo # echo handler by default
|
'default': lambda m,s: (m,s) # echo handler by default
|
||||||
}
|
}
|
||||||
self.state = start_state # internal state object (impl-specific)
|
self.state = start_state # internal state object (impl-specific)
|
||||||
self.paginate_n = paginate # paginate the responses exceeding N>0 lines
|
self.paginate_n = paginate # paginate the responses exceeding N>0 lines
|
||||||
|
|||||||
Reference in New Issue
Block a user