mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-25 01:31:05 +01:00
fix: add filter
This commit is contained in:
parent
9496c741c8
commit
c764747e82
2 changed files with 5 additions and 2 deletions
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue