Giter VIP home page Giter VIP logo

telegram_flea's Introduction

@Telegram Flea - Your Open-Source Flea-Market Bot for Telegram ๐Ÿ›’

Telegram Flea is an open-source bot for Telegram designed to serve as a handy tool for flea-markets for any Community!. It is scalable and can be used by anyone around the globe! Currently, a basic version of the project is available, you can easily post your items to a dedicated Telegram-channel. Please refer to the attached photo for an example.

Table of Contents ๐Ÿ“š

Photos

image

image

Languages

Language Code Status
English en โœ…
German de โœ…
Ukrainian uk โœ…
Indonesian id โœ…
Hindi hi โœ…
Spanish es
French fr
Japanese ja
Chinese zh
Arabic ar
Portuguese pt
Bengali bn
Punjabi pa
Italian it
Turkish tr
Dutch nl
Polish pl
Vietnamese vi
Tamil ta
Telugu te
Marathi mr
Kannada kn
Malay ms
Urdu ur

Todo

  • [todo] Moderation system of items applied

Clone

git clone https://github.com/your_username/telegram_flea.git

Install

cd telegram_flea
pip install poetry
poetry install

Set up your .env file with your Telegram API credentials.

Redis-installation

Overview

Redis is a powerful and lightning-fast open-source database system that is often used to store and manage data in a very simple way. It's often referred to as a "key-value store" because it stores data as pairs of keys and their associated values.

Repository contains Docker file. This file is used for creating Docker image with Redis. First you need is Docker. How to install docker please find here docker build -t <enter name> . To create new image with specific name.

docker run -p 6379:6379 -p 8001:8001 <image name>

To create new container.

After that you can start your bot.

Contribution

We love contributions! Please read our Contribution Guidelines to get started.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Acknowledgements

  • Thanks to aiogram for the awesome Telegram Bot API wrapper.
  • And @mykolasolodukha for sharing the Telegram bot template for this repository
  • All contributors are welcome! ๐ŸŒŸ

telegram_flea's People

Contributors

anemaygi avatar avenortoz avatar bloodyocean avatar bodamat avatar hexponent avatar ishevche avatar kamo-develop avatar mykolasolodukha avatar reghill avatar salz0 avatar sfazli96 avatar vessaldaneshvar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

telegram_flea's Issues

๐Ÿ›Bug: Bot doesn't accept photos as files

Describe the bug
When you try to post with /sell using a file, the bot doesn't react. Something goes wrong, needs investigation

To Reproduce
Steps to reproduce the behavior:
Try selling with a file-photo, without compressing

Expected behavior
It should accept photos as files

Screenshots
image

๐Ÿ“ธ Implement Unit Tests for `enter_photo ` function from `main.py`

To ensure the robustness and correctness of the image handling functionality in the project, it's essential to create unit tests that thoroughly validate its behavior. ๐Ÿงช๐Ÿ–ผ๏ธ

Expected Behavior:
The unit tests should verify that the image handling function correctly processes incoming photos, downloads them, prepares the data, and sends the image to the specified channel with the appropriate caption.
Acceptance Criteria ๐ŸŽฏ:

  • Unit tests for simulating incoming photo messages are implemented.
  • Unit tests for image download and data preparation are functional.
  • Tests for caption generation meet expectations.
  • Unit tests for sending images to specified channels are working.
  • Tests cover different image formats.
  • All tests pass successfully ๐ŸŸข.

Steps for Implementation ๐Ÿ”จ:
Set Up Testing Environment: Ensure that you have a test environment that closely mimics the production environment.

Test Incoming Messages: Write tests to simulate incoming photo messages.

def test_incoming_messages():
    # your code here

Test Photo Download and Data Preparation: Create tests that ensure photos are downloaded and data is prepared correctly.

def test_photo_download():
    # your code here

Test Caption Generation: Validate that captions are generated in the expected format.

def test_caption_generation():
    # your code here

Test Image Sending: Test whether the image is sent to the specified channel.

def test_image_sending():
    # your code here

Test Different Formats: Include tests for different image formats.

def test_image_formats():
    # your code here

Run and Validate Tests: Run the tests and ensure they all pass. If any fail, debug and rerun the tests.

Additional Notes ๐Ÿ“š:
Include logging within tests to capture important debugging information.
Consult the documentation for any external libraries you're using for image processing.

You can do one test at a time, no problem!

