mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-22 00:11:06 +01:00
fix
This commit is contained in:
parent
4ee047e41d
commit
47ea6d92dd
1 changed files with 2 additions and 3 deletions
|
@ -11,7 +11,6 @@ export const handleRequest = async(request: Request): Promise<Response> => {
|
||||||
|
|
||||||
const interaction = await request.json() as APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
const interaction = await request.json() as APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||||
|
|
||||||
console.log(interaction);
|
|
||||||
if (interaction.type === InteractionType.Ping)
|
if (interaction.type === InteractionType.Ping)
|
||||||
return respond({
|
return respond({
|
||||||
type: InteractionResponseType.Pong
|
type: InteractionResponseType.Pong
|
||||||
|
@ -38,7 +37,7 @@ export const handleRequest = async(request: Request): Promise<Response> => {
|
||||||
if (!message) message = '';
|
if (!message) message = '';
|
||||||
if (!roles || Object.values(json.roles).filter((role: any) => role.id && role.label).length === 0 || roles.length === 0 || roles.length > 25) return badFormatting(roles.length > 25);
|
if (!roles || Object.values(json.roles).filter((role: any) => role.id && role.label).length === 0 || roles.length === 0 || roles.length > 25) return badFormatting(roles.length > 25);
|
||||||
|
|
||||||
const finalComponents = json.type === 1 ? resolveButtonComponents(roles) : resolveSelectMenuComponents(roles, json.placeholder?.toString());
|
const finalComponents = json.type === "1" ? resolveButtonComponents(roles) : resolveSelectMenuComponents(roles, json.placeholder?.toString());
|
||||||
|
|
||||||
const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, {
|
const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -56,7 +55,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, bad channel id/missing permissions.'
|
content: fetched?.ok ? 'Done!' : 'Error, bad channel id/missing permissions/invalid emojis.'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (interaction.type === InteractionType.MessageComponent) {
|
} else if (interaction.type === InteractionType.MessageComponent) {
|
||||||
|
|
Loading…
Reference in a new issue