Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

This changelog contains mostly API-Changes and changes for developers.

## v3.3.0
* Bumped and fixed dependencies
* Added code-hunt-module ([#60](https://github.com/SCNetwork/CustomDCBot/pull/60))
* Remove-Feature for status-roles module ([#61](https://github.com/SCNetwork/CustomDCBot/pull/61))
* Added color-me module ([#62](https://github.com/SCNetwork/CustomDCBot/pull/62))
* Added auto react for message authors ([#63](https://github.com/SCNetwork/CustomDCBot/pull/63))
* Added auto react for category-reactions
* Few new improvements, support for `commandsWarnings` config parameter

Contributors: [hfgd123](https://github.com/hfgd123), [scderox](https://github.com/scderox)


## v3.2.0
* Added support for timezone-config-parameter
* Bumped dependencies
* New modules: status-role, massrole
* Optimizations for the economy module

Contributors: [jateute](https://github.com/jateute/), [hfgd123](https://github.com/hfgd123), [scderox](https://github.com/scderox)

## v3.1.1
* Discord released their new way of editing slash-command-permissions ([read their blog](https://discord.com/blog/slash-commands-permissions-discord-apps-bots)), which made a lot of features basiclly usless:
* Commands can now only set a `defaultPermission` value
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ Every module has to contain a `module.json` file with the following content:
#### Interaction-Command

Note: Interaction-Commands get loaded after the configuration got checked.\
Note: Permissions for Slash-Commands have to be configured in the Server-Settings and will be checked by Discord.\
An interaction-command ("slash command") file has to export the following things:

* `run` (function; provided arguments: `interaction`):
Expand Down Expand Up @@ -225,17 +224,27 @@ An CLI-File should export the following things:

Note: All you CLI-Commands can also get executed via the API.

#### Config-Elements
Certain configuration may contain an array of multiple objects with different values - these are called "Config-Elements".

To add a new Config-Element to your configuration use `node add-config-element-object.js <Path to example config file> <Path to your config-file>`.

#### Example config-file

An example config file should include the following things:

* `filename`: Name of the generated config file
* `configElements` (boolean, default: false): If enabled the configuration-file will be an array of an object of the
content-fields
* `commandsWarnings`: This field is used to indicate, that users need to manually set up the permissions for commands in their discord-server-settings
* `normal`: Array of commands which that can be configured without any limitation in the discord-server-settings
* `special`: Array of commands that need special configuration in addition to editing the permissions in the server-settings
* `name`: Name of the command
* `info`: Key by language; Information about the command; used to explain users what exactly they should do
* `content`: Array of content fields:
* `field_name`: Name of the config field
* `default`: Default value
* `type`: Can be `channelID`, `select`, `roleID`, `boolean`, `integer`, `array`, `keyed` (codename for an JS-Object)
* `type`: Can be `channelID`, `select`, `timezone` (treated as string, please check validity before using), `roleID`, `boolean`, `integer`, `array`, `keyed` (codename for an JS-Object)
or `string`
* `description`: Short description of this field
* `allowEmbed` (if type === `array, keyed or string`): Allow the usage of an [embed](#configuration) (Note: Please
Expand All @@ -250,6 +259,7 @@ An example config file should include the following things:
* `description`: Description of the parameter (e.g. `Mention of the user`)
* `fieldValue` (only if type === `select`): If set, the parameter can only be used if the value of the field
is `fieldValue`.
* `isImage`: If true, users will be able to set this parameter as Image, Author-Icon, Footer-Icon or Thumbnail of an embed (only if `allowEmbed` is enabled)
* `allowNull` (default: `false`, optional): If the value of this field can be empty
* `disableKeyEdits` (if type === `keyed`): If enabled the user is not allowed to change the keys of this element

Expand Down
19 changes: 19 additions & 0 deletions add-config-element-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const args = process.argv.slice(2);
if (!args[0] || !args[1]) {
console.error('Wrong usage. node add-embedtype-object.js <Path to example file> <Path to config file>');
process.exit(1);
}

const jsonfile = require('jsonfile');
const exampleFile = jsonfile.readFileSync(args[0]);
let configFile = jsonfile.readFileSync(args[1]);
if (!Array.isArray(configFile)) configFile = [];

const newObject = {};
for (const field of exampleFile.content) {
newObject[field.field_name] = field['default-en'] || field.default;
}

configFile.push(newObject);
jsonfile.writeFileSync(args[1], configFile, {spaces: 2});
console.log('Successfully added default object to configuration-file.');
9 changes: 9 additions & 0 deletions config-generator/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
"off"
]
},
{
"field_name": "timezone",
"humanname-en": "Timezone",
"humanname-de": "Zeitzone",
"default": "Europe/Berlin",
"type": "timezone",
"description-en": "Timezone the bot runs in",
"description-de": "Zeitzone in der der Bot laufen soll"
},
{
"field_name": "logChannelID",
"allowNull": true,
Expand Down
38 changes: 38 additions & 0 deletions default-locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@
"reload-failed-message": "**FAILED**\n```%r```\n**Please read your log to find more information**\nThe bot will kill itself now, bye :wave:",
"command-description": "Reloads the configuration"
},
"hunt-the-code": {
"admin-command-description": "Manage the current Code-Hunt",
"create-code-description": "Create a new code for the current code-hunt",
"display-name-description": "Name of the code that will be displayed to user when they redeem the code",
"code-description": "Set the code that will be used to redeem it (default: randomly generated)",
"code-created": "Code \"%displayName\" successfully created: \"%code\"",
"error-creating-code": "Error creating code \"{{displayName}}\". Maybe the entered code is already in the database?",
"successful-reset": "Successfully ended the current Code-Hunt-Game - [here](%url)'s your report - save the URL if you want to access it later.",
"end-description": "Ends the current Code-Hunt (will clear users and codes and generates a report)",
"command-description": "Redeem or see data about the current Code-Hunt",
"redeem-description": "Redeem a code you found",
"code-redeem-description": "The code you want to redeem",
"leaderboard-description": "See the current leaderboard",
"profile-description": "See your current count of found codes",
"no-codes-found": "No codes redeemed yet ):",
"no-users": "No users redeemed codes yet ):",
"report-header": "Report for the Hunt-The-Code game on %s",
"user-header": "Participating users",
"code-header": "Codes",
"report-description": "Generates a report",
"report": "You can find the report [here](%url)."
},
"config": {
"checking-config": "Checking configurations...",
"done-with-checking": "Done with checking. Out of %totalModules modules, %enabled were enabled, %configDisabled were disabled because their configuration was wrong.",
Expand Down Expand Up @@ -374,6 +396,22 @@
"all-users": "All Users",
"bots": "Bots",
"humans": "Humans"
},
"status-role": {
"fulfilled": "Status-role condition is fulfilled",
"not-fulfilled": "Status-role condition is no longer fulfilled"
},
"color-me": {
"create-log-reason": "%user redeemed their boosting-rewards by requesting the creation of this role",
"edit-log-reason": "%user edited their boosting-reward-role",
"delete-unboost-log-reason": "%user stopped boosting, so their role got deleted",
"delete-manual-log-reason": "%user deleted their role manually",
"command-description": "Request a Custom role as a reward for boosting. This has a cooldown of 24 hours",
"manage-subcommand-description": "Create or edit your custom role",
"name-option-description": "The name of your custom role",
"color-option-description": "The color of your custom role",
"remove-subcommand-description": "Remove your custom role",
"confirm-option-remove-description": "Do you really want to delete your custom role? This will not reset any running cooldowns"
}
}
}
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ const commands = [];

// Starting bot
db.authenticate().then(async () => {
if (config.timezone !== process.env.TZ) {
process.env.TZ = config.timezone;
logger.info(`Successfully set timezone to ${config.timezone}. The time is ${new Date().toLocaleString(client.locale)}.`);
}
if (scnxSetup) client.scnxHost = client.config.scnxHostOverwirde || 'https://scnx.app';
await loadModelsInDir('/src/models');
await loadModules();
Expand Down
19 changes: 7 additions & 12 deletions modules/admin-tools/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"filename": "config.json",
"humanname-de": "Konfiguration",
"humanname-en": "Configuration",
"content": [
{
"field_name": "stealemote_allowed_role_ids",
"humanname-en": "Allowed /stealemote-Roles",
"humanname-de": "Erlaubte Rollen für den /stealemote",
"default": [],
"type": "array",
"content": "roleID",
"description-en": "Roles which are allowed to use the /stealemote command",
"description-de": "Rollen die /stealemote nutzen dürfen"
}
]
"commandsWarnings": {
"normal": [
"/admin",
"/stealemote"
]
},
"content": []
}
4 changes: 3 additions & 1 deletion modules/admin-tools/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"config-example-files": [
"config.json"
],
"fa-icon": "fas fa-tools"
"tags": [
"administration"
]
}
4 changes: 3 additions & 1 deletion modules/auto-publisher/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"config-example-files": [
"config.json"
],
"tags": ["administration"]
"tags": [
"administration"
]
}
33 changes: 0 additions & 33 deletions modules/auto-react/config.json

This file was deleted.

59 changes: 59 additions & 0 deletions modules/auto-react/configs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"filename": "config.json",
"humanname-de": "Konfiguration",
"humanname-en": "Configuration",
"content": [
{
"field_name": "channels",
"humanname-de": "Kanäle",
"humanname-en": "Channels",
"default": {},
"type": "keyed",
"description-en": "Here you can add channels and the reactions in it (you can add multiple emojis with | between each one)",
"description-de": "Du kannst hier Kanal-IDs und die dazugehörigen Emojis eintragen (mehrere Emojis müssen mit einem | getrennt werden)",
"content": {
"key": "channelID",
"value": "string"
}
},
{
"field_name": "members",
"default": {},
"humanname-de": "Erwähnungen",
"humanname-en": "Mentions",
"type": "keyed",
"description-en": "Here you can add members and the reactions on their mentions of them (you can add multiple emojis with | between each one)",
"description-de": "Du kannst hier NutzerIDs und die dazugehörigen Emojis auf Erwähnungen dieser eintragen (mehrere Emojis müssen mit einem | getrennt werden",
"content": {
"key": "integer",
"value": "string"
}
},
{
"field_name": "authors",
"default": {},
"humanname-de": "Autoren",
"humanname-en": "Authors",
"type": "keyed",
"description-en": "Here you can add members and the reactions on their messages in it (you can add multiple emojis with | between each one)",
"description-de": "Du kannst hier NutzerIDs und die dazugehörigen Emojis auf deren Nachrichten eintragen (mehrere Emojis müssen mit einem | getrennt werden",
"content": {
"key": "integer",
"value": "string"
}
},
{
"field_name": "categories",
"humanname-de": "Kategorien",
"humanname-en": "Categories",
"default": {},
"type": "keyed",
"description-en": "Here you can add categories and the reactions in it (you can add multiple emojis with | between each one)",
"description-de": "Du kannst hier Kategorien und die dazugehörigen Emojis eintragen (mehrere Emojis müssen mit einem | getrennt werden)",
"content": {
"key": "channelID",
"value": "string"
}
}
]
}
27 changes: 27 additions & 0 deletions modules/auto-react/configs/replies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"filename": "replies.json",
"humanname-de": "Antworten",
"humanname-en": "Replies",
"configElements": true,
"content": [
{
"field_name": "members",
"default": "",
"humanname-de": "Nutzer",
"humanname-en": "User",
"type": "string",
"description-en": "Here you can add a member to be replied on mentions of them",
"description-de": "Du kannst hier einen Nutzer für Antworten auf Erwähnungen dessen eintragen"
},
{
"field_name": "reply",
"default": "",
"humanname-de": "Antwort",
"humanname-en": "Reply",
"type": "string",
"description-en": "Here you can add the reply message",
"description-de": "Du kannst hier die Antwort eintragen",
"allowEmbed": true
}
]
}
Loading