๐Ÿ“š Make a beautiful README.md

The README.md right now is rather ordinary and deserves some refreshment.

Provide a nice new version of the first page of our project

  • I suggest adding a GIF demonstration on how the bot works, would be really nice.
  • Also broaden the table of languages, adding the top 20 most popular languages for us to consider in the future
  • Rephrase and delete unnecessary wording
  • Add useful link (f.e. contributing guide)

โŒจRemove Inline Button After User Interaction to Prevent Repeated Actions

Issue Description ๐Ÿ“

Currently, after a user presses an inline button associated with a message in a channel, the button remains active. This allows for repeated actions, which is undesirable. Additionally, the message gets deleted from the channel upon successful action. The goal is to make the inline button disappear or be disabled once pressed, and to prevent further actions after a successful operation.

Requirements ๐ŸŽฏ

  1. Inline Button Removal: After a user presses the inline button, it should be removed from the message.
  2. Message Deletion: Continue to delete the message from the channel after successful action, if that's the current desired behavior.
  3. Prevent Repeated Actions: Once the action is successful and the message is deleted, the action should not be allowed to be repeated.

Acceptance Criteria โœ…

  • Inline button should disappear or become disabled after a user presses it.
  • Message should continue to be deleted after a successful action.
  • Users should not be able to perform the action again once it's been successfully executed.

Possible Solution ๐Ÿ› ๏ธ

  1. Capture the callback query when the inline button is pressed.
  2. Delete or disable the inline button from the message.
    await bot.edit_message_reply_markup(
        chat_id=callback_query.message.chat.id,
        message_id=callback_query.message.message_id,
        reply_markup=None
    )

Unable to run project // KeyError: 'TELEGRAM_BOT_TOKEN'

Okay so prior to my earlier issue raised i have all my modules installed via poetry & my environment set up however i still come across a KeyError of a missing env variable.

Steps to reproduce
Run project from scratch with python main.py

Expected result:
Bot started (success message)

Actual result:

Traceback (most recent call last):
  File "/Users/macbookpro/telegram_flea/main.py", line 18, in <module>
    bot = aiogram.Bot(os.environ["TELEGRAM_BOT_TOKEN"])
                      ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'TELEGRAM_BOT_TOKEN'

Screenshots
dummy

๐Ÿ™‹โ€โ™‚๏ธ Add Ukrainian Language Support

Description ๐Ÿ“:

As part of our ongoing efforts to make our project more accessible to a global audience, we would like to extend our existing i18n (Internationalization) support to include the Ukrainian language.

Requirements ๐Ÿ“‹:

  • Extend i18n Configuration: Add Ukrainian (uk-UA) to the list of supported languages in the i18n configuration.
  • Translation Files: Create a .po file for Ukrainian translations in the /locales directory.
  • Text Resources: Update all text resources to include Ukrainian translations.
  • Testing: Test to ensure that the Ukrainian language support works seamlessly across all features.
  • Documentation: Update relevant documentation to reflect the new language support.

Acceptance Criteria ๐ŸŽฏ:

  • Ukrainian is added to the list of supported languages in the i18n configuration.
  • Ukrainian .po file is added.
  • All text resources are translated into Ukrainian.
  • Ukrainian language support is fully functional in all features.
  • Documentation is updated to indicate Ukrainian language support. (README.md file)

Still missing imports or modules after installing

Describe the bug
On loading the repo to my IDE, i get bugs requesting I install missing modules even after rightly installing them.

To Reproduce
Steps to reproduce the behavior:

  1. After loading project to my IDE
  2. I install modules 'aiogram' , python-dotenv, Path on my IDE terminal
  3. After which i encounter missing aiogram dependencies/imports errors on lines 5,6,8,9

Screenshots

Screenshot 2023-10-26 at 22 38 48

Unable to run project. ...this language is not compiled!

Main.py expects locale files to be compiled before first run.

Steps to reproduce
Run project from scratch with python main.py

Expected result:
Bot started (success message)

Actual result:
RuntimeError: Found locale 'uk' but this language is not compiled!

๐Ÿ†˜ Implement a /help Command for User Guidance

Enhance user support by implementing a /help command to provide guidance and information within the application. ๐Ÿค๐Ÿ†˜

Users can type /help in the chat to receive a list of available commands, FAQs, and basic usage instructions, improving their understanding of the app's functionality. ๐Ÿ’ฌโ“

