From 6323134285cc40c4ef8857ed10d7bbf3a0efd650 Mon Sep 17 00:00:00 2001 From: Noi Date: Sun, 4 Dec 2022 17:09:41 -0800 Subject: [PATCH] Update config schema and example --- ConfigurationSchema.json | 44 +++++++++++++++++++++++++++++++ DefaultGuildConfig.json | 45 ------------------------------- SampleConfiguration.json | 57 ++++++++++++++++++++++++++++++++++++++++ ServerConfigSchema.json | 21 --------------- 4 files changed, 101 insertions(+), 66 deletions(-) create mode 100644 ConfigurationSchema.json delete mode 100644 DefaultGuildConfig.json create mode 100644 SampleConfiguration.json delete mode 100644 ServerConfigSchema.json diff --git a/ConfigurationSchema.json b/ConfigurationSchema.json new file mode 100644 index 0000000..6c126e3 --- /dev/null +++ b/ConfigurationSchema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "BotToken": { + "type": "string", + "description": "The token used by the bot to connect to Discord." + }, + "Assemblies": { + "type": "array", + "description": "A list of additional files to be loaded to extend the bot's functionality.", + "default": [ "RegexBot.dll" ] + }, + "DatabaseOptions": { + "type": "object", + "description": "A set of options for the SQL database connection.", + "properties": { + "Host": { + "type": "string", + "description": "The SQL host, whether a hostname, IP address, or path to a socket." + }, + "Database": { + "type": "string", + "description": "The target SQL database name to connect to, if different from the default." + }, + "Username": { + "type": "string", + "description": "The username used for SQL server authentication." + }, + "Password": { + "type": "string", + "description": "The password used for SQL server authentication." + } + }, + "required": [ "Username", "Password" ] + }, + "Servers": { + "type": "object", + "description": "A collection of server configurations with keys representing server IDs and values containing the respective server's configuration." + /* TODO unfinished */ + } + }, + "required": [ "BotToken", "DatabaseOptions", "Servers" ] +} \ No newline at end of file diff --git a/DefaultGuildConfig.json b/DefaultGuildConfig.json deleted file mode 100644 index 07ddb10..0000000 --- a/DefaultGuildConfig.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/NoiTheCat/RegexBot/main/ServerConfigSchema.json", - "Name": "SERVER NAME", // Server name is optional, but useful as a reference - "Moderators": [ - // Users and roles are accepted here. - "MODERATOR" - ], - - /* - The following configuration is provided as a sample for commonly-used features. - For a detailed reference which includes all possible configuration settings, see: - (TODO put documentation link here) - */ - "RegexModerator": [ - { - "Label": "No cheese", - "Regex": "cheese", - "Response": [ - "say #_ You can't say that, that's illegal", - "delete" - ] - }, - { - "Label": "Secret club initiation", - "Regex": "my name is .* and I dislike cheese", - "Response": [ - "say @_ We welcome you.", - "addrole &00000::Secret Club member" - ] - } - ], - - "AutoResponder": [ - { - "Label": "Infinite no u", - "Regex": "no u", - "Reply": "no u" - }, - { - "Label": "Acknowledge praise", - "Regex": "yes u", - "Reply": ":blush:" - } - ] -} \ No newline at end of file diff --git a/SampleConfiguration.json b/SampleConfiguration.json new file mode 100644 index 0000000..48c5564 --- /dev/null +++ b/SampleConfiguration.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://raw.githubusercontent.com/NoiTheCat/RegexBot/main/ConfigurationSchema.json", + + "BotToken": "12345678901234567890qwertyuiop.1234567890", + //"Assemblies": [ "RegexBot.dll" ], + "DatabaseOptions": { + "Username": "regexbot", + "Password": "regexbot" + }, + + "Servers": { + "00000000": { // Place server ID here + "Name": "SERVER NAME", // Server name is unused by the bot, but is useful as a reference. + "Moderators": [ + // Users and roles are accepted here. + "MODERATOR" + ], + + /* + The following configuration is provided as a sample for commonly-used features. + For a detailed reference which includes all possible configuration settings, see + this project's documentation. + */ + "RegexModerator": [ + { + "Label": "No cheese", + "Regex": "cheese", + "Response": [ + "say #_ You can't say that, that's illegal", + "delete" + ] + }, + { + "Label": "Secret club initiation", + "Regex": "my name is .* and I (hate|dislike) cheese", + "Response": [ + "say @_ We welcome you.", + "addrole &00000::Secret Club member" + ] + } + ], + + "AutoResponder": [ + { + "Label": "Infinite no u", + "Regex": "no u", + "Reply": "no u" + }, + { + "Label": "Acknowledge praise", + "Regex": "yes u", + "Reply": ":blush:" + } + ] + } + } +} \ No newline at end of file diff --git a/ServerConfigSchema.json b/ServerConfigSchema.json deleted file mode 100644 index ec2f8ad..0000000 --- a/ServerConfigSchema.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "properties": { - "Name": { - "type": "string", - "description": "The server's name. The value is unused by the application and is only for user reference." - }, - "Moderators": { - "type": "array", - "description": "A list of entities which the bot should recognize as moderators.", - "items": { - "type": "string" - } - } - /* schema still a work in progress */ - }, - "required": [ - "Moderators" - ] -} \ No newline at end of file