Created
December 5, 2022 17:16
-
-
Save Aqendo/780caa4e7837825c9c21bfc98b5bda28 to your computer and use it in GitHub Desktop.
i am not good at js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function handleRequest(request) { | |
if (!(request.method === "POST")) return new Response("OK") | |
const payload = await request.json() | |
// Getting the POST request JSON payload | |
if (!('inline_query' in payload)) return new Response("OK") | |
const i_d = payload.inline_query.id | |
let resp = new Response(JSON.stringify({ | |
"method": "answerInlineQuery", | |
"inline_query_id": i_d, | |
"results": JSON.stringify([{ | |
"type": "article", | |
"id": "kek", | |
"title": "/BLUE /TEXT\n/MUST /CLICK\n/I /AM /A /STUPID /ANIMAL /THAT /IS /ATTRACTED /TO /COLORS", | |
"input_message_content": { | |
"message_text": "/BLUE /TEXT\n/MUST /CLICK\n/I /AM /A /STUPID /ANIMAL /THAT /IS /ATTRACTED /TO /COLORS" | |
} | |
}]) | |
})) | |
resp.headers.append("content-type", "application/json") | |
return resp | |
} | |
addEventListener("fetch", event => { | |
event.respondWith(handleRequest(event.request)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment