Skip to content

Commit 06c262c

Browse files
authored
v2.3.3 - [CHANGES] include tracking of datetime and username (#39)
1 parent 920219a commit 06c262c

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

bot/firestore_service.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
from datetime import datetime
12
from bot.firestore_config import db
23

34

45
# New user setup
5-
def new_user_setup(telegram_id, sheet_id):
6+
def new_user_setup(telegram_id, sheet_id, telegram_username):
67
user_ref = db.collection("users").document(str(telegram_id))
7-
user_ref.set({"sheet_id": sheet_id})
8+
user_ref.set({
9+
"sheet_id": sheet_id,
10+
"datetime_created": datetime.now(),
11+
"username": telegram_username
12+
})
813

914

1015
# Check if user exists

bot/telegram_bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ def start(update, context):
6363

6464
def set_up(update, context) -> int:
6565
telegram_id = update.effective_user.id
66+
telegram_username = update.effective_user.username
6667
url = update.message.text
6768

6869
pattern = r"/d/([a-zA-Z0-9-_]+)"
6970
match = re.search(pattern, url)
7071
if match:
7172
sheet_id = match.group(1)
7273
try:
73-
db.new_user_setup(telegram_id, sheet_id)
74+
db.new_user_setup(telegram_id, sheet_id, telegram_username)
7475
current_datetime = dt.datetime.now(timezone)
7576
day = current_datetime.day
7677
month = current_datetime.strftime("%b")

bot/text_str.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
+ "/getdaytransaction - Retrieve transaction from dates\n"
5656
+ "/getoverall - Retrieve overall transaction for a month\n"
5757
+ "/cancel - Cancel Conversation\n"
58-
+ "\nTo report bugs, please create a issue at https://github.com/brucewzj99/tele-tracker-v2/issues or contact me @bruceeew on Telegram"
58+
+ "\nTo report bugs or request any features, please create a issue at https://github.com/brucewzj99/tele-tracker-v2/issues\n"
59+
+ "\nYou can support me by buying me a coffee at https://ko-fi.com/brucewzj"
5960
)
6061

6162
GET_TRANSACTION_TEXT = "Please specify the date and month you wish to retrieve from in this format: DD MMM\ne.g 16 Mar\n\nUse 'tdy' to retrieve the transacation for today \nor use /cancel to exit"

release_notes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Release Notes
2+
## Version 2.3.3 - Date 1 May 2024
3+
### Minor Fix 🛠️
4+
- Add datetime and username for logging purposes
5+
- Add more message to help command
6+
27
## Version 2.3.2 - Date 27 Mar 2024
38
### Bug Fix 🛠️
49
- Fix backlog new date entry bug

0 commit comments

Comments
 (0)