Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
15bd079
removed borken, unnecessary dependency
hfgd123 Apr 27, 2022
216dfc0
Revert "removed borken, unnecessary dependency"
hfgd123 Apr 27, 2022
3946db4
removed broken, unnecessary dependency
hfgd123 Apr 27, 2022
be019c2
created necessary structure
hfgd123 Apr 28, 2022
53c798e
Base system now works for target all
hfgd123 Apr 28, 2022
559e9fc
Update massrole.js
hfgd123 Apr 29, 2022
3746b3a
Delete config.json
hfgd123 Apr 29, 2022
2e9afd1
Update module.json
hfgd123 Apr 29, 2022
99e9f9e
Update massrole.js
hfgd123 Apr 29, 2022
a0f0948
Added targets bots and humans
hfgd123 Apr 30, 2022
a60a2ff
Implemented autocomplete for "target"-option
hfgd123 Apr 30, 2022
23c0a08
Now using locales for all strings thus making strings.json irrelevant
hfgd123 Apr 30, 2022
d85a97d
Fixed autocomplete by removing locales from options
hfgd123 Apr 30, 2022
b22c05b
Undid last change, since it somehow works now
hfgd123 Apr 30, 2022
1368627
Now using old package-lock file
hfgd123 Apr 30, 2022
bcb10eb
Update massrole.js
hfgd123 Apr 30, 2022
639e5f5
Update massrole.js
hfgd123 Apr 30, 2022
a13d42d
Merge branch 'SCNetwork:main' into main
hfgd123 Apr 30, 2022
ec31065
did npm run test -- --fix to fix errors or smth like that
hfgd123 May 1, 2022
657eacf
Update modules/massrole/commands/massrole.js
hfgd123 May 1, 2022
cbdf8da
Replaced forEach with for loop
hfgd123 May 1, 2022
12c4b75
Merge remote-tracking branch 'origin/main'
hfgd123 May 1, 2022
a82678e
Now using choices instead of autocomplete
hfgd123 May 1, 2022
f3f9d24
yes
hfgd123 May 1, 2022
ae10eb2
keyword-spacing
hfgd123 May 1, 2022
4ae4c0e
Update package.json
hfgd123 May 1, 2022
9af2192
Implemented error-handling if bot hasn't enough permissions
hfgd123 May 1, 2022
81a6d20
Implemented error-handling if bot hasn't enough permissions
hfgd123 May 1, 2022
cdcc60f
...
hfgd123 May 1, 2022
24fcbf2
Update default-locales.json
hfgd123 May 1, 2022
6bd26d0
Added customizable strings.json for command answers. (Shini...)
hfgd123 May 1, 2022
03a8159
Merge remote-tracking branch 'origin/main'
hfgd123 May 1, 2022
5a6b2c9
Added customizable strings.json for command answers. (Shini...)
hfgd123 May 1, 2022
92d3939
Added customizable strings.json for command answers. (Shini...)
hfgd123 May 1, 2022
1b679e6
Strings must use singlequote quotes
hfgd123 May 1, 2022
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
4 changes: 1 addition & 3 deletions default-locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
41 changes: 23 additions & 18 deletions modules/massrole/commands/massrole.js
Original file line number Diff line number Diff line change
@@ -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 });
Expand All @@ -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') {
Expand All @@ -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') {
Expand All @@ -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 });
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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 });
Expand All @@ -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') {
Expand All @@ -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') {
Expand All @@ -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;
}
}
Expand Down
33 changes: 33 additions & 0 deletions modules/massrole/configs/strings.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
]
}
3 changes: 3 additions & 0 deletions modules/massrole/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
"devDependencies": {
"eslint": "^7.32.0"
}
}
}