added deck.chat modules

This commit is contained in:
Luxferre
2025-12-20 21:22:06 +02:00
parent 36f7d54f9d
commit 6ee9b6ee7e
+1 -4
View File
@@ -9,16 +9,13 @@ try:
except:
pass
def _echo(msg, state):
return msg, state
class DeckChat:
def __init__(self, start_state={}, chat_prefix='> ', command_prefix='/', paginate=0):
"""Init the chat class"""
self.command_prefix = command_prefix # prefix that commands start with
self.chat_prefix = chat_prefix # prefix to write before input
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.paginate_n = paginate # paginate the responses exceeding N>0 lines