d5ca645470 | ||
---|---|---|
fz.py | ||
readme.md |
readme.md
Karaoke Telegram Bot
This simple bot was used to count the number of votes of every attendee during the "Karaoke of Furizon" event.
Requirements
- telethon
- Your own Telegram API_ID and API_HASH
- A channel where to send the posts for voting
How does it work?
The bot will listen for private messages from the users defined in the source code. When receiving a message with a picture, it will get forwarded to the desired channel, along with a "like" and a "golden" button, the interactions of with will be recorded and stored in the sqlite database over at "votes.db" with this schema:
"user_id" INTEGER NOT NULL,
"is_golden" INTEGER NOT NULL,
"msg_id" INTEGER NOT NULL,
PRIMARY KEY("user_id","is_golden","msg_id")
)```
From there, it is trivial to open the database and count the votes for each person and decide who's the winner!