chore: simplify profit-callback logic

This commit is contained in:
Matthias
2025-07-17 21:02:46 +02:00
parent 978f9c804b
commit d710c85cda
+4 -9
View File
@@ -1109,7 +1109,6 @@ class Telegram(RPCHandler):
update: Update, update: Update,
context: CallbackContext, context: CallbackContext,
direction: str | None = None, direction: str | None = None,
callback_path: str = "update_profit",
) -> None: ) -> None:
""" """
Common handler for profit commands. Common handler for profit commands.
@@ -1154,7 +1153,7 @@ class Telegram(RPCHandler):
await self._send_msg( await self._send_msg(
markdown_msg, markdown_msg,
reload_able=True, reload_able=True,
callback_path=callback_path, callback_path="update_profit" if not direction else f"update_profit_{direction}",
query=update.callback_query, query=update.callback_query,
) )
@@ -1167,7 +1166,7 @@ class Telegram(RPCHandler):
:param update: message update :param update: message update
:return: None :return: None
""" """
await self._profit_handler(update, context, callback_path="update_profit") await self._profit_handler(update, context)
@authorized_only @authorized_only
async def _profit_long(self, update: Update, context: CallbackContext) -> None: async def _profit_long(self, update: Update, context: CallbackContext) -> None:
@@ -1175,9 +1174,7 @@ class Telegram(RPCHandler):
Handler for /profit_long. Handler for /profit_long.
Returns cumulative profit statistics for long trades. Returns cumulative profit statistics for long trades.
""" """
await self._profit_handler( await self._profit_handler(update, context, direction="long")
update, context, direction="long", callback_path="update_profit_long"
)
@authorized_only @authorized_only
async def _profit_short(self, update: Update, context: CallbackContext) -> None: async def _profit_short(self, update: Update, context: CallbackContext) -> None:
@@ -1185,9 +1182,7 @@ class Telegram(RPCHandler):
Handler for /profit_short. Handler for /profit_short.
Returns cumulative profit statistics for short trades. Returns cumulative profit statistics for short trades.
""" """
await self._profit_handler( await self._profit_handler(update, context, direction="short")
update, context, direction="short", callback_path="update_profit_short"
)
@authorized_only @authorized_only
async def _stats(self, update: Update, context: CallbackContext) -> None: async def _stats(self, update: Update, context: CallbackContext) -> None: