chore: Add privacy policy for new users

This commit adds a privacy policy feature for new users. When a new user joins, the code reads the privacy policy from the "POLICY.md" file and sends it to the user in chunks of 4096 characters, respecting Telegram's character limit. This ensures that the privacy policy is sent in a readable format without splitting it in the middle of a line.
This commit is contained in:
Mattia Mascarello 2024-05-17 00:31:38 +02:00
parent 115643f928
commit eba906075f
2 changed files with 74 additions and 0 deletions

58
POLICY.md Normal file
View File

@ -0,0 +1,58 @@
*Privacy Policy for My Birthday Reminder Telegram Bot*
Effective Date: May 17th 2024
Hello! I'm glad you're using my Birthday Reminder Telegram Bot. I want to ensure that you understand how I handle your information. Here's what you need to know:
1. Information I Collect
When you interact with my Birthday Reminder Telegram Bot, I collect and process the following information:
- *Information You Provide:* I collect the birthday information you share with me, such as your own birthday and the birthdays of your contacts.
- *Automatically Collected Information:* I may collect certain information automatically when you use my bot, including your Telegram username and user ID.
2. How I Use Your Information
I use the information I collect for the following purposes:
- *Birthday Reminders:* I use the birthday information you provide to send you reminders about upcoming birthdays.
- *Listing Birthdays:* I use the collected data to list birthdays as per your request.
- *Bot Improvement:* I may analyze the collected data to improve the functionality and user experience of my bot.
3. Data Storage and Retention
- *Database Storage:* The information you provide is stored securely in my database.
- *Data Retention:* Your birthday information will be retained in my database until you choose to remove it or revoke access to my bot.
4. Data Sharing and Disclosure
- *No Sharing:* I do not share your personal data collected by my bot with third parties.
- *Legal Compliance:* I may disclose your information if required to do so by law or in response to a valid legal request.
5. Your Rights
- *Access and Rectification:* You have the right to access and rectify the personal data I hold about you. You can update or delete your birthday information at any time by interacting with my bot.
- *Data Portability:* You have the right to receive a copy of your personal data in a structured, commonly used, and machine-readable format.
6. Security
I am committed to ensuring the security of your personal data. I implement appropriate technical and organizational measures to protect your information against unauthorized access, disclosure, alteration, or destruction.
7. Changes to this Privacy Policy
I reserve the right to update or modify this Privacy Policy at any time. Any changes will be effective immediately upon posting the revised Privacy Policy. A copy of the latest Privacy Policy will be furnished to you on each update by means of a message from my bot.
8. Contact Me
If you have any questions or concerns about this Privacy Policy or my data practices, or if you would like to exercise your rights regarding your personal data, please contact me on Telegram at [@matmasak](https://t.me/matmasak).
------------------
*By using my Birthday Reminder Telegram Bot, you consent to the collection, use, and storage of your information as described in this Privacy Policy.*

16
main.py
View File

@ -127,6 +127,21 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
new_user, t = db_user_ping(update) # update the user in the database
reply_keyboard = main_menu(t) # get the main menu keyboard
#if new user must send privacy policy from POLICY.md (chunked)
if new_user:
with open("POLICY.md", "r") as file:
# split the text in chunks of 4096 characters, because Telegram has a limit of 4096 characters per message
# however, we do not split the text in the middle of a line, so we find the last newline character before the 4096th character
text = file.read()
while len(text) > 0:
split = text[:4096].rfind("\n")
await update.message.reply_text(text[:split], parse_mode="Markdown")
text = text[split + 1:]
# send the welcome message
await update.message.reply_text(
("Welcome!" if new_user else "Welcome back!") +
@ -137,6 +152,7 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
)
async def add_birthday(update: Update, context: ContextTypes.DEFAULT_TYPE):
db_user_ping(update)
"""Start the birthday adding conversation, asking for the name of the person"""