x
This commit is contained in:
parent
768fec7195
commit
a89318c3c3
1 changed files with 4 additions and 0 deletions
|
@ -41,6 +41,7 @@ export function init(options: DeploySlashInitOptions): void {
|
||||||
try {
|
try {
|
||||||
const d = await client.verifyFetchEvent(evt)
|
const d = await client.verifyFetchEvent(evt)
|
||||||
if (d === false) {
|
if (d === false) {
|
||||||
|
console.log('not authorized')
|
||||||
await evt.respondWith(
|
await evt.respondWith(
|
||||||
new Response(null, {
|
new Response(null, {
|
||||||
status: 400
|
status: 400
|
||||||
|
@ -50,12 +51,15 @@ export function init(options: DeploySlashInitOptions): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.type === InteractionType.PING) {
|
if (d.type === InteractionType.PING) {
|
||||||
|
console.log('ping pong')
|
||||||
await d.respond({ type: InteractionResponseType.PONG })
|
await d.respond({ type: InteractionResponseType.PONG })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('slash command', d.name)
|
||||||
await (client as any)._process(d)
|
await (client as any)._process(d)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
await client.emit('interactionError', e)
|
await client.emit('interactionError', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue