diff --git a/packages/bot/bot.ts b/packages/bot/bot.ts index 1410780..b6433f3 100644 --- a/packages/bot/bot.ts +++ b/packages/bot/bot.ts @@ -66,7 +66,7 @@ export const handleRequest = async(request: Request): Promise => { return o; }); - const finalComponents = []; + let finalComponents = []; for (let i = 0; i <= roles.length; i += 5) { const row: any = { type: 1, @@ -80,6 +80,8 @@ export const handleRequest = async(request: Request): Promise => { finalComponents.push(row); } + finalComponents = finalComponents.filter(a => a.components.length > 0); + const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, { method: 'POST', headers: { @@ -96,7 +98,7 @@ export const handleRequest = async(request: Request): Promise => { type: InteractionResponseType.ChannelMessageWithSource, data: { flags: 64, - content: fetched?.ok ? 'Done!' : 'Error, invalid channelId' + content: fetched?.ok ? 'Done!' : 'Error, invalid channelId or duplication button ids.' } }); } else if (interaction.type === InteractionType.MessageComponent) { diff --git a/wrangler.example.toml b/wrangler.example.toml index 7403d59..c80c025 100644 --- a/wrangler.example.toml +++ b/wrangler.example.toml @@ -5,6 +5,7 @@ workers_dev = true route = "" zone_id = "" webpack_config = "webpack.config.js" +compatibility_date = "2022-04-08" [build] command = "npm install && npm run build"