fix(logging): correct string formatting for lock/unlock messages

Corrected the string formatting in the logging and messaging code for user lock/unlock operations. Fixed the use of incorrect quotation marks which led to syntax errors and inconsistent message formats.

This ensures that log messages and notifications are properly formatted, enhancing readability and reducing potential debugging confusion.
This commit is contained in:
Kumi 2024-09-01 09:32:43 +02:00
parent edbb33bc46
commit 5c1d165774
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -250,14 +250,14 @@ class RoombaBot:
async with aiohttp.ClientSession() as session:
async with session.put(url, headers=headers, json=payload) as resp:
if resp.status == 200:
self.logger.debug(f"User {user_id} {"locked" if locked else "unlocked"} successfully")
self.logger.debug(f"User {user_id} {'locked' if locked else 'unlocked'} successfully")
await self.send_message(
self.moderation_room_id, f"User {user_id} {"locked" if locked else "unlocked"} successfully."
self.moderation_room_id, f"User {user_id} {'locked' if locked else 'unlocked'} successfully."
)
else:
self.logger.error(f"Failed to {"lock" if locked else "unlock"} user {user_id}: {resp.status}")
self.logger.error(f"Failed to {'lock' if locked else 'unlock'} user {user_id}: {resp.status}")
await self.send_message(
self.moderation_room_id, f"Failed to {"lock" if locked else "unlock"} user {user_id}."
self.moderation_room_id, f"Failed to {'lock' if locked else 'unlock'} user {user_id}."
)
async def send_message(self, room_id, message):