Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
v2.4.1.2 hotfix
  • Loading branch information
brucewzj99 committed May 12, 2024
commit 8480d6f249708933cf768622b4d33a72d43c9ce1
9 changes: 9 additions & 0 deletions bot/database_service/firestore_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ def get_all_user_id(self):
return user_ids
except Exception as e:
raise DatabaseError(message="Error getting all user ids", extra_info=str(e))

# Get user count
def get_user_count(self):
try:
users_ref = self.db.collection(self.collection_name)
user_count = len([user.id for user in users_ref.stream()])
return user_count
except Exception as e:
raise DatabaseError(message="Error getting user count", extra_info=str(e))
1 change: 1 addition & 0 deletions bot/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def __init__(self, error_class, message="An error occurred", extra_info=""):
self.message = message
self.extra_info = extra_info
self.error_class = error_class
logging.error(f"{error_class}: {message} {extra_info}")
super().__init__(f"{self.error_class}: {self.message}")

class GoogleSheetError(BaseError):
Expand Down
6 changes: 3 additions & 3 deletions bot/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ def send_new_feature_message(context, new_feature_message):
parse_mode=ParseMode.HTML,
)
no_of_users += 1
except Exception:
except Exception as e:
try:
chat = context.bot.get_chat(chat_id=user_id)
username = chat.username if chat.username else "?"
Expand All @@ -1062,10 +1062,10 @@ def notify_all(update, context):
if not new_feature_message:
update.message.reply_text("Please provide a message to send.")
return

no_of_users = db.get_user_count()
keyboard = [
[
InlineKeyboardButton("Confirm Send", callback_data="confirm_send"),
InlineKeyboardButton(f"Send to {no_of_users} users", callback_data="confirm_send"),
InlineKeyboardButton("Cancel", callback_data="cancel_send"),
]
]
Expand Down
14 changes: 13 additions & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Release Notes
## Version 2.4.1.2 - Date 12 May 2024
### Bug Fix 🛠️
- Error handling for `/notifyall` command
- Add users count for `/notifyall` command

### For Developer 🧑‍💻
- Logging of error info message

## Version 2.4.1 - Date 12 May 2024
### Enhancement 🔥
- Added google form for reporting bugs, feedbacks and feature requests

## Version 2.4 - Date 6 May 2024
### Enhancement 🔥
- Clearer error messages for users
Expand Down Expand Up @@ -29,7 +41,7 @@
- Added test for database module

## Version 2.3.3 - Date 1 May 2024
### Minor Fix 🛠️
### Bug Fix 🛠️
- Add datetime and username for logging purposes
- Add more message to help command

Expand Down