diff --git a/default-locales.json b/default-locales.json index ef0f600f..fe69c104 100644 --- a/default-locales.json +++ b/default-locales.json @@ -360,9 +360,7 @@ "target-option-description": "Determines whether bots should be included or not", "all-users": "All Users", "bots": "Bots", - "humans": "Humans", - "done": "Action executed", - "not-done": "Action couldn't be executed because the bot has not enough permissions." + "humans": "Humans" } } } \ No newline at end of file diff --git a/modules/massrole/commands/massrole.js b/modules/massrole/commands/massrole.js index 7c254ad2..f274fca1 100644 --- a/modules/massrole/commands/massrole.js +++ b/modules/massrole/commands/massrole.js @@ -1,9 +1,12 @@ const {localize} = require('../../../src/functions/localize'); +const {embedType} = require('../../../src/functions/helpers'); let target; let failed; + module.exports.subcommands = { 'add': async function (interaction) { + const moduleStrings = interaction.client.configurations['massrole']['strings']; checkTarget(interaction); if (target === 'all') { await interaction.deferReply({ ephemeral: true }); @@ -15,9 +18,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } else if (target === 'bots') { @@ -32,9 +35,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } else if (target === 'humans') { @@ -52,14 +55,15 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } }, 'remove': async function (interaction) { + const moduleStrings = interaction.client.configurations['massrole']['strings']; checkTarget(interaction); if (target === 'all') { await interaction.deferReply({ ephemeral: true }); @@ -71,9 +75,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } @@ -90,9 +94,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } @@ -111,15 +115,16 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } }, 'remove-all': async function (interaction) { + const moduleStrings = interaction.client.configurations['massrole']['strings']; checkTarget(interaction); if (target === 'all') { await interaction.deferReply({ ephemeral: true }); @@ -131,9 +136,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } else if (target === 'bots') { @@ -150,9 +155,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } else if (target === 'humans') { @@ -169,9 +174,9 @@ module.exports.subcommands = { } } if (failed === 0) { - await interaction.editReply(localize('massrole', 'done')); + await interaction.editReply(embedType(moduleStrings.done, {})); } else { - await interaction.editReply(localize('massrole', 'not-done')); + await interaction.editReply(embedType(moduleStrings.notDone, {})); failed = 0; } } diff --git a/modules/massrole/configs/strings.json b/modules/massrole/configs/strings.json new file mode 100644 index 00000000..f5963b65 --- /dev/null +++ b/modules/massrole/configs/strings.json @@ -0,0 +1,33 @@ +{ + "filename": "strings.json", + "humanname-de": "Nachrichten", + "humanname-en": "Messages", + "description-en": "Edit the messages and strings of the module here", + "description-de": "Stelle hier die Nachrichten des Modules ein", + "content": [ + { + "field_name": "done", + "humanname-en": "Action executed", + "humanname-de": "Aktion ausgeführt", + "default-en": "The action was executed successfully.", + "default-de": "Die Aktion wurde erfolgreich ausgeführt.", + "type": "string", + "allowEmbed": true, + "description-en": "This messages gets send when a action was executed successfully", + "description-de": "Diese Nachricht wird verschickt, wenn eine Akton erfolgreich ausgeführt wurde", + "params-de": {} + }, + { + "field_name": "notDone", + "humanname-en": "Action not executed", + "humanname-de": "Aktion nicht ausgeführt", + "default-en": "The Action couldn't be executed because the bot has not enough permissions.", + "default-de": "Die Aktion konnte nicht vollständig ausgeführt werden, da der Bot nicht genug Rechte hat.", + "type": "string", + "allowEmbed": true, + "description-en": "This messages gets send when a action was not executed successfully", + "description-de": "Diese Nachricht wird verschickt, wenn eine Aktion nicht erfolgreich ausgeführt wurde", + "params-de": {} + } + ] +} \ No newline at end of file diff --git a/modules/massrole/module.json b/modules/massrole/module.json index 205e479a..8eeaf59e 100644 --- a/modules/massrole/module.json +++ b/modules/massrole/module.json @@ -10,5 +10,8 @@ "description-en": "Simple module to manage the roles of many members at once!", "description-de": "Einfaches Modul, um die Rollen vieler Nutzer gleichzeitig zu verwalten!", "commands-dir": "/commands", + "config-example-files": [ + "configs/strings.json" + ], "tags": ["administration"] } diff --git a/package.json b/package.json index b36f72fa..ff64e823 100644 --- a/package.json +++ b/package.json @@ -46,4 +46,4 @@ "devDependencies": { "eslint": "^7.32.0" } -} +} \ No newline at end of file