This commit is contained in:
DjDeveloperr 2021-03-30 15:31:50 +05:30
parent 768fec7195
commit a89318c3c3

View file

@ -41,6 +41,7 @@ export function init(options: DeploySlashInitOptions): void {
try {
const d = await client.verifyFetchEvent(evt)
if (d === false) {
console.log('not authorized')
await evt.respondWith(
new Response(null, {
status: 400
@ -50,12 +51,15 @@ export function init(options: DeploySlashInitOptions): void {
}
if (d.type === InteractionType.PING) {
console.log('ping pong')
await d.respond({ type: InteractionResponseType.PONG })
return
}
console.log('slash command', d.name)
await (client as any)._process(d)
} catch (e) {
console.log(e)
await client.emit('interactionError', e)
}
}