Skip to content

Commit

Permalink
Add support for specifying the bot engine
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed May 18, 2023
1 parent c5cdba5 commit 211ccda
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions schema/Config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"type": "string",
"description": "API key for the bot."
},
"engine": {
"type": "string",
"description": "Engine specifier of the bot, this is a plain text description of the bot's engine and network that will be recorded along with all games played."
},
"verbosity": {
"type": "number",
"description": "Enable verbose logging.",
Expand Down
3 changes: 3 additions & 0 deletions src/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,9 @@ export class Game extends EventEmitter<Events> {
if (config.greeting?.en) {
this.sendChat(config.greeting);
}
if (config.engine) {
this.sendChat({ en: `Engine: ${config.engine}`, engine: config.engine });
}
}

const doing_handicap =
Expand Down
7 changes: 7 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export interface Config {
/** API key for the bot. */
apikey: string;

/** Engine specifier of the bot, this is a plain text description of the
* bot's engine and network that will be recorded along with all games
* played. */
engine?: string;

/** Enable verbose logging.
* @values 0-2
* @default 0
Expand Down Expand Up @@ -532,6 +537,7 @@ function load_config_or_throw(): Config {
)
.alias("disable-status-updates", "q")
.describe("apikey", "API key for the bot")
.describe("engine", "Version of the bot engine being used")
.describe("v", "Increase level (use multiple times for more logs)")
.count("v")
.strict()
Expand All @@ -548,6 +554,7 @@ function load_config_or_throw(): Config {
apikey: args.apikey,
verbosity: args.v || undefined,
disable_status_updates: args.q || false,
engine: args.engine,
};

let cli_bot_command = args._.length > 0 ? args._ : undefined;
Expand Down

0 comments on commit 211ccda

Please sign in to comment.