Add WhatsApp reminder

This commit is contained in:
2024-06-18 21:21:27 +02:00
parent bd39227f6d
commit 72a51bf1f9
8 changed files with 422 additions and 56 deletions
+25 -20
View File
@@ -5,6 +5,7 @@ import de.jeyp91.tippligaforum.MatchesListForumUpdater;
import de.jeyp91.tippliga.*;
import de.jeyp91.tippligaforum.TippligaConfigProvider;
import de.jeyp91.tippligaforum.TippligaSQLConnector;
import de.jeyp91.whatsapp.WhatsAppNotifier;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
@@ -43,46 +44,50 @@ public class App {
initOptions(args);
String sql = "";
String beautifulInfo = "";
switch(mode) {
case "MatchdaysUpdater":
switch (mode) {
case "MatchdaysUpdater" -> {
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(season, league, configFile);
sql = matchdaysUpdater.getUpdateSql();
beautifulInfo = matchdaysUpdater.getBeautifulInfo();
matchdaysUpdater.updateGoogleCalendar();
break;
case "MatchesCreatorFootball":
}
case "MatchesCreatorFootball" -> {
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, league, configFile);
sql = creator.getSQLInsertString();
break;
case "MatchesUpdaterFootball":
}
case "MatchesUpdaterFootball" -> {
TLWMatchesUpdaterFootball tlwMatchesUpdaterFootball = new TLWMatchesUpdaterFootball(season, league, configFile);
sql = tlwMatchesUpdaterFootball.getUpdateSQL();
beautifulInfo = tlwMatchesUpdaterFootball.getBeautifulInfo();
break;
case "MatchesResultsUpdater":
}
case "MatchesResultsUpdater" -> {
TLWMatchesResultsUpdater tlwMatchesResultsUpdater = new TLWMatchesResultsUpdater(season, league, configFile);
beautifulInfo = tlwMatchesResultsUpdater.getBeautifulInfo();
break;
case "TeamsUpdater":
}
case "TeamsUpdater" -> {
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(season, league, configFile);
sql = teamsUpdater.getInsertSQL();
break;
case "APIFootballUpdater":
}
case "APIFootballUpdater" -> {
APIFootballUpdater apiFootballUpdater = new APIFootballUpdater();
apiFootballUpdater.updateAllFixtures(season);
apiFootballUpdater.updateAllRounds(season);
break;
case "MatchesListGistUpdater":
}
case "MatchesListGistUpdater" -> {
MatchesListForumUpdater matchesListForumUpdater = new MatchesListForumUpdater(season);
matchesListForumUpdater.updateAllLeagues(season);
break;
case "PostChecksum":
}
case "PostChecksum" -> {
TippligaConfigProvider configProvider = new TippligaConfigProvider(season);
String checksum = configProvider.getChecksumOfConfigPost(configFile);
System.out.println(checksum);
break;
default:
break;
}
case "WhatsAppNotifier" -> {
WhatsAppNotifier notifier = new WhatsAppNotifier();
notifier.sendNotifications();
}
default -> {
}
}
if(!StatusHolder.getError() && !sql.equals("")) {
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
@@ -99,7 +104,7 @@ public class App {
parser.addArgument("-m", "--mode")
.dest("mode")
.choices("MatchdaysUpdater", "MatchesCreatorFootball", "MatchesUpdaterFootball", "MatchesResultsUpdater", "TeamsUpdater", "APIFootballUpdater", "MatchesListGistUpdater", "PostChecksum")
.choices("MatchdaysUpdater", "MatchesCreatorFootball", "MatchesUpdaterFootball", "MatchesResultsUpdater", "TeamsUpdater", "APIFootballUpdater", "MatchesListGistUpdater", "PostChecksum", "WhatsAppNotifier")
.help("")
.required(true)
.type(String.class);