File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export default async function handler(
1313 return res . status ( 401 ) . json ( { error : 'Unauthorized' } )
1414 }
1515
16+ console . log ( `[DEBUG] BOT_API_URL: ${ BOT_API_URL } ` )
17+
1618 try {
1719 // Fetch user's guilds from Discord API
1820 const discordResponse = await fetch ( 'https://discord.com/api/users/@me/guilds' , {
@@ -38,7 +40,15 @@ export default async function handler(
3840 adminGuilds . map ( async ( guild : any ) => {
3941 let hasMiku = false
4042 try {
41- const botResponse = await fetch ( `${ BOT_API_URL } /api/guild/${ guild . id } /has-bot` )
43+ // Add timeout to prevent hanging
44+ const controller = new AbortController ( )
45+ const timeoutId = setTimeout ( ( ) => controller . abort ( ) , 5000 ) // 5 second timeout
46+
47+ const botResponse = await fetch ( `${ BOT_API_URL } /api/guild/${ guild . id } /has-bot` , {
48+ signal : controller . signal
49+ } )
50+ clearTimeout ( timeoutId )
51+
4252 if ( botResponse . ok ) {
4353 const data = await botResponse . json ( )
4454 hasMiku = data . hasMiku
You can’t perform that action at this time.
0 commit comments