๐ŸŒ Implement Multi-Language Support for the Bot Using aiogram's Built-in i18n ๐ŸŒ

Description ๐Ÿ“:
Implement support for multiple languages in the bot using Aiogram's built-in i18n features. The language setting will not be interactive and will be a bot-level configuration.

Requirements ๐Ÿ“‹:
Installation: Install any necessary packages for i18n.
Configuration: Configure i18n settings in Aiogram bot.
Translations: Add translation files for supported languages.
Fallback: Ensure there's a fallback language (ENGLISH or UKRAINIAN) if the set language translation isn't available.
Acceptance Criteria ๐ŸŽฏ:

  • i18n is configured in the bot
  • Translation files are added and loaded
  • Bot responds in the configured language
  • Fallback to a default language is implemented
  • Steps for Implementation ๐Ÿ”จ:
  • Initialize i18n: Initialize i18n in the Aiogram bot project.
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.contrib.middlewares.i18n import I18nMiddleware

bot = Bot(token='YOUR_BOT_TOKEN')
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage)

i18n = I18nMiddleware('bot', 'path/to/locales')
dp.middleware.setup(i18n)

Add Translation Files: Create .po files and automate .mo creation for supported languages in the /locales directory.

Configure Language in Bot: Set the language to be used in the bot settings, and not allow users to change it.

@dp.message_handler(commands=['start'])
async def send_welcome(message: types.Message):
    await message.reply(i18n.t('bot.start_message'))

Test: Make sure all features work in the specified language, and a fallback language is used when necessary.

Telegram users without usernames are mentioned incorrectly

Sellers without usernames are displayed incorrectly in the listing.
For such users, their user IDs are displayed where the username is supposed to be, resulting in the mention @[some numbers here]. Such mentions are parsed by Telegram incorrectly, as it treats these IDs as actual usernames.

To Reproduce
Steps to reproduce the behavior:

  1. Get a Telegram account without a username.
  2. Add an item using the bot.
  3. In the moderator chat or channel, the seller mention is displayed incorrectly and is not traversable.

