fix: add filter

This commit is contained in:
xhyrom 2022-04-08 17:58:30 +02:00
parent 9496c741c8
commit c764747e82
2 changed files with 5 additions and 2 deletions

View file

@ -66,7 +66,7 @@ export const handleRequest = async(request: Request): Promise<Response> => {
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<Response> => {
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<Response> => {
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) {

View file

@ -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"