From 8dcdef993a0491e3a2da67e445d2f4e4bed241c7 Mon Sep 17 00:00:00 2001 From: rayz1065 Date: Wed, 21 Aug 2024 11:57:05 +0200 Subject: [PATCH 1/2] Fixed a few outdated jsdocs, added suggestions to sendDice --- src/context.ts | 13 ++++++++++--- src/core/api.ts | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/context.ts b/src/context.ts index 020e5860..3d64c021 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1467,14 +1467,21 @@ export class Context implements RenamedUpdate { /** * Context-aware alias for `api.sendDice`. Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. * - * @param emoji Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, or “🎰”. Dice can have values 1-6 for “🎲” and “🎯”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” + * @param emoji Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” * @param other Optional remaining parameters, confer the official reference below * @param signal Optional `AbortSignal` to cancel the request * * **Official reference:** https://core.telegram.org/bots/api#senddice */ replyWithDice( - emoji: string, + emoji: + | (string & Record) + | "🎲" + | "🎯" + | "🏀" + | "⚽" + | "🎳" + | "🎰", other?: Other<"sendDice", "chat_id" | "emoji">, signal?: AbortSignal, ) { @@ -2517,7 +2524,7 @@ export class Context implements RenamedUpdate { * @param other Optional remaining parameters, confer the official reference below * @param signal Optional `AbortSignal` to cancel the request * - * **Official reference:** https://core.telegram.org/bots/api#setchatmenubutton + * **Official reference:** https://core.telegram.org/bots/api#getchatmenubutton */ getChatMenuButton( other?: Other<"getChatMenuButton">, diff --git a/src/core/api.ts b/src/core/api.ts index 6f996ff4..32640080 100644 --- a/src/core/api.ts +++ b/src/core/api.ts @@ -766,7 +766,7 @@ export class Api { * Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. * * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * @param emoji Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, or “🎰”. Dice can have values 1-6 for “🎲” and “🎯”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” + * @param emoji Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” * @param other Optional remaining parameters, confer the official reference below * @param signal Optional `AbortSignal` to cancel the request * @@ -774,7 +774,14 @@ export class Api { */ sendDice( chat_id: number | string, - emoji: string, + emoji: + | (string & Record) + | "🎲" + | "🎯" + | "🏀" + | "⚽" + | "🎳" + | "🎰", other?: Other, signal?: AbortSignal, ) { @@ -790,7 +797,7 @@ export class Api { * @param other Optional remaining parameters, confer the official reference below * @param signal Optional `AbortSignal` to cancel the request * - * **Official reference:** https://core.telegram.org/bots/api#senddice + * **Official reference:** https://core.telegram.org/bots/api#setmessagereaction */ setMessageReaction( chat_id: number | string, From fd63bfcb235a626a66b5193c1b2b0eea674af1dc Mon Sep 17 00:00:00 2001 From: KnorpelSenf Date: Sat, 31 Aug 2024 11:54:07 +0200 Subject: [PATCH 2/2] build: update deno2node --- deno.jsonc | 2 +- package.json | 2 +- src/convenience/frameworks.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 4059e208..03b45af3 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -2,7 +2,7 @@ "lock": false, "tasks": { "check": "deno cache --check=all src/mod.ts", - "backport": "deno run --no-prompt --allow-read=. --allow-write=. https://deno.land/x/deno2node@v1.9.0/src/cli.ts tsconfig.json", + "backport": "deno run --no-prompt --allow-read=. --allow-write=. https://deno.land/x/deno2node@v1.13.0/src/cli.ts tsconfig.json", "test": "deno test --seed=123456 --parallel ./test/", "dev": "deno fmt && deno lint && deno task test && deno task check", "coverage": "rm -rf ./test/cov_profile && deno task test --coverage=./test/cov_profile && deno coverage --lcov --output=./coverage.lcov ./test/cov_profile", diff --git a/package.json b/package.json index 782c0111..0b933b7d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@types/debug": "^4.1.12", "@types/node": "^12.20.55", "@types/node-fetch": "2.6.2", - "deno2node": "^1.9.0" + "deno2node": "^1.13.0" }, "files": [ "out/" diff --git a/src/convenience/frameworks.ts b/src/convenience/frameworks.ts index e8633da9..d5ab0846 100644 --- a/src/convenience/frameworks.ts +++ b/src/convenience/frameworks.ts @@ -413,6 +413,7 @@ const http: HttpAdapter = (req, res) => { req.on("data", (chunk: Chunk) => chunks.push(chunk)) .once("end", () => { // @ts-ignore `Buffer` is Node-only + // deno-lint-ignore no-node-globals const raw = Buffer.concat(chunks).toString("utf-8"); resolve(JSON.parse(raw)); })