Skip to content

Commit

Permalink
feat: add required role info to /listroles, /requirerole without argu…
Browse files Browse the repository at this point in the history
…ments resets

Closes: #77
  • Loading branch information
tippfehlr committed Aug 30, 2024
1 parent eb22769 commit ef199f9
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 110 deletions.
17 changes: 12 additions & 5 deletions locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "vypnuto",
"Automatic role assignment for your user is now **%s**.": "Automatické přiřazení role pro uživatele je nyní **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Můžete to změnit příkazem `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Uživatelé nyní potřebují %s aby mohli přijímat role aktivity.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "The role to require. To get the current role, omit this. To reset, enter @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Uživatelé nyní potřebují %s aby mohli přijímat role aktivity.",
"%s is already set as the required role.": "%s je již nastaven jako povinná role.",
"Users now need to have %s in order to receive Activity Roles.": "Uživatelé nyní potřebují %s aby mohli přijímat role aktivity.",
"Shows a list of activities in this guild.": "Shows a list of activities in this guild.",
"Activities (sorted by frequency):": "Activities (sorted by frequency):",
"Show role IDs (can’t be imported in another guild)": "Show role IDs (can’t be imported in another guild)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "deaktiviert",
"Automatic role assignment for your user is now **%s**.": "Automatische Rollenzuweisung für deinen Benutzer ist jetzt **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Sie können dies mit dem `/toggleAutoRole` Befehl ändern.",
"Require users to have this role in order to receive Activity Roles.": "Benutzer müssen diese Rolle haben, um Aktivitätsrollen zu erhalten.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "The role to require. To get the current role, omit this. To reset, enter @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Benutzer müssen %s haben, um Aktivitätsrollen zu erhalten.",
"%s is already set as the required role.": "%s ist bereits als benötigte Rolle festgelegt.",
"Users now need to have %s in order to receive Activity Roles.": "Benutzer müssen %s haben, um Aktivitätsrollen zu erhalten.",
"Shows a list of activities in this guild.": "Zeigt eine Liste der Aktivitäten in dieser Gilde.",
"Activities (sorted by frequency):": "Aktivitäten (nach Häufigkeit sortiert):",
"Show role IDs (can’t be imported in another guild)": "Rollen-IDs anzeigen (können nicht in eine andere Gilde importiert werden)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "disabled",
"Automatic role assignment for your user is now **%s**.": "Automatic role assignment for your user is now **%s**.",
"You can change this with the command `/toggleAutoRole`.": "You can change this with the command `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Require users to have this role in order to receive Activity Roles.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "The role to require. To get the current role, omit this. To reset, enter @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Users need to have %s in order to receive Activity Roles.",
"%s is already set as the required role.": "%s is already set as the required role.",
"Users now need to have %s in order to receive Activity Roles.": "Users now need to have %s in order to receive Activity Roles.",
"Shows a list of activities in this guild.": "Shows a list of activities in this guild.",
"Activities (sorted by frequency):": "Activities (sorted by frequency):",
"Show role IDs (can’t be imported in another guild)": "Show role IDs (can’t be imported in another guild)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "désactivé",
"Automatic role assignment for your user is now **%s**.": "L'ajout automatique de rôle pour votre utilisateur est maintenant **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Vous pouvez changer cela avec la commande `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Exige que les utilisateurs aient ce rôle pour obtenir les Rôles D'activité.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "Le rôle à exiger. Pour obtenir le rôle actuel, omettez cela. Pour réinitialiser, entrez @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Les utilisateurs doivent avoir %s pour obtenir les Rôles D'activité.",
"%s is already set as the required role.": "%s est déjà défini comme le rôle requis.",
"Users now need to have %s in order to receive Activity Roles.": "Les utilisateurs doivent désormais avoir %s pour obtenir les Rôles D'activité.",
"Shows a list of activities in this guild.": "Affiche une liste des activités dans ce serveur.",
"Activities (sorted by frequency):": "Activités (classées par fréquence) :",
"Show role IDs (can’t be imported in another guild)": "Affiche les identifiants des rôles (ne peuvent pas être importés dans un autre serveur)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "uitgeschakeld",
"Automatic role assignment for your user is now **%s**.": "Automatische roltoewijzing voor uw gebruiker is nu **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Je kunt dit wijzigen met het commando `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Require users to have this role in order to receive Activity Roles.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "The role to require. To get the current role, omit this. To reset, enter @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Users need to have %s in order to receive Activity Roles.",
"%s is already set as the required role.": "%s is already set as the required role.",
"Users now need to have %s in order to receive Activity Roles.": "Users now need to have %s in order to receive Activity Roles.",
"Shows a list of activities in this guild.": "Shows a list of activities in this guild.",
"Activities (sorted by frequency):": "Activities (sorted by frequency):",
"Show role IDs (can’t be imported in another guild)": "Show role IDs (can’t be imported in another guild)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "desabilitado",
"Automatic role assignment for your user is now **%s**.": "Atribuição automática do cargo para o seu usuário agora é **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Você pode mudar isso com o comando `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Exigir jogadores terem esse cargo para receber Cargos de Atividades.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "O cargo necessário. Para obter o cargo atual, omita isso. Para redefinir, digite @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Exigir jogadores terem %s para receber Cargos de Atividades.",
"%s is already set as the required role.": "%s já está definido como um cargo necessário.",
"Users now need to have %s in order to receive Activity Roles.": "Usuários agora precisam ter %s para receber Cargos de Atividades.",
"Shows a list of activities in this guild.": "Mostra uma lista de atividades nesse servidor.",
"Activities (sorted by frequency):": "Atividades (ordenadas por frequência):",
"Show role IDs (can’t be imported in another guild)": "Mostrar IDs de cargos (não pode ser importado em outra guilda)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "отключено",
"Automatic role assignment for your user is now **%s**.": "Автоматическое назначение роли для вашего пользователя теперь **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Вы можете изменить это с помощью команды `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Require users to have this role in order to receive Activity Roles.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "The role to require. To get the current role, omit this. To reset, enter @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Users need to have %s in order to receive Activity Roles.",
"%s is already set as the required role.": "%s is already set as the required role.",
"Users now need to have %s in order to receive Activity Roles.": "Users now need to have %s in order to receive Activity Roles.",
"Shows a list of activities in this guild.": "Shows a list of activities in this guild.",
"Activities (sorted by frequency):": "Activities (sorted by frequency):",
"Show role IDs (can’t be imported in another guild)": "Show role IDs (can’t be imported in another guild)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
17 changes: 12 additions & 5 deletions locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"disabled": "вимкнено",
"Automatic role assignment for your user is now **%s**.": "Автоматичне призначення ролі для вашого користувача тепер **%s**.",
"You can change this with the command `/toggleAutoRole`.": "Ви можете змінити це за допомогою команди `/toggleAutoRole`.",
"Require users to have this role in order to receive Activity Roles.": "Вимагайте, щоб користувачі мали цю роль для отримання ролей активності.",
"The role to require. To get the current role, omit this. To reset, enter @everyone.": "Потрібна роль. Щоб отримати поточну роль, пропустіть це поле. Щоб скинути, введіть @everyone.",
"Users need to have %s in order to receive Activity Roles.": "Користувачі повинні мати %s, щоб отримати ролі активності.",
"%s is already set as the required role.": "%s вже встановлено як необхідну роль.",
"Users now need to have %s in order to receive Activity Roles.": "Тепер користувачі повинні мати %s, щоб отримати ролі активності.",
"Shows a list of activities in this guild.": "Показує список активностей на цьому сервері.",
"Activities (sorted by frequency):": "Активності (відсортовано за частотою):",
"Show role IDs (can’t be imported in another guild)": "Показати ID ролі (не можна імпортувати на інший сервер)",
Expand Down Expand Up @@ -135,5 +130,17 @@
},
"setStatusRole": {
"roleNotValid": "%s is not a valid role for status roles."
},
"listRoles": {
"requiredRole": "Required role: %s",
"requiredRoleExplanation": "Members need this role to receive roles from this bot."
},
"requireRole": {
"description": "Require users to have this role in order to receive Activity Roles.",
"roleOptionDescription": "The role to require. Omit this to unset the required role",
"successRemove": "Successfully unset the required role.",
"failedNoRequiredRole": "There is no required role to unset!",
"roleAlreadySet": "%s is already set as the required role.",
"success": "Required role is now %s. Members will need it to get activity/status roles."
}
}
13 changes: 11 additions & 2 deletions src/modules/commands/listRoles.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-only

