Skip to content

Commit e67068a

Browse files
authored
fix: enhance error handling for guide synchronization to provide specific warnings for permission issues (#28)
1 parent 828ed18 commit e67068a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/events/ready.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@ export const readyEvent = createEvent(
3030
console.log(`🔄 Starting guide sync to channel ${config.guides.channelId}...`);
3131
await syncGuidesToChannel(client, config.guides.channelId);
3232
} catch (error) {
33-
console.error('❌ Failed to sync guides:', error);
33+
if (error && typeof error === 'object' && 'code' in error) {
34+
const discordError = error as { code: number; message?: string };
35+
if (discordError.code === 50001) {
36+
console.warn(
37+
'⚠️ Bot does not have access to the guides channel. Please check bot permissions and channel ID.'
38+
);
39+
} else {
40+
console.error('❌ Failed to sync guides:', error);
41+
}
42+
} else {
43+
console.error('❌ Failed to sync guides:', error);
44+
}
3445
}
3546
}
3647
}

0 commit comments

Comments
 (0)