OhDearMoshe / discord-paketliga

We do not talk about delivery dates
0 stars 0 forks source link

Pretty much all of the work here was actually done by https://github.com/christiantowb who deff deserves all credit

PKL - Paketliga for Discord

img.png

PKL is a bot for guessing package delivery.

Usage

Replace the placeholder in .env file, namely the BOT_TOKEN, SERVER_ID,POSTGRES_USERNAME, POSTGRES_JDBC_URL and POSTGRES_PASSWORD. As this is not a global bot (for now?) and we haven't really configure it to have different database for different servers, then the settings should really be personalised for each server that is going to use the bot, hence, different database as well.

Afterwards, just run up Main.kt and the bot will be good to go.

Local running

Assuming you are using the docker compose file configs for postgres you can use the following command to run the migration ./gradlew flywayMigrate -Dflyway.url=jdbc:postgresql://127.0.0.1:666/PKL -Dflyway.user=mypreciousadmin -Dflyway.password=localtestingonlypassword -Dflyway.locations=filesystem:migrations

Commands

Note: Any time-related parameters are equipped with Natural Language date/time parser. While it is possible to just go with "18:00" as input, the bot would prefer a much verbose input. Here are some examples:

List of available commands goes below.

/paketliga

Create a PKL game, with parameters:

/findgames

Find active game(s), with parameters:

Leaving all the parameters empty will resulted in the bot listing all active games.

/guessgame

Guess an active game, with parameters:

Guessing a game twice with same game from a same user will resulted in updated guess instead of a new one.
Guessing a game with guess time outside delivery window will resulted in failed command.

/findguess

Find guess(es) from game(s), with parameters:

Leaving all the parameters empty will resulted in empty response (for now)

/updategame

Update an active game, with parameters:

Leaving all optional parameters empty will resulted in no games to be updated.
Updating a game will resulted in all guessers to be notified (if any) to update their guesses.

/endgame

End an active game, with parameters:

Ending a game with delivery time outside the window will resulted in failed command. Ending a game will notify the winning guessers.

/leaderboard

Show leaderboard sorted by total points descending, with parameters:

Leaving the parameter empty will resulted in all (played) users to be shown. The fields shown are: played, win, lost, and total points.

Contributing / Bug report

Please open an Issue / PR, and we'll address it soon.

Credits

To Chris, who did the hard bits To Mike, who bitched this into existence