GithubHelp home page GithubHelp logo

lemmy-nhl-gdt-bot's People

Contributors

dandroid126 avatar yo-scottie-oh avatar

Watchers

 avatar

lemmy-nhl-gdt-bot's Issues

Add db versioning and upgrade functionality

When new columns need to be added to the DB, this currently must be done manually (yuck!). There should be a db version constant that gets updated every time the db changes. And when this version changes, the db upgrade code should be run. This will probably need a table to track the db version, so this should probably be done sooner rather than later.

Fix "goalie" column being empty

Since the big NHL API update during the preseason, the goalie that was in net is no longer easily accessible. Either figure out a way to get this data, or remove the column.

Feature request: Configurable time to post the thread

Currently, with single-post setup (one game per post), the software will not create a thread for the game until 1 hour before puck drop. I suggest making this configurable.

Personally, I'd generally want the post to be created early in the day at a set time, such as 8 a.m. local time. I might be in the minority on this, though.

However, an easier option in the interim would be a configurable number of hours, such as 6 hours before puck drop.

Add Penalties detail table

Example:

Period Time Team Type Min Description
3rd 09:05 VGK Minor 2 Jack Eichel Roughing against Vincent Desharnais
3rd 07:57 EDM Minor 4 Warren Foegele High-sticking - double minor against Ben Hutton
2nd 19:36 VGK Major 5 Keegan Kolesar Boarding against Mattias Ekholm served by William Carrier
2nd 19:36 VGK Game Misconduct 10 Keegan Kolesar Game Misconduct
2nd 13:33 EDM Minor 2 Mattias Janmark High-sticking against Jack Eichel
2nd 12:49 EDM Minor 2 Philip Broberg Holding against Jack Eichel
1st 17:12 EDM Minor 2 Philip Broberg Holding against Brett Howden
1st 14:09 EDM Minor 2 Kailer Yamamoto Interference against Teddy Blueger
1st 09:14 VGK Minor 2 Nicolas Hague Tripping against Warren Foegele
1st 03:52 EDM Bench Minor 2 Delaying Game - Unsucc. chlg served by Zach Hyman
1st 01:10 VGK Minor 2 Reilly Smith Hooking against Evan Bouchard

Add error handling

The bot shouldn't crash if there is a mistake on the API end. All dictionary accesses should either be in a try/catch or be a safe call. All values in data classes should have default values in case anything fails to be fetched from the API data for whatever reason. The default values should indicate that an error has occurred.

Add goal details table

Example:

Period Time Team Strength Description
3rd 02:40 EDM Power Play Connor McDavid (7) Wrist Shot, assists: Evan Bouchard (13)
2nd 15:34 VGK Even Nicolas Hague (1) Slap Shot, assists: Jack Eichel (7), Jonathan Marchessault (5)
2nd 14:34 VGK Power Play Reilly Smith (1) Batted, assists: Ivan Barbashev (3), William Karlsson (3)
2nd 14:05 VGK Power Play Mark Stone (5) Wrist Shot, assists: Jack Eichel (6), Jonathan Marchessault (4)
1st 09:56 EDM Power Play Zach Hyman (3) Deflected, assists: Ryan Nugent-Hopkins (9), Evan Bouchard (12)
1st 03:52 VGK Even Jack Eichel (6) Wrist Shot, assists: Alec Martinez (2), Jonathan Marchessault (3)
1st 03:02 EDM Power Play Connor McDavid (6) Wrist Shot, assists: Ryan Nugent-Hopkins (8), Zach Hyman (8)

Seems to fail reading the schedule

Trying to run this on docker under Debian Linux for the Caps community. I actually had it working once, it posted a GDT, but I deleted the post because I had it set to do comments instead of posts for the GDTs. Since then, no luck with either setting. Here's what's happening when I run it:

user@system:~/lemmy-nhl-gdt-bot$ sudo docker run --rm --name lemmy-nhl-gdt-bot -v ./.env:/app/.env -v ./out:/app/out ghcr.io/dandroid126/lemmy-nhl-gdt-bot:main

