Alerta-de-Campeonatos-WCA

command module
v0.0.0-...-966ca34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2022 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 0

README

Alerta-de-Campeonatos-WCA

Um script que manda um e-mail quando há um campeonato novo na WCA. A script which send an e-mail when there's a new WCA competition. Integrates the WCA's and the Google Sheets API, the subscription is made by the Google Forms.

Header

Run - checking for new competitions GoDoc GoReportCard License CodeFactor

Ideia:

"The World Cube Association governs competitions for mechanical puzzles that are operated by twisting groups of pieces, commonly known as 'twisty puzzles'. The most famous of these puzzles is the Rubik's Cube, invented by professor Rubik from Hungary. A selection of these puzzles are chosen as official events of the WCA. As the WCA has evolved over the past decade, over 100,000 people have competed in our competitions."

Me and my friends have the speedcubing as a hobbie, simplified: solve rubik's cube and other puzzles in the lowest time as possible. There's official competitions all over the world, realized by the World Cube Association (WCA), as above-mentioned.

We participate in them, and is very common we check the WCA's site searching for nearly competitions. Sometimes, we check few times a week, and nothing; sometimes, we forgot to check and lost a long-awaited competition. To solve this issue, I had the idea of making a script that would check the site periodically and notify us when it identified a competition nearby that could be of interest to us.

Usage:

Subscribe, inserting your name, email, language and the city you want to be notified by filling the form bellow:

Subscribscription Form

Execution:

To execute this project, I've initially used Python with the libraries requests and BeautifulSoup for web scrapping in the site itself and smtplib for sending emails. But I made a migration to Golang, with the WCA's API instead of the front-end site. I studied modulation of code in local packages, the usage of libraries as spreadsheet for connect with Google Sheets API and the gomail to send the notifications.

The code works as follows:

  • Fetch the data from a spreadsheet in my Google account (recipients data and credentials to emails sending);
  • Verify the upcoming competitions of each recipient city;
  • Update it in the spreadsheet;
  • Compare the current verification with the last one;
  • Send an email if this numbers are different;

All this process is logged in main.log file.

In my Google account, the spreadsheet is organized in this format:

Sheet 1 ("Recipients"):

The data provided by the form and the past verifications.

Form was filled in Name Email City Language Upcoming Competitions Last Verification
00/00/0000 00:00:00 anne anne@e.com New Jersey English 7 0000-00-00 00:00:00
... ... ... ... ... ... ...
Sheet 2 ("Betas"):

My personal friends who agreed to be beta testers. When the code is in development it runs here first.

- Name Email City Language Upcoming Competitions Last Verification
- tagu tagu@u.com São Paulo Português 2 0000-00-00 00:00:00
... ... ... ... ... ... ...
Sheet 3 ("Credentials"):

The email and password of the email sender account.

Email Password
myaccount@gmail.com my9a55w0rd

To do:

  • Add an runtime map with {city : upcoming copetitions} and if the city were already verificated in other recipient, do not verificate again and catch this data from the map.
  • Add tests in the whole app.

Suggest something to do in issues :)

LICENSE:

Alerta-deCampeonatos-WCA - A script which send an e-mail when there's a new WCA competition. 
Copyright (C) 2020  Luis Felipe Santos do Nascimento

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package email is a local package and implements functions to send a notification email given the `gspread.RecipientStruct` structure.
Package email is a local package and implements functions to send a notification email given the `gspread.RecipientStruct` structure.
Package gspread is a local package and implements functions to access recipients and credentials data from the Google account with the Google Sheets API.
Package gspread is a local package and implements functions to access recipients and credentials data from the Google account with the Google Sheets API.
Package resume is a local package and implements objects and functions to export a resume.json when some verification is complete.
Package resume is a local package and implements objects and functions to export a resume.json when some verification is complete.
sendmelog
Package sendmelog package implements a function to send me via an Telegram message the `main.log` file.
Package sendmelog package implements a function to send me via an Telegram message the `main.log` file.
Package wca is a local package and implements functions to access the data from the WCA's API.
Package wca is a local package and implements functions to access the data from the WCA's API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL