Flags - SuperSajuuk/hpsr-pb-bot GitHub Wiki

The flags system is used to deal with variable user argument data, in which arguments after a specific point in the endpoints are deemed to be "everything else" and parsed in a dynamic manner.

Flags allow all sorts of complex and dynamic behaviour: to the end user, they just use a bot command that calls the relevant endpoints and their input is parsed into the relevant output.

Below is a description of flags that users can define to modify specific outputs:

World Record

Called by: --world-record or --wr

This flag is used to return only the current world record in a specific game/platform/board combination. When defined, the flags --position and --player are ignored and aren't used.

Position

Called by: --position=, --pos= or --place=

This flag is used to find a run at a specific position on the leaderboard. Its an alternative to --player when the name of the runner at a specific position is not known, but you know that someone has a run at that position. When using this flag, the place number to look for is defined after the equals sign. For example:

  • --position=8 will find the run located at position 8

Player

Called by: --player= or --p=

This flag is used to find the run by a specifically named individual on the leaderboard. This is similar to --position, except it just looks for runs owned by the named player, regardless of its position. It's recommended to use --position if you don't know who has a run at a particular position, but if you know their name, this should work just fine.

Be aware that the name given in position must be the name used on speedrun.com: don't use Twitch usernames in this argument.

Example:

  • --player=supersajuuk will find a run by player "supersajuuk" on the leaderboard

Undefined arguments

Outside of the above flags, any values in the [flags] section of a command provided by a user will be collected into this system and parsed. This can include things like:

  • Category Extension sub-categories
  • Multirun sub-categories
  • LEGO metadata
  • Console/Emulator
  • Additional metadata outside of the defined arguments.

Note that any additional metadata in [flags] which doesn't match to anything will be stored in an additional_metadata flag internally: your input here may be ignored if it can't be mapped to anything.