diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a26ddc6..2b5c1466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ This changelog contains mostly API-Changes and changes for developers. +## v3.6.0 +* Support for configuration-example-file `content.elementToggle` toggle to improve UX in the SCNX Dashboard ([#76](https://github.com/SCNetwork/CustomDCBot/pull/76)) +* Support for configuration-example-file `content.dependsOn` toggle to improve UX in the SCNX Dashboard ([#76](https://github.com/SCNetwork/CustomDCBot/pull/76)) +* Support for new field-types: `userID`, `imgURL` ([#76](https://github.com/SCNetwork/CustomDCBot/pull/76)) +* Moderation-Modul: Support for Channel-Mutes ([#77](https://github.com/SCNetwork/CustomDCBot/pull/77)) +* Channel-Stats-Modul: Support for userWithRole parameters ([#78](https://github.com/SCNetwork/CustomDCBot/pull/78)) + ## v3.5.0 * Like ten new previously closed-sourced-modules got added * Locales-Loading now takes place in splitted files, instead of a big `default-locales.json` diff --git a/README.md b/README.md index 6d4da95d..75344cd8 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,18 @@ information about that in [this issue](https://github.com/SCNetwork/CustomDCBot/ As mentioned above our business model is to host these bots for servers - it does not really make sense to publish our product here - but we do it anyway - but we need your support! Feel free to [contribute](.github/CONTRIBUTING.md) -, [get a membership](https://membership.sc-network.net) (also on [Patreon](https://patreon.com/scnetwork)), or donate [via Creditcard](https://scnx.app/scam) or [PayPal](https://paypal.me/therealscderox). Thank you so much <3 +, [get a membership](https://membership.sc-network.net) (also on [Patreon](https://patreon.com/scnetwork)), or +donate [via Creditcard](https://scnx.app/scam) or [PayPal](https://paypal.me/therealscderox). Thank you so much <3 ## Need help? -Are you stuck? Please do not ask on our Discord (unless you are using our hosted version), instead ask in the [discussions-tab](https://github.com/SCNetwork/CustomDCBot/discussions). + +Are you stuck? Please do not ask on our Discord (unless you are using our hosted version), instead ask in +the [discussions-tab](https://github.com/SCNetwork/CustomDCBot/discussions). ## Need something even more custom? -We are happy to give you a quote for individual requirements. Please email `sales@sc-network.net` with your requirements. + +We are happy to give you a quote for individual requirements. Please email `sales@sc-network.net` with your +requirements. ### Table of contents @@ -207,7 +212,8 @@ An interaction-command ("slash command") file has to export the following things * `description`: Description of the command * `restricted`: Can this command only be run one of the bot operators (e.g. config reloading, change status or ..., boolean) - * `defaultPermission`: Boolean (default: true): If enabled everyone on the guild can use this command and your command's permissions can not be synced + * `defaultPermission`: Boolean (default: true): If enabled everyone on the guild can use this command and your + command's permissions can not be synced * `options`: * [ApplicationCommandOptionData](https://discord.js.org/#/docs/main/stable/typedef/ApplicationCommandOptionData) OR @@ -272,7 +278,7 @@ An example config file should include the following things: * `field_name`: Name of the config field * `default-`: Default value of this field (replace `` with a supported language code), Fallback-Order: `default-`, `default-en`, `default` - * `type`: Can be `channelID`, `select`, `timezone` (treated as string, please check validity before using), `roleID` + * `type`: Can be `channelID`, `userID`, `imgURL`, `select`, `timezone` (treated as string, please check validity before using), `roleID` , `boolean`, `integer`, `array`, `keyed` (codename for an JS-Object) or `string` * `description-`: Description of this field (replace `` with a supported language code), @@ -300,7 +306,9 @@ An example config file should include the following things: * `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 + * `disableKeyEdits` (if type === `keyed`): If enabled the user can not edit the keys of the object + * `elementToggle` (if type === `boolean`): If this option gets turned off, other fields of the config-element / file will not be rendered in the dashboard + * `dependsOn` (a name of any (other) boolean-field): If the referenced boolean field (the value of this option should be equal to the `field.field_name` of a boolean field) is turned off, the field will be not be rendered in the dashboard #### `botReady`-Event and Config-Reload diff --git a/locales/de.json b/locales/de.json index 04c2668e..e654f8b5 100644 --- a/locales/de.json +++ b/locales/de.json @@ -66,6 +66,7 @@ "moduleconf-regeneration": "Modul-Konfiguration wird regeniert, es werden keine Einstellungen überschrieben.", "moduleconf-regeneration-success": "Module-Konfiguration wurde regeniert.", "channel-not-found": "Kanal mit ID \"%id\" wurde nicht gefunden", + "user-not-found": "Discord-Account mit ID \"%id\" wurde nicht gefunden", "channel-not-on-guild": "Kanal mit ID \"%id\" ist nicht auf deinem Server", "role-not-found": "Rolle mit ID \"%id\" wurde nicht auf deinem Server gefunden", "config-reload": "Gesamte Konfiguration wird neugeladen...", @@ -827,4 +828,4 @@ "remove-subcommand-description": "Entferne deine Custom Rolle", "confirm-option-remove-description": "Willst du deine Custom Rolle wirklich löschen? Dies wird keine laufenden Cooldowns zurücksetzen" } -} +} \ No newline at end of file diff --git a/locales/en.json b/locales/en.json index 48b54b61..bb60272b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -64,6 +64,7 @@ "moduleconf-regeneration": "Regenerating module configuration, no settings will be overwritten, don't worry.", "moduleconf-regeneration-success": "Module configuration regeneration successfully finished.", "channel-not-found": "Channel with ID \"%id\" could not be found", + "user-not-found": "Discord-User with ID \"%id\" could not be found", "channel-not-on-guild": "Channel with ID \"%id\" is not on your guild", "channel-invalid-type": "Channel with ID \"%id\" has a type that can not be used for this field", "role-not-found": "Role with ID \"%id\" could not be found on your guild", diff --git a/modules/fun/config.json b/modules/fun/config.json index 5ea53134..660c07fd 100644 --- a/modules/fun/config.json +++ b/modules/fun/config.json @@ -132,7 +132,7 @@ "https://media1.tenor.com/images/fd47e55dfb49ae1d39675d6eff34a729/tenor.gif?itemid=12687187" ], "type": "array", - "content": "string", + "content": "imgURL", "humanname-de": "Umarmungsbilder", "description-de": "Bilder aus welchen, wenn jemand /hug ausführt, zufällig ausgewählt wird", "params-de": {}, @@ -189,7 +189,7 @@ "https://media1.tenor.com/images/78095c007974aceb72b91aeb7ee54a71/tenor.gif?itemid=5095865" ], "type": "array", - "content": "string", + "content": "imgURL", "humanname-de": "Kussbilder", "description-de": "Bilder aus welchen, wenn jemand /kiss ausführt, zufällig ausgewählt wird", "params-de": {}, @@ -248,7 +248,7 @@ "https://media1.tenor.com/images/03ea2379718496fbbd144c5bc50f8e96/tenor.gif?itemid=18908545" ], "type": "array", - "content": "string", + "content": "imgURL", "humanname-de": "Schlag-Bilder", "description-de": "Bilder aus welchen, wenn jemand /slap ausführt, zufällig ausgewählt wird", "params-de": {}, @@ -308,7 +308,7 @@ "https://media1.tenor.com/images/be0c22e0af951aa7fa8753381663eb2c/tenor.gif?itemid=15824856" ], "type": "array", - "content": "string", + "content": "imgURL", "humanname-de": "Tätschel-Bilder", "description-de": "Bilder aus welchen, wenn jemand /pat ausführt, zufällig ausgewählt wird", "params-de": {}, diff --git a/modules/moderation/configs/antiJoinRaid.json b/modules/moderation/configs/antiJoinRaid.json index e774b210..3366bcf1 100644 --- a/modules/moderation/configs/antiJoinRaid.json +++ b/modules/moderation/configs/antiJoinRaid.json @@ -9,7 +9,8 @@ "humanname-de": "Aktiviert", "description-de": "Aktiviert oder deaktiviert das Anti-Join-Raid-System", "params-de": {}, - "default-de": true + "default-de": true, + "elementToggle": true }, { "field_name": "timeframe", @@ -69,4 +70,4 @@ "default-de": true } ] -} +} \ No newline at end of file diff --git a/modules/moderation/configs/antiSpam.json b/modules/moderation/configs/antiSpam.json index 1dc78c7d..e93d6c8e 100644 --- a/modules/moderation/configs/antiSpam.json +++ b/modules/moderation/configs/antiSpam.json @@ -9,7 +9,8 @@ "humanname-de": "Aktiviert", "description-de": "Aktiviert oder deaktiviert das Anti-Spam-System", "params-de": {}, - "default-de": true + "default-de": true, + "elementToggle": true }, { "field_name": "timeframe", @@ -140,4 +141,4 @@ "default-de": [] } ] -} +} \ No newline at end of file diff --git a/modules/moderation/configs/joinGate.json b/modules/moderation/configs/joinGate.json index 6dd5d05d..00c0b693 100644 --- a/modules/moderation/configs/joinGate.json +++ b/modules/moderation/configs/joinGate.json @@ -9,7 +9,8 @@ "humanname-de": "Aktiviert?", "description-de": "Aktiviere oder deaktiviere das Join-Gate", "params-de": {}, - "default-de": true + "default-de": true, + "elementToggle": true }, { "field_name": "allUsers", @@ -89,4 +90,4 @@ "default-de": true } ] -} +} \ No newline at end of file diff --git a/modules/moderation/configs/verification.json b/modules/moderation/configs/verification.json index eb4f2a17..55b7976e 100644 --- a/modules/moderation/configs/verification.json +++ b/modules/moderation/configs/verification.json @@ -9,7 +9,8 @@ "humanname-de": "", "description-de": "", "params-de": {}, - "default-de": false + "default-de": false, + "elementToggle": true }, { "field_name": "verification-needed-role", @@ -141,4 +142,4 @@ "default-de": "Welcome! I have send you a DM about your verification-process. Please read it carefully. If you have DMs disabled, please activate them and click the button below. This step is required to join this server." } ] -} +} \ No newline at end of file diff --git a/modules/tickets/config.json b/modules/tickets/config.json index 5b371093..ecd52978 100644 --- a/modules/tickets/config.json +++ b/modules/tickets/config.json @@ -93,6 +93,7 @@ "allowEmbed": true, "description-de": "Diese Nachricht wird an den Nutzer gesendet, wenn die entsprechende Option aktiviert ist", "description-en": "This message gets send to the user if sendUserDMAfterTicketClose is enabled", + "dependsOn": "sendUserDMAfterTicketClose", "params-de": [ { "name": "%transcriptURL%", diff --git a/package.json b/package.json index 95c3f0b7..5df49ba4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "customdcbot", - "version": "3.5.1", + "version": "3.6.0", "description": "Create your own discord bot - Fully customizable and with a lot of features", "main": "main.js", "repository": { diff --git a/src/functions/configuration.js b/src/functions/configuration.js index e5cfd9aa..d8a93c26 100644 --- a/src/functions/configuration.js +++ b/src/functions/configuration.js @@ -129,6 +129,7 @@ async function checkModuleConfig(moduleName, afterCheckEventFile = null) { } if (typeof configElement[field.field_name] === 'undefined') { configElement[field.field_name] = field.default; + ow = true; return res(configElement); } else if (field.type === 'keyed' && field.disableKeyEdits) { for (const key in field.default) { @@ -160,7 +161,7 @@ async function checkModuleConfig(moduleName, afterCheckEventFile = null) { } if (field.disableKeyEdits) { for (const content in configElement[field.field_name]) { - if (!field.default[content]) { + if (typeof field.default[content] === 'undefined') { delete configElement[field.field_name][content]; ow = true; } @@ -284,6 +285,7 @@ async function checkType(type, value, contentFormat = null, allowEmbed = false) if (parseInt(value) === 0) return true; return !!parseInt(value); case 'string': + case 'imgURL': case 'timezone': // Timezones can not be checked correctly for their type currently. if (allowEmbed && typeof value === 'object') return true; return typeof value === 'string'; @@ -294,6 +296,13 @@ async function checkType(type, value, contentFormat = null, allowEmbed = false) if (!errored) errored = !(await checkType(contentFormat, v, null, allowEmbed)); } return !errored; + case 'userID': + const user = await client.users.fetch(value).catch(() => {}); + if (!user) { + logger.error(localize('config', 'user-not-found', {id: value})); + return false; + } + return true; case 'channelID': const channel = await client.channels.fetch(value).catch(() => { });