import { ActivityType, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { ActivityType, EmbedBuilder, Role, SlashCommandBuilder } from 'discord.js';

import { db, getLang } from '../db';
import { db, getGuildConfig, getLang } from '../db';
import { Command } from '../commandHandler';
import { __, discordTranslations, getEnumKey } from '../messages';
import config from '../config';
Expand Down Expand Up @@ -51,6 +51,7 @@ export default {
if (statusRoles === '') {
statusRoles = __({ phrase: 'There are no status roles in this guild', locale });
}
const { requiredRoleID } = await getGuildConfig(interaction.guild.id);

const filename = `listActivityRoles-${interaction.id.substring(0, 7)}.txt`;
writeFileSync(filename, activityRolesTable);
Expand All @@ -60,6 +61,14 @@ export default {
.setTitle(__({ phrase: 'Status Roles', locale }))
.setDescription(statusRoles)
.setColor(config.COLOR),
new EmbedBuilder()
.setDescription(
__(
{ phrase: 'listRoles->requiredRole', locale },
requiredRoleID ? `<&${requiredRoleID}>` : 'None',
),
)
.setFooter({ text: __({ phrase: 'listRoles->requireRolesExplanation', locale }) }),
],
files: [filename],
});
Expand Down
Loading

0 comments on commit ef199f9

Please sign in to comment.