zeroone2numeral2 / tg-secret-santa-bot Goto Github PK
View Code? Open in Web Editor NEWSecret Santa bot for Telegram
License: MIT License
Secret Santa bot for Telegram
License: MIT License
A friend of mine clicked join
button after we created a /newsanta
but the bot doesn't let him to be added.
I don't know why but it seems it's not working only with him.
I summarize the use case below.
/start
[Forwarded from Secret Santa bot π€«π
πΌπ]
Hello "name"!
I can help you organize a Secret Santa π€«π
πΌπ in your group chats :)
Just add me to a chat and use /newsanta to start a new Secret Santa.
Source code here
instead of
π You joined "name" 's Secret Santa!
Now wait for "name" to start it. You will receive your match here, in this chat
Via deeplink
The "retry to generate the secret santa pairs" logic should be inside the "start match" button handler. The utilities' function should raise a TooManyAttempts
exception and the handler callback should handle it and retry the draft if necessary. Maybe we should also set a max number of retries, and notify the user (and maybe post in the log channel) if that number is reached (to avoid to also block the bot for everyone)
We receive them when the secret santa message has been deleted and /commands (or private chats buttons) are used
There should be a decorator catching them. Then, what to do?
Ideas:
If command: answer "the secret santa message has been deleted, therefore the secret santa has been canceled"
If private chat button: answer "the secret santa message has been deleted, therefore the secret santa has been canceled"
This will allow to set forbidden matches/paths
Allow the santa creator to set forbidden matches. Strictly related to #9
The secret santa message in the group should have an inline button/deeplink that allows anyone to consult the list of forbidden matches. When used, the list will be returned in private chat, and the secret santa creator will see a button to edit it
If the creator wants to edit it, the bot will provide an inline keyboard with the participants. They will be able to pick one participant, and then another one from the same list. Once two items are picked, the bot will add them to the list and will show the list again with the edit button.
We should make sure to be able to limit the number of forbidden matches based on the current participants count in a way that an hamiltonian path is found, but it can happen directly when the secret santa is started and the matching process fails too many times: at this point we will warn the creator that the current constraints make it impossible to execute a draw
All handlers should be in a dedicated handlers/
directory where we initialize all handlers and then we import it in the main file
import handlers.santa_buttons
import handlers.private
...
dispatcher.add_handler(handlers.private.start)
dispatcher.add_handler(handlers.private.help)
dispatcher.add_handler(handlers.santa_buttons.start_match)
...
eg. handlers/private.py
def on_start_command(update, context):
pass
start = CommandHandler("start", on_start_command)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.