x
This commit is contained in:
parent
68cf1105c1
commit
75620ee7ea
2 changed files with 6 additions and 1 deletions
|
@ -39,7 +39,10 @@ export function init(options: DeploySlashInitOptions): void {
|
||||||
request: Request
|
request: Request
|
||||||
}): Promise<void> => {
|
}): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const d = await client.verifyFetchEvent(evt)
|
const d = await client.verifyFetchEvent({
|
||||||
|
respondWith: (...args: any[]) => evt.respondWith(...args),
|
||||||
|
request: evt.request,
|
||||||
|
})
|
||||||
if (d === false) {
|
if (d === false) {
|
||||||
await evt.respondWith(
|
await evt.respondWith(
|
||||||
new Response('Not Authorized', {
|
new Response('Not Authorized', {
|
||||||
|
@ -51,6 +54,7 @@ export function init(options: DeploySlashInitOptions): void {
|
||||||
|
|
||||||
if (d.type === InteractionType.PING) {
|
if (d.type === InteractionType.PING) {
|
||||||
await d.respond({ type: InteractionResponseType.PONG })
|
await d.respond({ type: InteractionResponseType.PONG })
|
||||||
|
client.emit('ping')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,7 @@ const decoder = new TextDecoder('utf-8')
|
||||||
export type SlashClientEvents = {
|
export type SlashClientEvents = {
|
||||||
interaction: [Interaction]
|
interaction: [Interaction]
|
||||||
interactionError: [Error]
|
interactionError: [Error]
|
||||||
|
ping: []
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Slash Client represents an Interactions Client which can be used without Harmony Client. */
|
/** Slash Client represents an Interactions Client which can be used without Harmony Client. */
|
||||||
|
|
Loading…
Reference in a new issue