Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 8955c6a

Browse files
committed
fix(joinserver): members with ManageMessages only can accept/deny
1 parent 8625aee commit 8955c6a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/commands/Main/joinserver.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,19 @@ export default class JoinRequestCommand extends BaseCommand {
170170

171171
@RegisterInteractionHandler('joinReq')
172172
async handleJoinRequest(interaction: ButtonInteraction) {
173+
if (!interaction.inCachedGuild()) return;
174+
175+
if (!interaction.member.permissions.has('ManageMessages')) {
176+
await interaction.reply({
177+
content: t('errors.missingPermissions', await fetchUserLocale(interaction.user.id), {
178+
emoji: getEmoji('x_icon', interaction.client),
179+
permissions: 'Manage Messages',
180+
}),
181+
flags: ['Ephemeral'],
182+
});
183+
return;
184+
}
185+
173186
const customId = CustomID.parseCustomId(interaction.customId);
174187
const action = customId.suffix as 'accept' | 'reject';
175188
const [userId] = customId.args;
@@ -187,8 +200,6 @@ export default class JoinRequestCommand extends BaseCommand {
187200
}
188201

189202
if (action === 'accept') {
190-
if (!interaction.inCachedGuild()) return;
191-
192203
const connection = await fetchConnection(interaction.channelId);
193204
if (!connection) {
194205
await interaction.reply({

0 commit comments

Comments
 (0)