Skip to content

An Italian Telegram Bot in Python to retrieve participants for the organization of a football game.

License

Notifications You must be signed in to change notification settings

iamgiolaga/partitelle-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

** PartitelleBot**

PartitelleBot

PartitelleBot is an Italian Telegram Bot in Python to retrieve participants for the organization of a football game.

Table of contents

Architecture

This is a Python project relying on python-telegram-bot library. Data storage is handled through PostgreSQL. The application and the mentioned database are both hosted on Render.

Project structure

  • database.ini: a configuration file with database credentials
  • config.py: a little function to parse and read database credentials in database.ini
  • requirements.txt: a file to indicate Render which external libraries are necessary to the Python code.
  • main.py: the real heart of PartitelleBot code

Behaviour

Presentation message

By adding PartitelleBot to your Telegram group, you can easily manage those so-hard-to-organize weekly football matches with your friends. You have two ways of interacting with the bot:

  1. by writing a specific set of allowed messages through the conversation
  2. by using standard commands

By default, the bot sets all new matches the next Wednesday at 9 pm but this information is, of course, editable. Once a new match is created through /start command, people can begin to organize the match through the set of allowed messages. The first time the bot detects an adding interaction, it will print a match summary of the current situation whereas from the second time it will edit its previous message (by the way remind that a new explicit summary can be obtained through /participants command). In this way, people can easily and autonomously add, propose, and remove themselves or each other. Once the target number is reached, users enter the final phase; here, the bot states that is the time to play and asks permission to generate /teams. Through this command, the bot randomly generates two groups of players, respectively the black team and the white team. At this point, users can always adjust the teams by swapping players.

Note: if you give PartitelleBot the administrator rights, it will be able to pin its messages in the group.

Match summary

Match summary

In my organizational experience, one of the most annoying tasks is to keep on copying and pasting the same list over and over again each time a new update over participants turns out. This summary aims to change this pattern and let the bot do the dirty work. This message has a specific structure:

GIORNO: <day> | <time>

<participants list from 1 to N

  • added player ✅
  • added player ✅
  • proposed player ❓
  • ...

- free slot ❌ where N is the target number>

<description>

CAMPO: <pitch>

Final phase

Final phase

Swapping players

Swap

Allowed messages

This is the list of current available allowed messages to interact with the bot:

  • proponimi - you want to be added to the list but you are not 100% sure to be present
  • proponi <nome> - you propose someone else who may participate
  • aggiungimi - you want to be added or confirmed to the list of participants
  • aggiungi <nome> - you add someone to the list or someone who had been previously proposed
  • toglimi - you remove yourself from the list in any case
  • togli <nome> - you remove someone else from the list in any case
  • scambia <nome 1> con <nome 2> - you swap two players to balance the teams generated by the bot

Commands

This is the list of current available commands:

  • /start - Create new match
  • /setnumber - Set the number of participants
  • /setday - Set the day of the match
  • /settime - Set the time of the match
  • /setdescription - Set the custom message under the list of participants
  • /setpitch - Set the football pitch
  • /participants - Show the participants of the current match
  • /teams - Show the generated teams for the current match
  • /stop - Remove the match
  • /help - Show the list of available commands

How to contribute

"Can I contribute to this project?"

Hell, yes 😉!

Have a look here.

Sponsorships

The ambitiousness of this project depends on the resources it has available and every little help to contribute to its improvement is appreciated. Nothing mandatory, just do it if you feel like you would offer me a coffee! :) In that case, tap the Sponsor button at the top, or click here 💪.

About

An Italian Telegram Bot in Python to retrieve participants for the organization of a football game.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages