refactor: improve code formatting and readability in group duty pin command and tests
- Enhanced the `pin_duty_cmd` function by improving code formatting for better readability, ensuring consistent style across the codebase. - Updated unit tests for `pin_duty_cmd` to follow the same formatting improvements, enhancing clarity and maintainability. - No functional changes were made; the focus was solely on code style and organization.
This commit is contained in:
@@ -266,14 +266,18 @@ async def pin_duty_cmd(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
|
||||
)
|
||||
pinned = True
|
||||
except (BadRequest, Forbidden) as e:
|
||||
logger.warning("Failed to pin message for pin_duty chat_id=%s: %s", chat_id, e)
|
||||
logger.warning(
|
||||
"Failed to pin message for pin_duty chat_id=%s: %s", chat_id, e
|
||||
)
|
||||
await loop.run_in_executor(None, _sync_save_pin, chat_id, msg.message_id)
|
||||
next_end = await loop.run_in_executor(None, _get_next_shift_end_sync)
|
||||
await _schedule_next_update(context.application, chat_id, next_end)
|
||||
if pinned:
|
||||
await update.message.reply_text(t(lang, "pin_duty.pinned"))
|
||||
else:
|
||||
await update.message.reply_text(t(lang, "pin_duty.could_not_pin_make_admin"))
|
||||
await update.message.reply_text(
|
||||
t(lang, "pin_duty.could_not_pin_make_admin")
|
||||
)
|
||||
return
|
||||
try:
|
||||
await context.bot.pin_chat_message(
|
||||
|
||||
Reference in New Issue
Block a user