WaifuHarem / discord-bot

Discord bot that uses OCR to capture data in results screens
0 stars 0 forks source link

AddScore Command #3

Open Lightseypoo opened 4 years ago

Lightseypoo commented 4 years ago

AddScoreData [game] [options] {score data} AddScore [game] [options] [filepath]

optional flags: -t = Flag for training. Training flag also requires either a local or online path to the screenshot the scoredata came from. -q = Flag score as Quarantined when being sent to server backend.

Training flag is low priority relative to the rest of the issue.

Addscore will serve as an administrator only command that allows for the manual addition of scores to the leaderboards when screenshot parsing fails. Can be added from either copy pasted JSON or from a file saved on the backend. Training takes a screenshot with the data to use for the purpose of training the neural network powering the OCR. Quarantined scores will be ignored in ranking calculations until approved.

FFR ScoreData Schema

{
    "date": "number",
    "player": "string",
    "title": "string",
    "artist": "string",
    "creator": "string",
    "combo": "number",
    "w0": "number",
    "w1": "number",
    "w2": "number",
    "w3": "number",
    "w4": "number",
    "w5": "number",
    "equiv": "number",
    "raw": "number"
  }

The requests sent to the backend must be formatted the same way as if the score was obtained normally.

abraker95 commented 4 years ago

Training on server might not be feasible actually. It's too of a computationally expensive operation.

Lightseypoo commented 4 years ago

we can skip that aspect of the command and then just train manually as nessecary, i suppose.

abraker95 commented 4 years ago

Command syntax >>addscore [optional:q] [required:gid] [required:data]

Usage example >>addscore -q -gid 2 -data ./score.json

Description: Adds a score into db

arg1: q

arg2: gid

arg3: data

Lightseypoo commented 4 years ago

One final thing to mention on this. The manual addscore command and the screenshot detection based addscore use the same opcode, however a regular user should not be permitted to use the manual command. To solve this vulnerability, I'd like to include the addition of a top-level member called "auth", which is followed by an int. this acts as an auth override from what is stored in the backend.

A more detailed explanation of this concept will be in included in the server request docs which i will link in this issue upon completion