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):
|
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
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ class RPCManager(object):
|
|||||||
|
|
||||||
def cleanup(self) -> None:
|
def cleanup(self) -> None:
|
||||||
""" Stops all enabled rpc modules """
|
""" Stops all enabled rpc modules """
|
||||||
|
logger.info('Cleaning up rpc modules ...')
|
||||||
for mod in self.registered_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()
|
mod.cleanup()
|
||||||
|
|
||||||
self.registered_modules = []
|
self.registered_modules = []
|
||||||
|
@ -26,9 +26,7 @@ def authorized_only(command_handler: Callable[[Any, Bot, Update], None]) -> Call
|
|||||||
:return: decorated function
|
:return: decorated function
|
||||||
"""
|
"""
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
"""
|
""" Decorator logic """
|
||||||
Decorator logic
|
|
||||||
"""
|
|
||||||
update = kwargs.get('update') or args[1]
|
update = kwargs.get('update') or args[1]
|
||||||
|
|
||||||
# Reject unauthorized messages
|
# Reject unauthorized messages
|
||||||
@ -55,9 +53,7 @@ def authorized_only(command_handler: Callable[[Any, Bot, Update], None]) -> Call
|
|||||||
|
|
||||||
|
|
||||||
class Telegram(RPC):
|
class Telegram(RPC):
|
||||||
"""
|
""" This class handles all telegram communication """
|
||||||
Telegram, this class send messages to Telegram
|
|
||||||
"""
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
@ -241,9 +237,7 @@ class Telegram(RPC):
|
|||||||
|
|
||||||
@authorized_only
|
@authorized_only
|
||||||
def _balance(self, bot: Bot, update: Update) -> None:
|
def _balance(self, bot: Bot, update: Update) -> None:
|
||||||
"""
|
""" Handler for /balance """
|
||||||
Handler for /balance
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
currencys, total, symbol, value = \
|
currencys, total, symbol, value = \
|
||||||
self._rpc_balance(self._config['fiat_display_currency'])
|
self._rpc_balance(self._config['fiat_display_currency'])
|
||||||
|
Loading…
Reference in New Issue
Block a user