Public
Versions
- Open: VersionChanges from v5 to v6+1-1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {
if (req.method === "GET") return new Response("Method Not Allowed", { status: 405 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {if (req.method === "GET") return new Response("GET Method Not Allowed", { status: 405 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚ - Open: VersionChanges from v4 to v5+1-1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {
if (req.method === "GET") return new Response("Invalid Method", { status: 405 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {if (req.method === "GET") return new Response("Method Not Allowed", { status: 405 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚ - Open: VersionChanges from v3 to v4+1-1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {
if (req.method === "GET") return new Response("Not Found", { status: 404 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {if (req.method === "GET") return new Response("Invalid Method", { status: 405 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚ - Open: VersionChanges from v2 to v3+1-1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {
if (req.method === "GET") return new Response("Not Found", { status: 4043 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {if (req.method === "GET") return new Response("Not Found", { status: 404 });const body = await req.json();const verified = await verify_discord_signature(⦚ 29 unchanged lines ⦚ - Open: VersionChanges from v1 to v2+2-2import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {
if (req.method === "GET") return new Response();const body = await req.json();const verified = await verify_discord_signature(Deno.env.get('discordPublicKey'),JSON.stringify(body),req.headers.get("X-Signature-Ed25519"),⦚ 26 unchanged lines ⦚import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {if (req.method === "GET") return new Response("Not Found", { status: 4043 });const body = await req.json();const verified = await verify_discord_signature(Deno.env.get("discordPublicKey"),JSON.stringify(body),req.headers.get("X-Signature-Ed25519"),⦚ 26 unchanged lines ⦚ - Open: VersionChanges from v0 to v1+35-3
export default async function (req: Request): Promise<Response> {return Response.json({ ok: true })}import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";export const handleDiscordInteraction = async (req: Request) => {if (req.method === "GET") return new Response();const body = await req.json();const verified = await verify_discord_signature(Deno.env.get('discordPublicKey'),JSON.stringify(body),req.headers.get("X-Signature-Ed25519"),req.headers.get("X-Signature-Timestamp"),);if (!verified)return new Response("signature invalid", {status: 401,statusText: "signature invalid",});// PINGif (body.type === 1)return Response.json({ type: 1 }); // PONG// APPLICATION_COMMAND interactionsif (body.type === 2) {if (body.data?.name === "ping")return Response.json({type: 4,data: {content: `Pong! It is ${new Date()}`,},});return new Response("Bad request", {status: 400,statusText: "Bad request",});}return new Response("Not handled", { status: 422 });}; - Open: Version+3-0export default async function (req: Request): Promise<Response> {return Response.json({ ok: true })}
maxm-discordbotexample.web.val.run
Updated: April 5, 2024