Fixes inproper creation of groups
This commit is contained in:
parent
2e26b1c210
commit
7afcd6b26a
1 changed files with 12 additions and 1 deletions
|
|
@ -108,7 +108,18 @@ export class GroupCommand implements Command, ChatInteractionCommand, Autocomple
|
|||
|
||||
private create(interaction: ChatInputCommandInteraction): void {
|
||||
const name = interaction.options.getString("name") ?? '';
|
||||
const role = interaction.options.getRole("role");
|
||||
const role = interaction.options.getRole("role", true);
|
||||
|
||||
if (role.id === interaction.guildId) {
|
||||
throw new UserError("Creating a group for everyone is not permitted!");
|
||||
}
|
||||
|
||||
if (!interaction.member?.roles.cache.has(role?.id) ?? true) {
|
||||
throw new UserError(
|
||||
"You are not part of the role, you try to create a group for.",
|
||||
"Add yourself to the group or ask your admin to do so."
|
||||
);
|
||||
}
|
||||
|
||||
const group: GroupModel = {
|
||||
id: -1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue