aoc-bot's People
aoc-bot's Issues
Handle promoting a group to supergroup
When a group is promoted to a supergroup while the bot is managing it, the bot will stop working. This is because the group id stops being valid and needs to be replaced by the supergroup id.
Fix this by listening to notifications about promoting groups to supergroups and updating the database. Be careful about race conditions.
Separate DEV environment
Create a separate DEV environment where the bot can be deployed without disturbing PROD.
- Register a new Telegram bot.
- Deploy a separate CloudFormation stack, AWS resource ids need to include environment id.
- Use the
environment
feature in GitHub. - Separate secrets in the DEV environment.
- Allow CI/CD to deploy to both, perhaps have a release process on GitHub.
Link to github from /help
Update command for a single day
The /update command takes a long time and creates lots of requests. Support an /update 2022 11 command, or /update today to update just a single day.
Race conditions when sending to telegram
When updating telegram, there is a race condition where we first communicate with Telegram API and only afterwards save the change to Dynamo. If multiple users trigger an update, people might get multiple invites and multiple boards may be added to the same chat room.
To solve this, we should probably first atomically update Dynamo, and update Telegram only if the Dynamo record previously did not exist/was not current. I believe this needs to be done for invites and board updates only.
Update to node.js 18.x
Decrypt tdlib database at runtime
Take it from create-groups branch
Display what was updated
When a user does not have logs enabled, he won't know which day/year was updated when issuing an /update
command. Change the message to include the same information that is in the log.
Merge aoc-redirect with aoc-bot
Fix code scanning alert - Incomplete string escaping or encoding
Tracking issue for:
Security alert for word-wrap package
Automated webhook registration
Support unsubscribing
Users need to unsubscribe the bot from a chat. The bot needs to update the db, so it no longer handles that chat.
AC:
- React to telegram messages about removing the bot from a room by removing the chat subscription from db.
- Test with removing the bot from the room, as well as completely removing the room.
Currently the bot starts crashing when it is removed from a room.
Ignore users not in AoC leaderboard
When someone installs the plugin and starts submitting times, they will be visible in the leaderboards without any times. We should only display people who are in the AoC leaderboard, ignore everyone else.
This is visible in 2022, user Francisco Modesto:
Deň 10 @10:15:55 ofic. part 1 a 2 (čas na p2) neoficiálne (čistý čas na p2)*
Peter Trebaticky 00:10:03 00:18:23 (00:08:20) [00:10:01 00:18:21 (00:08:19)]
Matúš Horváth 00:10:00 00:18:48 (00:08:48) [00:09:53 00:18:41 (00:08:46)]
Martin Štefček 00:10:03 00:23:02 (00:12:59) [00:10:01 00:23:00 (00:12:58)]
Peter Lacko 00:12:32 00:41:27 (00:28:55) [00:12:30 00:41:25 (00:28:53)]
Marian Niks 00:41:51 01:01:13 (00:19:22)
Fero Kováč 00:22:04 01:11:49 (00:49:45)
Branislav Sott 00:41:55 01:45:30 (01:03:35)
Radoslav Balvan 02:51:31 03:26:54 (00:35:23) [00:14:41 00:50:04 (00:35:20)]
Róbert Belanec 05:46:15 06:10:16 (00:24:01)
Tomas Visnovec 04:18:14 07:13:49 (02:55:35)
Francisco Modesto --:--:-- --:--:-- (--:--:--) [--:--:-- --:--:-- (--:--:--)]
Automatically update when added to a new room
When the bot is added to a new room, he should trigger an update immediately so people get added there.
Fix leaderboard formatting
The leaderboards are two narrow in current Telegram client, change them to use ``` code blocks which are wider.
Automatically renew AoC auth token
The AoC token currently expires every ~30 days. Implement a mechanism to renew the token, either using the OAuth renewal mechanism, or using OAuth credentials.
Data consistency checks
Create an integration test to check DB consistency:
- Check which years are enabled (should be 2015 - current year, plus the year used for IT).
- Check no chats created for disabled years.
- Check referential integrity between records.
Migrate to ARM based AWS Lambda
Don't hardcode years
Story: Users need to subscribe AoC bot into a chat for any AoC year/day.
AC:
- Instead of hardcoding the year in code, find to which rooms we are subscribed and process all corresponding years.
Trigger refresh from plugin
Create an endpoint that can be called from the plugin to trigger an update. This will be called when the plugin detects a successful part 2 submission.
Get /logs status
Allow /logs command without arguments to get current logs status.
Drop unused bot permissions
Find out which permissions are needed for the bot to work. If possible, drop unused permissions when bot is joining a chat.
Support changing AoC name
Automatically set up new chats
Set chat description, chat photo, other properties.
Integration test stability
Make tdl-based integration tests work reliably.
Enable history for new members
Bot should call toggleSupergroupIsAllHistoryAvailable so new members can see history:
https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1toggle_supergroup_is_all_history_available.html
Display participants from plugin who are present in the leaderboard
Currently we don't display participants who don't have any time in the leaderboard. Display them, as long as they are at least present in leaderboard (without a time).
Automatically promote selected people to administrators
When adding people from a preconfigured list to a chat, also promote them to administrators.
Improve `/update` interface.
- Before 6:00am, update the previous day (correct time should be based on AoC definition, not local time zone).
- Detect year and day based on ranges. Anything >= 100 is a year, anything lower is a day.
Generate a per-year leaderboard
Using the "local score" rules from https://adventofcode.com/2022/leaderboard/private/view/1503372, but based on plugin times.
Scheduled database backups
Here is a CloudFormation YAML snippet that will schedule a daily backup of one DynamoDB table, with 35 day retention period:
Resources:
BackupPlan:
Type: AWS::Backup::BackupPlan
Properties:
BackupPlanName: DailyDynamoDBBackup
Rules:
- RuleName: DailyBackupRule
TargetBackupVault: (default backup vault)
ScheduleExpression: "cron(0 12 * * ? *)"
StartWindowMinutes: 60
CompletionWindowMinutes: 180
Lifecycle:
DeleteAfterDays: 35
This snippet:
- Creates a backup plan called "DailyDynamoDBBackup"
- Adds a backup rule called "DailyBackupRule"
- Schedules the backup to run daily at 12:00 PM
- Allows backups to start within a 1 hour window and complete within 3 hours
- Deletes backups after 35 days
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.