Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update deno2node, fix docs, add suggestions to sendDice #626

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
13 changes: 10 additions & 3 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<never, never>)
| "🎲"
| "🎯"
| "🏀"
| "⚽"
| "🎳"
| "🎰",
other?: Other<"sendDice", "chat_id" | "emoji">,
signal?: AbortSignal,
) {
Expand Down Expand Up @@ -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">,
Expand Down
1 change: 1 addition & 0 deletions src/convenience/frameworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
})
Expand Down
13 changes: 10 additions & 3 deletions src/core/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,22 @@ export class Api<R extends RawApi = RawApi> {
* 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
*
* **Official reference:** https://core.telegram.org/bots/api#senddice
*/
sendDice(
chat_id: number | string,
emoji: string,
emoji:
| (string & Record<never, never>)
| "🎲"
| "🎯"
| "🏀"
| "⚽"
| "🎳"
| "🎰",
other?: Other<R, "sendDice", "chat_id" | "emoji">,
signal?: AbortSignal,
) {
Expand All @@ -790,7 +797,7 @@ export class Api<R extends RawApi = RawApi> {
* @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,
Expand Down
Loading