Skip to content

Commit d76795f

Browse files
authored
v2.4.1.2 hotfix (#51)
1 parent 9c91418 commit d76795f

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

bot/database_service/firestore_service.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,12 @@ def get_all_user_id(self):
104104
return user_ids
105105
except Exception as e:
106106
raise DatabaseError(message="Error getting all user ids", extra_info=str(e))
107+
108+
# Get user count
109+
def get_user_count(self):
110+
try:
111+
users_ref = self.db.collection(self.collection_name)
112+
user_count = len([user.id for user in users_ref.stream()])
113+
return user_count
114+
except Exception as e:
115+
raise DatabaseError(message="Error getting user count", extra_info=str(e))

bot/error_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def __init__(self, error_class, message="An error occurred", extra_info=""):
1010
self.message = message
1111
self.extra_info = extra_info
1212
self.error_class = error_class
13+
logging.error(f"{error_class}: {message} {extra_info}")
1314
super().__init__(f"{self.error_class}: {self.message}")
1415

1516
class GoogleSheetError(BaseError):

bot/telegram_bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ def send_new_feature_message(context, new_feature_message):
10371037
parse_mode=ParseMode.HTML,
10381038
)
10391039
no_of_users += 1
1040-
except Exception:
1040+
except Exception as e:
10411041
try:
10421042
chat = context.bot.get_chat(chat_id=user_id)
10431043
username = chat.username if chat.username else "?"
@@ -1062,10 +1062,10 @@ def notify_all(update, context):
10621062
if not new_feature_message:
10631063
update.message.reply_text("Please provide a message to send.")
10641064
return
1065-
1065+
no_of_users = db.get_user_count()
10661066
keyboard = [
10671067
[
1068-
InlineKeyboardButton("Confirm Send", callback_data="confirm_send"),
1068+
InlineKeyboardButton(f"Send to {no_of_users} users", callback_data="confirm_send"),
10691069
InlineKeyboardButton("Cancel", callback_data="cancel_send"),
10701070
]
10711071
]

release_notes.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Release Notes
2+
## Version 2.4.1.2 - Date 12 May 2024
3+
### Bug Fix 🛠️
4+
- Error handling for `/notifyall` command
5+
- Add users count for `/notifyall` command
6+
7+
### For Developer 🧑‍💻
8+
- Logging of error info message
9+
210
## Version 2.4.1 - Date 12 May 2024
311
### Enhancement 🔥
412
- Added google form for reporting bugs, feedbacks and feature requests
@@ -33,7 +41,7 @@
3341
- Added test for database module
3442

3543
## Version 2.3.3 - Date 1 May 2024
36-
### Minor Fix 🛠️
44+
### Bug Fix 🛠️
3745
- Add datetime and username for logging purposes
3846
- Add more message to help command
3947

0 commit comments

Comments
 (0)