Apr 13 11:04:31 nhl-gameday-bot [1]: [INFO] [EnvironmentUtil] Environment loaded

Apr 13 11:04:31 nhl-gameday-bot [1]: [INFO] [DbManager] init(): Connection to SQLite DB successful

Apr 13 11:04:31 nhl-gameday-bot [1]: [INFO] [DbManager] get_db_schema_version(): executing: SELECT version FROM db_schema WHERE rowid = '0'

Apr 13 11:04:32 nhl-gameday-bot [1]: [DEBUG] Starting new HTTPS connection (1): lemmy.world:443

Apr 13 11:04:32 nhl-gameday-bot [1]: [DEBUG] https://lemmy.world:443 "GET /nodeinfo/2.0.json HTTP/1.1" 200 None

Apr 13 11:04:32 nhl-gameday-bot [1]: [INFO] Connected succesfully to Lemmy v0.19.3 instance https://lemmy.world

Apr 13 11:04:32 nhl-gameday-bot [1]: [INFO] Requesting API Request.POST /user/login

Apr 13 11:04:32 nhl-gameday-bot [1]: [DEBUG] Starting new HTTPS connection (1): lemmy.world:443

Apr 13 11:04:34 nhl-gameday-bot [1]: [DEBUG] https://lemmy.world:443 "POST /api/v3/user/login HTTP/1.1" 200 None

Apr 13 11:04:34 nhl-gameday-bot [1]: [INFO] Requesting API Request.GET /community

Apr 13 11:04:34 nhl-gameday-bot [1]: [DEBUG] Starting new HTTPS connection (1): lemmy.world:443

Apr 13 11:04:34 nhl-gameday-bot [1]: [DEBUG] https://lemmy.world:443 "GET /api/v3/community?name=caps%40lemmy.world HTTP/1.1" 200 None

Apr 13 11:05:04 nhl-gameday-bot [1]: [INFO] [nhl_api_client.py] get_schedule(): url: https://api-web.nhle.com/v1/schedule/2024-04-12

Apr 13 11:05:04 nhl-gameday-bot [1]: [DEBUG] Starting new HTTPS connection (1): api-web.nhle.com:443

Apr 13 11:05:04 nhl-gameday-bot [1]: [DEBUG] https://api-web.nhle.com:443 "GET /v1/schedule/2024-04-12 HTTP/1.1" 200 None

Apr 13 11:05:34 nhl-gameday-bot [1]: [INFO] [nhl_api_client.py] get_schedule(): url: https://api-web.nhle.com/v1/schedule/2024-04-12

Apr 13 11:05:34 nhl-gameday-bot [1]: [DEBUG] Starting new HTTPS connection (1): api-web.nhle.com:443

Apr 13 11:05:34 nhl-gameday-bot [1]: [DEBUG] https://api-web.nhle.com:443 "GET /v1/schedule/2024-04-12 HTTP/1.1" 200 None

I.e., it just keeps rereading the schedule. I can go to that URL and get the schedule, so I'm not sure why it's struggling.

I tried killing it, removing the image, deleting everything in out/, and restarting, and it's not helping.

.env file:

BOT_NAME=xyz

PASSWORD=***

LEMMY_INSTANCE=lemmy.world

COMMUNITY_NAME=[email protected]

COMMENT_POST_TYPES=

GDT_POST_TYPES=PRESEASON,REGULAR,POSTSEASON,ALLSTAR

TEAMS is optional. If omitted, all teams will be used.

TEAMS=WSH

I'd appreciate any suggestions!

Occasional crashing is occurring when running as a systemd service

Every few hours the systemd service restarts. Need to enhance logging to include stdout in the log files to figure out why it is crashing. Need to fail gracefully when an issue occurs.

Also need to tee logs to stdout/stderr, as systemd and podman won't get them otherwise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.