FoxLisk / NMG-League-Bot

NMG League evil mastermind
https://nmg-league.foxlisk.com/
MIT License
0 stars 0 forks source link

helper bot to sync events #150

Closed FoxLisk closed 2 months ago

FoxLisk commented 4 months ago

Bydey asked for this and it seems kinda fun to build. The idea is to have a separate discord bot that people can invite to their servers to generate events. it'd also be nice to have a way for it to filter the events so people can, e.g., only get their own races

FoxLisk commented 4 months ago

implementation wise, my plan is to do something like this:

  1. have a new 'worker' thread that runs the new bot
    • maybe this is better if this code lives somewhere else? but hopefully it stays small enough for this to be sensible
  2. have a new queue for BracketRace IDs
  3. Everything that affects a race sends the ID of the affected race down the queue
  4. Worker bot creates/updates events appropriately

once this is in place, we can probably also leverage it to keep main discord events in sync

FoxLisk commented 4 months ago

ok i changed my mind. annotating everything that updates a race is stupid and liable to be hella buggy. given that cardinality is so tiny, we can just do routine scanning. something like

  1. every $INTERVAL (5min?), slurp up every raceinfo (join races + players i guess?)
  2. do some kind of function to turn this into the event content
  3. compare that with the stored version of the event content (if any)
  4. create or update events as necessary
FoxLisk commented 3 months ago

i dont even know what these comments meant anymore

we now have an asynchronous worker that effects correct event state based on looking at current events + looking at db state. it's only doing things in main discord now; the plan is to have it just also work in other discords. this mostly means a way to join other discord and then a worker that handles creating events in them. my plan is to have this be a separate discord bot so the main one can maintain its assumptions about being a 1-discord bot