mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-09 19:08: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;
|
return o;
|
||||||
});
|
});
|
||||||
|
|
||||||
const finalComponents = [];
|
let finalComponents = [];
|
||||||
for (let i = 0; i <= roles.length; i += 5) {
|
for (let i = 0; i <= roles.length; i += 5) {
|
||||||
const row: any = {
|
const row: any = {
|
||||||
type: 1,
|
type: 1,
|
||||||
|
@ -80,6 +80,8 @@ export const handleRequest = async(request: Request): Promise<Response> => {
|
||||||
finalComponents.push(row);
|
finalComponents.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finalComponents = finalComponents.filter(a => a.components.length > 0);
|
||||||
|
|
||||||
const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, {
|
const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -96,7 +98,7 @@ export const handleRequest = async(request: Request): Promise<Response> => {
|
||||||
type: InteractionResponseType.ChannelMessageWithSource,
|
type: InteractionResponseType.ChannelMessageWithSource,
|
||||||
data: {
|
data: {
|
||||||
flags: 64,
|
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) {
|
} else if (interaction.type === InteractionType.MessageComponent) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ workers_dev = true
|
||||||
route = ""
|
route = ""
|
||||||
zone_id = ""
|
zone_id = ""
|
||||||
webpack_config = "webpack.config.js"
|
webpack_config = "webpack.config.js"
|
||||||
|
compatibility_date = "2022-04-08"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
command = "npm install && npm run build"
|
command = "npm install && npm run build"
|
||||||
|
|
Loading…
Reference in a new issue