Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Bot can't update status message #62

Closed
2 tasks done
obervinov opened this issue May 30, 2024 · 0 comments · Fixed by #72
Closed
2 tasks done

Bug: Bot can't update status message #62

obervinov opened this issue May 30, 2024 · 0 comments · Fixed by #72
Assignees
Labels
bug Something isn't working
Milestone

Comments

@obervinov
Copy link
Owner

obervinov commented May 30, 2024

Describe the bug
Not working to renew status_message functionality in some situations.
Log: https://obervinov312.grafana.net/goto/Mwwlj4yIR?orgId=1
Error message:

modules.exceptions.FailedMessagesStatusUpdater: {'call': 'Thread-message-updater', 'message': 'Failed to update the message with the status of received messages ', 'users': [('123456789', '123456789')], 'user': ('123456789', '123456789'), 'exception': ApiTelegramException("A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message can't be deleted for everyone")}

Additional context
Information about where the bug is happening:

  1. Message deletion limit of 48 https://core.telegram.org/bots/api#deletemessage
  2. The bot recreates the message every 24 hours, but for some reason it didn't work.

Possible correction
This problem shouldn't cause the thread to drop completely, if the message can't be deleted, you should just send a new one and replace it in the database.
The problem seems to be related to

        if check_exist_message_type:
            self._update(
                table_name='messages',
                values=(
                    f"message_content_hash = '{message_content_hash}', "
                    f"message_id = '{message_id}', "
                    f"timestamp = CURRENT_TIMESTAMP"
                ),
                condition=f"id = '{check_exist_message_type[0][0]}'"
            )
            response = f"{message_id} updated"

timestamp is updated with each edit and the thread has no correct information about the post creation date.

Screenshots
None

Check list after fixing the bug

  • add a column to the created_at database to record when the message was created and recreate it based on this attribute
  • rename the timestamp column to updated_at
@obervinov obervinov added the bug Something isn't working label May 30, 2024
@obervinov obervinov self-assigned this May 30, 2024
@obervinov obervinov added this to the v2.1.6 milestone Jun 14, 2024
@obervinov obervinov linked a pull request Jun 14, 2024 that will close this issue
obervinov pushed a commit that referenced this issue Jun 17, 2024
@obervinov obervinov linked a pull request Jun 18, 2024 that will close this issue
obervinov pushed a commit that referenced this issue Jun 22, 2024
## v2.1.6 - 2024-06-22
### What's Changed
**Full Changelog**: v2.1.5...v2.1.6 by @obervinov in #70
#### 💥 Breaking Changes
* remove unused database `environment` attribute permanent path in the Vault: `configurations/database`
* remove unused environment variable `PROJECT_ENVIRONMENT`
* the automatic queue verification mechanism has been removed. Instead of this method, added functionality to update the queue processing time via a message to the bot
* change the structure of the table `messages`: add a new column `state` and `updated_at`, rename column `timestamp` to `created_at`
#### 🐛 Bug Fixes
* #69
* #62
* #67
* #64
* #65
* Removed duplicates in rights checking
* Small refactoring code
#### 🚀 Features
* Bump dependency versions for modules and workflows
* Add button for rescheduling the queue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

1 participant