This commit is contained in:
xhyrom 2022-03-11 18:19:48 +01:00
parent c948cda4ef
commit 9496c741c8
2 changed files with 4 additions and 4 deletions

View file

@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"main": "dist/worker.production.js", "main": "dist/worker.production.js",
"scripts": { "scripts": {
"build": "webpack ./src/bot", "build": "webpack ./packages/bot",
"dev": "cross-env NODE_ENV=development npm run build" "dev": "cross-env NODE_ENV=development npm run build"
}, },
"keywords": [], "keywords": [],

View file

@ -80,7 +80,7 @@ export const handleRequest = async(request: Request): Promise<Response> => {
finalComponents.push(row); finalComponents.push(row);
} }
await fetch(`${RouteBases.api}/channels/${channelId}/messages`, { const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Authorization': `Bot ${CLIENT_TOKEN}`, 'Authorization': `Bot ${CLIENT_TOKEN}`,
@ -90,13 +90,13 @@ export const handleRequest = async(request: Request): Promise<Response> => {
content: message, content: message,
components: finalComponents components: finalComponents
}) })
}).catch(e => e); }).catch(() => {});
return respond({ return respond({
type: InteractionResponseType.ChannelMessageWithSource, type: InteractionResponseType.ChannelMessageWithSource,
data: { data: {
flags: 64, flags: 64,
content: 'Done!' content: fetched?.ok ? 'Done!' : 'Error, invalid channelId'
} }
}); });
} else if (interaction.type === InteractionType.MessageComponent) { } else if (interaction.type === InteractionType.MessageComponent) {