Skip to content

Discord Bot

Important

The core must be built before running the bot.

Configuration File¤

The database and API can run out of the box without any configuration file, by using the defaults. However, running the discord bot/building the frontend will require you to provide custom config.

To do this, rename ./config.example.json to ./config.json and modify it. Then, run:

python3 -m src.am4 cfg set config.json
This will verify and persist the settings to ./src/am4/.config.json, which is used in future calls.

Database¤

User authentication is handled by pocketbase, a lightweight SQLite-based backend supporting OAuth2.0.

It is automatically started before the API/discord bot when using the CLI.

Discord bot¤

It is similar to the API in design, but is more sophisticated in that it reads users' roles to determine their game mode.

To start it, use:

python3 -m src.am4 start bot

Documentation for legacy code, click to expand.

Code here - src-old: the very first iteration of the discord bot. - src-v2-v3: my first attempts at rewriting in C/Cython

Features¤

Old bot:

  • calculates essential statistics
    • most distance-efficient stopovers
    • route demands, best seat configurations, best ticket prices, estimated income
    • player rank, mode, achievements, fleet
    • alliance rank, share value, contribution
    • aircraft characteristics and profit
    • airport characteristics
  • CSV export for route queries
  • fuel/CO2 notifications
  • aircraft characteristics comparisons
  • internal Star Alliance tools (now disbanded)
    • adding competitor alliances to watchlist
    • alliance comparisons over time: value,contribution/day, rate of changes
    • realtime alliance-member comparisons: SV/contribution distribution
    • member tracking: cheat detection tools, departure pattern identification

Public¤

  • $route|stop <airport> <airport> <aircraft> [flights_per_day] [reputation]: finds the best route between two airports

route

  • $routes <airport> <aircraft> <max_distance> <flights_per_day> [reputation]: finds the best destinations from a certain airport, sorted by decreasing estimated income

routes

  • $user [player]: shows player (and associated alliance if found) statistics

user

  • $fleet [player]: shows player fleet and estimated income

fleet

  • $info <aircraft>: shows basic aircraft information and rough profit estimations

info

  • $compare <aircraft>: compares two aircrafts

compare

  • $search <aircraft>: finds the associated aircraft shortname for aircraft commands

search

  • $airport <airport>: shows airport information

airport

  • $price f[fuel_price] c[co2_price]: notifies everyone for the fuel price

price

Internal Alliance Tools¤

  • $memberCompare <player> <player>: compares descending structure of contribution/day and SV

member-compare - $alliance <alliance>: shows AV progression and d(AV)/dt.

alliance - $allianceCompare <alliance> <alliance>: compares AV progression and gap difference over time, shows 48h/12h-average contribution/day graphs

alliance-compare - $member <player> [player[]] shows contribution/day, total contribution and SV history for 1+ members

member - $actions <player> [maxResults]: shows log of estimated departures, contributions and income

member-compare - $watchlist [add|+, remove|rm|-] [alliance]: shows, adds or remove alliance(s) to the watchlist