adjust logging a bit and add some comments
This commit is contained in:
parent
6c1bb7983b
commit
83eb7a0a9d
@ -21,6 +21,12 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RPCException(Exception):
|
||||
"""
|
||||
Should be raised with a rpc-formatted message in an _rpc_* method
|
||||
if the required state is wrong, i.e.:
|
||||
|
||||
raise RPCException('*Status:* `no active trade`')
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
@ -25,8 +25,9 @@ class RPCManager(object):
|
||||
|
||||
def cleanup(self) -> None:
|
||||
""" Stops all enabled rpc modules """
|
||||
logger.info('Cleaning up rpc modules ...')
|
||||
for mod in self.registered_modules:
|
||||
logger.info('Cleaning up rpc.%s ...', mod.name)
|
||||
logger.debug('Cleaning up rpc.%s ...', mod.name)
|
||||
mod.cleanup()
|
||||
|
||||
self.registered_modules = []
|
||||
|
@ -26,9 +26,7 @@ def authorized_only(command_handler: Callable[[Any, Bot, Update], None]) -> Call
|
||||
:return: decorated function
|
||||
"""
|
||||
def wrapper(self, *args, **kwargs):
|
||||
"""
|
||||
Decorator logic
|
||||
"""
|
||||
""" Decorator logic """
|
||||
update = kwargs.get('update') or args[1]
|
||||
|
||||
# Reject unauthorized messages
|
||||
@ -55,9 +53,7 @@ def authorized_only(command_handler: Callable[[Any, Bot, Update], None]) -> Call
|
||||
|
||||
|
||||
class Telegram(RPC):
|
||||
"""
|
||||
Telegram, this class send messages to Telegram
|
||||
"""
|
||||
""" This class handles all telegram communication """
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
@ -241,9 +237,7 @@ class Telegram(RPC):
|
||||
|
||||
@authorized_only
|
||||
def _balance(self, bot: Bot, update: Update) -> None:
|
||||
"""
|
||||
Handler for /balance
|
||||
"""
|
||||
""" Handler for /balance """
|
||||
try:
|
||||
currencys, total, symbol, value = \
|
||||
self._rpc_balance(self._config['fiat_display_currency'])
|
||||
|
Loading…
Reference in New Issue
Block a user