Running keys

Importing keys

Keys go into a pool in bulk, from a file you upload. Three formats are accepted. Getting the format right matters, because a misread file imports the wrong strings as keys.

Supported formats

ExtensionExpected contents
.txtOne key per line. Recommended. Nothing is interpreted, so what you upload is what you get.
.jsonA single top-level array of key strings.
.csvThe first column of every row is taken as the key. Every other column is discarded.

KeyBot decides which parser to use from the file extension alone, not from the contents. The extension is matched case-insensitively, so keys.TXT and keys.txt behave the same. Any other extension is rejected before anything is read.

.txt

One key per line. Leading and trailing whitespace on each line is trimmed, and blank lines are ignored, so a trailing newline at the end of the file is fine.

AAAAA-BBBBB-CCCCC
DDDDD-EEEEE-FFFFF
GGGGG-HHHHH-JJJJJ

.json

The file must be a top-level array of strings. Not an object, and not an array of objects. Each value is trimmed, and empty values are dropped.

["AAAAA-BBBBB-CCCCC", "DDDDD-EEEEE-FFFFF", "GGGGG-HHHHH-JJJJJ"]
Anything other than a top-level array will failA JSON file shaped like { "keys": [...] }, or an array of objects such as [{ "key": "..." }], is not understood and the import is refused. Flatten it to a plain array of strings, or save it as a .txt file instead.

.csv

Only the first column of each row is used. Everything after the first comma on a line is thrown away, which makes it safe to upload a spreadsheet export that carries extra columns you do not need.

key,assigned_to,notes
AAAAA-BBBBB-CCCCC,,first batch
DDDDD-EEEEE-FFFFF,,first batch

The rules, precisely:

  • The value is the text before the first comma on the line, trimmed. A single pair of surrounding double quotes is removed.
  • A header row is skipped only on the very first line of the file, and only when its first cell is exactly key, keys, code, or codes, ignoring case. Any other header, such as Steam Key, is treated as a key and imported.
  • Blank lines are ignored.
  • Commas inside a quoted value are not handled. If a key can contain a comma, do not use CSV, use .txt.

What happens when you import

  • KeyBot reads the file and shows you how many keys it found, then asks you to confirm. Nothing is written until you confirm.
  • Keys the pool already contains are skipped, and the count of skipped duplicates is reported back to you. Re-uploading a file that overlaps a previous import is therefore safe.
  • If every key in the file is already in the pool, nothing is imported and KeyBot tells you so.
  • A successful import clears the pool's low-stock and empty warning flag, so the next time the pool runs low you are warned again.
  • The import is recorded in your server's log channel, if one is configured, with the pool name and the number of keys added.
Duplicates inside one file are not removedThe duplicate check compares your file against the keys already in the pool. It does not de-duplicate the file against itself, so the same key listed twice in one upload is imported twice, and can be handed to two people. Remove repeats before uploading.

Practical notes

  • Keys are stored exactly as they appear in the file, so stray spaces inside a key, or an invisible character pasted from a spreadsheet, will be handed to a member as part of the key.
  • Keys go into one pool per import. To load two games, create two pools and import into each.
  • Imports are limited by Discord's attachment size limit for whichever account uploads the file. For very large batches, split the file and import it in several passes; duplicates across the passes are skipped anyway.
  • Exporting gives you back the unclaimed keys from a pool as a .txt file, one per line, which is the same format you can re-import.