Skip to content

Commit

Permalink
gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mpellicc committed Jan 26, 2024
1 parent daaa9df commit 3eaa6de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,7 @@ cython_debug/
#.idea/

# IDEs
.vscode/
.vscode/

TODO.md
.python-version
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ To get started with Fanta Formazioni Reminder, follow these steps:

Before running the bot, you'll need the following:

- Python 3.x installed on your system.
- Python 3.x installed on your system. The bot is developed in Python 3.11.4.
- A Telegram account and a bot token obtained from the [BotFather](https://core.telegram.org/bots#botfather).

### Installation
Expand Down Expand Up @@ -78,8 +78,8 @@ The bot provides various commands to interact with it. You can start a chat with

- `/start`: Start a chat with the bot and get an introduction.
- `/aggiungi_data`: Save a custom date to be reminded in the chat you used this command.
- `/prossima_scadenza`: Display the next deadline for setting up your team's lineup.
- `/annulla`: Cancel an ongoing conversation with the bot.
- `/prossima_scadenza`: Display the next deadline for setting up your team's lineup.
- `/annulla`: Cancel an ongoing conversation with the bot.
- `/help`: Display a help message with available commands.

Feel free to explore and customize the bot's functionality as per your requirements.
Expand Down
20 changes: 7 additions & 13 deletions clean_wiki_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,36 @@
CSV_PATH: Final = os.getenv("SERIE_A_CALENDAR_PATH")
CSV_URL: Final = os.getenv("SERIE_A_CALENDAR_URL")


def download_csv(url, dest_path) -> None:
response = requests.get(url)
with open(dest_path, 'wb') as file:
with open(dest_path, "wb") as file:
file.write(response.content)


def get_cleaned_dates() -> List[datetime]:

# Download the CSV file
download_csv(CSV_URL, CSV_PATH)

# Read the data from the CSV file
with open(CSV_PATH, newline='', encoding='utf-8') as csvfile:
with open(CSV_PATH, newline="", encoding="utf-8") as csvfile:
reader = csv.DictReader(csvfile)

# Initialize a dictionary to store the earliest date for each round
dates = {}

# Map month names to integers using a dictionary
months_mapping = {
"gen.": 1, "feb.": 2, "mar.": 3, "apr.": 4, "mag.": 5, "giu.": 6,
"lug.": 7, "ago.": 8, "set.": 9, "ott.": 10, "nov.": 11, "dic.": 12,
}

# Iterate through each row in the CSV file
for row in reader:
# Extract date and time from the CSV row
date_str = row["Date"]
time_str = date_str.split()[-1] # Extract time from the end of the date string

# Convert date string to datetime object
date_obj = datetime.strptime(date_str, "%d/%m/%Y %H:%M")

# Subtract 5 minutes from the datetime
date_obj -= timedelta(minutes=5)

# Extract round number from the CSV row
# Extract round number from the CSV row
round_number = int(row["Round Number"])

# Update the earliest date for the round if needed
Expand Down

0 comments on commit 3eaa6de

Please sign in to comment.