Additional
It is possible to create a link to a user using formatting: [some text](tg://user?id=), then, with the proper formatting method, "some text" will be displayed as a link to an account. With this method, there might be some issues with account privacy settings.

๐Ÿ“ฅ Implement Reply-Markup Buttons for a User-Friendly Experience

Enhance user interaction by replacing text commands with intuitive action buttons. ๐Ÿš€๐Ÿ”˜

Expected Behavior:
Instead of typing commands, users can click on the keyboard buttons for common actions, making the app more user-friendly and accessible. ๐Ÿค–๐Ÿ“ฒ

Docs: https://docs.aiogram.dev/en/latest/api/types/reply_keyboard_markup.html

Example:
https://github.com/aiogram/aiogram/blob/dev-2.x/examples/regular_keyboard_example.py

Make it simple

๐Ÿž Add Manual Ability to Cancel Selling Request for Items in Telegram Channel

Summary: ๐Ÿ“

Add a feature to the Flea Market Telegram Bot that allows users to manually cancel the selling request for items, effectively removing them from the Telegram channel.

Details: ๐Ÿ“š

Currently, once an item is posted for sale in the Telegram channel, it stays there indefinitely. Users should have the ability to manually remove their items from the channel, whether it's because the item was sold outside of the channel, withdrawn from sale, or for any other reason.

Proposed Solution: ๐Ÿ› 

Add a /cancel [item_id] command to the bot.
When a user triggers this command, the bot should prompt for a confirmation to ensure it's not a mistake.
Upon confirmation, the bot should remove the corresponding item post from the Telegram channel.

Acceptance Criteria: โœ…

  • A user can cancel a selling request by using the /cancel [item_id] command.
  • A confirmation step exists to ensure items are not deleted accidentally.
  • The item post is removed from the Telegram channel once the cancellation is confirmed.

Additional Information: โ„น๏ธ

This feature adds flexibility for users in managing their selling requests and contributes to keeping the channel clean and relevant.

Thank you for considering this feature request. This will greatly enhance user autonomy and improve the overall experience in the Telegram channel. ๐Ÿ™๐Ÿค–๐Ÿ—‘

Use S3 storage to save files sent to the bot.

What?

  • Connect S3 (possibly Digital Ocean Spaces) using e.g. boto3 or rather aioboto3.
  • Save images sent to bot to S3. Possibly using a Middleware.
  • [Optional but preferred] Save the images' UUID4s (or similar) to the Database so that in the database we have a full local copy of an ad.

Why?

  • To have a list of all the images sent to the bot, in case someone is trying to abuse it, we can track the bad actor.
  • To possibly allow for a web-interface and/or different mediums, including different mediums in terms or payments.

Anything else?

I would argue for using async version of boto3 - aioboto3 (or analogs) because uploading an image to S3 is a heavy I/O-bound operation and having it be done async is a great plus.

๐Ÿ›ก๏ธImplement Selling Request Moderation System

Issue Description:
To ensure a top-notch marketplace, we need a moderation system for selling requests. This will guarantee that all listed items follow our rules and policies. ๐Ÿ“œ๐Ÿง

Expected Behavior:
When a user submits a selling request, it should go first to a admin (who's ID has been identified in the .env) with two buttons APPROVAL / DECLINATION inline-button attached. Moderators can approve, reject. ๐Ÿš€๐Ÿ‘ฎโ€โ™‚๏ธ

Suggestions are welcome ๐Ÿ™Œ

Add localization for moderations

You can split this into multiple issues:
the strings are:

  • bot.declined_successfully
  • bot.listing_declined{listing}
  • bot.listing_approved{listing}
  • bot.approved_successfully
  • bot.sent_to_moderation
  • bot.moderator_declination
  • bot.moderator_approval

Make sure to include in the tanslated version the {listing} variable

  • Hindi
  • English
  • German
  • Indonesian

Handle exception, when caption too long

The user should be notified that this length has a constraint, let it be around 2k symbols

Looks something like this:

2023-11-06T13:06:08.294794+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/aiogram/bot/base.py", line 236, in request
2023-11-06T13:06:08.294794+00:00 app[bot.1]:     return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
2023-11-06T13:06:08.294794+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”‚              โ”‚    โ”‚       โ”‚             โ”‚       โ”‚     โ”” {'photo': <InputFile 'attach://Zr7EVo7IeESjfXai5uPjYQ' with file='<_io.BufferedReader name='item_photo.jpg'>'>}
2023-11-06T13:06:08.294795+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”‚              โ”‚    โ”‚       โ”‚             โ”‚       โ”” {'chat_id': , 'caption': 'ะขะตะบัั‚ะพะฒั– ะบะฐั€ั‚ะธะฝะบะธ ะท ัะธะผะฒะพะปั–ะฒ, ัะบั– ั‚ะฐะบะพะถ ะฝะฐะทะธะฒะฐัŽั‚ัŒ ASCII ะฐั€ั‚ ั†ะต ะพะดะฝะต ะท ะผะธัั‚ะตั†ั‚ะฒ ะดะพัั‚ัƒะฟะฝะธั… ะบ...
2023-11-06T13:06:08.294796+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”‚              โ”‚    โ”‚       โ”‚             โ”” 'sendPhoto'
2023-11-06T13:06:08.294796+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”‚              โ”‚    โ”‚       โ”” <aiogram.bot.bot.Bot object at 0x7fab07b39910>
2023-11-06T13:06:08.294796+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”‚              โ”‚    โ”” TelegramAPIServer(base='https://api.telegram.org/bot{token}/{method}', file='https://api.telegram.org/file/bot{token}/{path}')
2023-11-06T13:06:08.294796+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”‚              โ”” <aiogram.bot.bot.Bot object at 0x7fab07b39910>
2023-11-06T13:06:08.294796+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”‚    โ”” <function BaseBot.get_session at 0x7fab07f20360>
2023-11-06T13:06:08.294796+00:00 app[bot.1]:                  โ”‚   โ”‚                  โ”” <aiogram.bot.bot.Bot object at 0x7fab07b39910>
2023-11-06T13:06:08.294797+00:00 app[bot.1]:                  โ”‚   โ”” <function make_request at 0x7fab07ea3c40>
2023-11-06T13:06:08.294797+00:00 app[bot.1]:                  โ”” <module 'aiogram.bot.api' from '/app/.heroku/python/lib/python3.11/site-packages/aiogram/bot/api.py'>
2023-11-06T13:06:08.294797+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/aiogram/bot/api.py", line 140, in make_request
2023-11-06T13:06:08.294797+00:00 app[bot.1]:     return check_result(method, response.content_type, response.status, await response.text())
2023-11-06T13:06:08.294797+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”‚             โ”‚        โ”‚             โ”‚        โ”” <function ClientResponse.text at 0x7fab08381620>
2023-11-06T13:06:08.294800+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”‚             โ”‚        โ”‚             โ”” <ClientResponse(https://api.telegram.org/bot6738102641:AAG9NTvl5IFG1qTBDmBe7vlAHteaUFhc-zA/sendPhoto) [400 Bad Request]>
2023-11-06T13:06:08.294800+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”‚             โ”‚        โ”‚               <CIM...
2023-11-06T13:06:08.294800+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”‚             โ”‚        โ”” 400
2023-11-06T13:06:08.294800+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”‚             โ”” <ClientResponse(https://api.telegram.org/bot6738102641:AAG9NTvl5IFG1qTBDmBe7vlAHteaUFhc-zA/sendPhoto) [400 Bad Request]>
2023-11-06T13:06:08.294800+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”‚               <CIM...
2023-11-06T13:06:08.294801+00:00 app[bot.1]:            โ”‚            โ”‚       โ”‚        โ”” <property object at 0x7fab0854d850>
2023-11-06T13:06:08.294802+00:00 app[bot.1]:            โ”‚            โ”‚       โ”” <ClientResponse(https://api.telegram.org/bot6738102641:AAG9NTvl5IFG1qTBDmBe7vlAHteaUFhc-zA/sendPhoto) [400 Bad Request]>
2023-11-06T13:06:08.294802+00:00 app[bot.1]:            โ”‚            โ”‚         <CIM...
2023-11-06T13:06:08.294802+00:00 app[bot.1]:            โ”‚            โ”” 'sendPhoto'
2023-11-06T13:06:08.294802+00:00 app[bot.1]:            โ”” <function check_result at 0x7fab07ea3d80>
2023-11-06T13:06:08.294802+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/aiogram/bot/api.py", line 115, in check_result
2023-11-06T13:06:08.294803+00:00 app[bot.1]:     exceptions.BadRequest.detect(description)
2023-11-06T13:06:08.294803+00:00 app[bot.1]:     โ”‚          โ”‚          โ”‚      โ”” 'Bad Request: message caption is too long'
2023-11-06T13:06:08.294803+00:00 app[bot.1]:     โ”‚          โ”‚          โ”” <classmethod(<function _MatchErrorMixin.detect at 0x7fab080c2de0>)>
2023-11-06T13:06:08.294803+00:00 app[bot.1]:     โ”‚          โ”” <class 'aiogram.utils.exceptions.BadRequest'>
2023-11-06T13:06:08.294803+00:00 app[bot.1]:     โ”” <module 'aiogram.utils.exceptions' from '/app/.heroku/python/lib/python3.11/site-packages/aiogram/utils/exceptions.py'>
2023-11-06T13:06:08.294804+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/aiogram/utils/exceptions.py", line 141, in detect
2023-11-06T13:06:08.294804+00:00 app[bot.1]:     raise cls(description)
2023-11-06T13:06:08.294804+00:00 app[bot.1]:           โ”‚   โ”” 'bad request: message caption is too long'
2023-11-06T13:06:08.294804+00:00 app[bot.1]:           โ”” <class 'aiogram.utils.exceptions.BadRequest'>

๐Ÿ“ƒCreate Comprehensive Documentation for Bot Usage

Summary: ๐Ÿ“

Create documentation that provides instruction on how to use and install the Flea Market Telegram Bot, aimed at both users and potential contributors.

Proposed Solution: ๐Ÿ› 

  • Write a comprehensive guide on how to use all existing features of the bot.
  • Include step-by-step screenshots or short video clips for complex processes.
  • Add an FAQ section to address common questions. (or leave space for future considerations)
  • Include a section that outlines how contributors can set up the development environment and add new features. + find the variables
  • Update the README.md to include a link to the new documentation.

Acceptance Criteria: โœ…

  • Documentation is complete
  • Step-by-step guides are clear and easy to follow.
  • An FAQ section is added. (even if empty)
  • README.md is updated with the link to the new documentation.

Additional Information: โ„น๏ธ

This documentation will be the primary source of information for users and new contributors, so it needs to be as clear and comprehensive as possible. It would be beneficial to get feedback from both users and other developers to ensure all bases are covered.

Thank you for considering this issue. Proper documentation will significantly improve the user experience and encourage more contributions to the project. ๐Ÿ“š๐Ÿค–๐Ÿ‘ฅ

๐ŸขImplement PostgreSQL Database for Capturing Useful Statistics and Anonymous User Data Using Tortoise-ORM

Issue: Implement PostgreSQL Database for Capturing Useful Statistics and Anonymous User Data Using Tortoise-ORM

Problem Description

At present, the bot doesn't keep track of useful statistics and user data that could be crucial for improving user experience and analyzing usage patterns. We would like to capture and store this data in a PostgreSQL database.

Objective ๐ŸŽฏ

The aim is to implement a PostgreSQL database using Tortoise-ORM to store statistics and user metrics, while ensuring that all data is anonymized for user privacy.

Suggested Changes

You can divide these into separate PullRequests, to make the task easier:

Implement basic data saving:

  • Use Tortoise-ORM to create database models that align with the metrics and data points you identified.
  • Implement data capture and storage in the database within the bot's existing command handlers and states.
  • Make sure all stored data is anonymized and not traceable to individual users.

Suggestions on what to save:

  • the Triggering of specific commands with datetime
  • Average interaction length.
  • Interface language of users

Do something with the data:

  • Create a module to analyze the data in general
  • Analyze the most popular time of the day and day of the week using a graph (matplotlib)
  • Use a barplot to visualize Interface languages of users

โ• Important: this functionality should be optional, as the usage of a sophisticated database and statistical analysis can be unnecessary for some projects.

Code Snippet

Below is a hypothetical Python code snippet that demonstrates how you might use Tortoise-ORM to interact with a PostgreSQL database:

from tortoise import Tortoise, fields
from tortoise.models import Model

class UserStatistics(Model):
    id = fields.IntField(pk=True)
    command_used = fields.CharField(max_length=50)
    session_length = fields.FloatField()
    # any other fields

Tortoise.init(
    db_url='postgres://username:password@localhost:5432/mydatabase',
    modules={'models': ['your_project.models']}
)

async def track_start_command(user_id: int):
    await UserStatistics.create(command_used='start', session_length=0.0)
    # other logic

Acceptance Criteria

  1. Data is properly captured and stored in a PostgreSQL database.
  2. All stored data is anonymized.
  3. The database setup should be modular and easily extendable for capturing more metrics in the future.
  4. Testing
  5. Add unit tests to verify that the database is capturing and storing the data as expected.
  6. Manually review entries to ensure that they are anonymized and not traceable to individual users.
  7. Please feel free to contribute by making a Pull Request to address this issue. Thank you! ๐Ÿ“ˆ๐Ÿ”’

Note: Make sure to adhere to privacy guidelines and policies such as GDPR when implementing this feature.

You can divide this task by creating multiple pull requests! No need to do all this work at once โ™ฅ

Update Contribution files to recent changes

Current README.md file is not up-to-date, please add:

  • How to use the bot without Redis
  • how to get the BotFather and channel going
  • How to use WITH Redis
  • Other missed features and steps

๐Ÿง… Implement Redis Storage for Data Persistence

Issue: Implement Redis Storage for Data Persistence

Problem Description

Currently, the bot is using in-memory storage for FSM (Finite State Machine) which loses all its data when the bot is restarted. This may not be ideal for production where uptime and data integrity are important.

Objective

Implement a Redis storage solution to replace the existing MemoryStorage for better data persistence.

Suggested Changes

  1. Add Redis to your project's dependencies.
  2. Modify the storage = MemoryStorage() line to use Redis-based storage.
  3. Ensure that all existing FSM states and data points are moved to Redis.
  4. Test thoroughly to make sure all functionalities remain intact post-migration.

Code Snippet

Replace:

storage = MemoryStorage()

Acceptance Criteria

  1. Data should be persistent across bot restarts.
  2. All FSM states should function as expected but now backed by Redis.
  3. Measure and confirm that the bot's performance isn't negatively affected by this change.
  4. Testing
  5. Ensure all existing unit and integration tests pass after these changes. If possible, add tests to confirm that the Redis storage behaves as expected.

Please contribute by making a Pull Request that resolves this issue. Thank you! ๐ŸŒŸ๐Ÿ”’

Let the person know which request was canceled

What's happening?

Currently the bot simply types the cancelation message without any reference to the request

Why?

It should be more intuitive to do a bot.reply() instead of bot.send_message() because the person will understand what is happening

This is easy to fix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.