Skip to content

Commit

Permalink
remove type filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsundso committed Sep 15, 2024
1 parent 6341304 commit ce9146b
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default <T extends keyof typeof CT.SettingsName2TableName>(
id: string;
type: Discord.SelectMenuDefaultValueType;
}[],
guild: Discord.Guild,
channelType?: 'text' | 'voice' | 'category',
) => {
const menu:
Expand All @@ -26,20 +25,7 @@ export default <T extends keyof typeof CT.SettingsName2TableName>(
min_values: 0,
max_values: type.endsWith('s') ? 25 : 1,
custom_id: getWithUTS(`settings/${type}_${fieldName}_${String(settingName)}`, uniquetimestamp),
default_values: values.filter((v) => {
if (!v.id) return false;

switch (v.type) {
case Discord.SelectMenuDefaultValueType.Channel:
return guild.channels.cache.has(v.id);
case Discord.SelectMenuDefaultValueType.Role:
return guild.roles.cache.has(v.id);
case Discord.SelectMenuDefaultValueType.User:
return guild.members.cache.has(v.id);
default:
return true;
}
}) as never,
default_values: values as never,
type: getChangeSelectType(type),
placeholder: getPlaceholder(type, language),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
},
]
: [],
cmd.guild,
),
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
rule.exemptChannels
.map((c) => c.id)
.map((o) => ({ id: o, type: Discord.SelectMenuDefaultValueType.Channel })),
cmd.guild,
),
],
},
Expand Down
1 change: 0 additions & 1 deletion src/Commands/ButtonCommands/settings/autoModRule/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
rule.exemptRoles
.map((c) => c.id)
.map((o) => ({ id: o, type: Discord.SelectMenuDefaultValueType.Role })),
cmd.guild,
),
],
},
Expand Down
1 change: 0 additions & 1 deletion src/Commands/ButtonCommands/settings/editors/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export default async (
id: o,
type: Discord.SelectMenuDefaultValueType.Channel,
})),
cmd.guild,
channelTypes,
),
],
Expand Down
1 change: 0 additions & 1 deletion src/Commands/ButtonCommands/settings/editors/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
id: o,
type: Discord.SelectMenuDefaultValueType.Channel,
})),
cmd.guild,
),
],
},
Expand Down
1 change: 0 additions & 1 deletion src/Commands/ButtonCommands/settings/editors/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
id: o,
type: Discord.SelectMenuDefaultValueType.Channel,
})),
cmd.guild,
),
],
},
Expand Down
1 change: 0 additions & 1 deletion src/Commands/ButtonCommands/settings/editors/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
id: o,
type: Discord.SelectMenuDefaultValueType.Role,
})),
cmd.guild,
),
],
},
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/ButtonCommands/settings/editors/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export default async (cmd: Discord.ButtonInteraction, args: string[]) => {
uniquetimestamp,
(Array.isArray(currentSetting) ? currentSetting : [currentSetting]).map((o) => ({
id: o,
type: Discord.SelectMenuDefaultValueType.Channel,
type: Discord.SelectMenuDefaultValueType.Role,
})),
cmd.guild,
),
],
},
Expand Down

0 comments on commit ce9146b

Please sign in to comment.