Comparing version 1.22.4 to 1.23.0
@@ -416,10 +416,6 @@ "use strict"; | ||
debugErr(error.message); | ||
if (error.error_code === 401) { | ||
debugErr("Make sure you are using the bot token you obtained from @BotFather (https://t.me/BotFather)."); | ||
// rethrow upon unauthorized or conflict | ||
if (error.error_code === 401 || error.error_code === 409) { | ||
throw error; | ||
} | ||
else if (error.error_code === 409) { | ||
debugErr("Consider revoking the bot token if you believe that no other instance is running."); | ||
throw error; | ||
} | ||
else if (error.error_code === 429) { | ||
@@ -426,0 +422,0 @@ debugErr("Bot API server is closing."); |
@@ -123,3 +123,3 @@ import { type MiddlewareFn } from "../composer.js"; | ||
* The default implementation will store sessions per chat, as determined by | ||
* `ctx.chat?.id`. | ||
* `ctx.chatId`. | ||
*/ | ||
@@ -126,0 +126,0 @@ getSessionKey?: (ctx: Omit<C, "session">) => MaybePromise<string | undefined>; |
@@ -249,3 +249,3 @@ "use strict"; | ||
var _a; | ||
return (_a = ctx.chat) === null || _a === void 0 ? void 0 : _a.id.toString(); | ||
return (_a = ctx.chatId) === null || _a === void 0 ? void 0 : _a.toString(); | ||
} | ||
@@ -252,0 +252,0 @@ /** Returns a useful error message for when the session key is undefined */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toHttpError = exports.HttpError = exports.toGrammyError = exports.GrammyError = void 0; | ||
const platform_node_js_1 = require("../platform.node.js"); | ||
const debug = (0, platform_node_js_1.debug)("grammy:warn"); | ||
/** | ||
@@ -35,2 +37,10 @@ * This class represents errors that are thrown by grammY because the Telegram | ||
function toGrammyError(err, method, payload) { | ||
switch (err.error_code) { | ||
case 401: | ||
debug("Error 401 means that your bot token is wrong, talk to https://t.me/BotFather to check it."); | ||
break; | ||
case 409: | ||
debug("Error 409 means that you are running your bot several times on long polling. Consider revoking the bot token if you believe that no other instance is running."); | ||
break; | ||
} | ||
return new GrammyError(`Call to '${method}' failed!`, err, method, payload); | ||
@@ -37,0 +47,0 @@ } |
@@ -139,2 +139,3 @@ import { type Context } from "./context.js"; | ||
readonly pinned_message: {}; | ||
readonly chat_background_set: {}; | ||
readonly invoice: {}; | ||
@@ -256,2 +257,3 @@ readonly proximity_alert_triggered: {}; | ||
readonly pinned_message: {}; | ||
readonly chat_background_set: {}; | ||
readonly invoice: {}; | ||
@@ -341,2 +343,3 @@ readonly proximity_alert_triggered: {}; | ||
readonly pinned_message: {}; | ||
readonly chat_background_set: {}; | ||
readonly invoice: {}; | ||
@@ -426,2 +429,3 @@ readonly proximity_alert_triggered: {}; | ||
readonly pinned_message: {}; | ||
readonly chat_background_set: {}; | ||
readonly invoice: {}; | ||
@@ -547,2 +551,3 @@ readonly proximity_alert_triggered: {}; | ||
readonly pinned_message: {}; | ||
readonly chat_background_set: {}; | ||
readonly invoice: {}; | ||
@@ -664,2 +669,3 @@ readonly proximity_alert_triggered: {}; | ||
readonly pinned_message: {}; | ||
readonly chat_background_set: {}; | ||
readonly invoice: {}; | ||
@@ -807,7 +813,8 @@ readonly proximity_alert_triggered: {}; | ||
msg: [U["message"]] extends [object] ? U["message"] : [U["edited_message"]] extends [object] ? U["edited_message"] : [U["channel_post"]] extends [object] ? U["channel_post"] : [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : [U["business_message"]] extends [object] ? U["business_message"] : [U["edited_business_message"]] extends [object] ? U["edited_business_message"] : [U["callback_query"]] extends [object] ? U["callback_query"]["message"] : undefined; | ||
chat: [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["chat"] : [U["deleted_business_messages"]] extends [object] ? U["deleted_business_messages"]["chat"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["chat"] : [U["message_reaction_count"]] extends [object] ? U["message_reaction_count"]["chat"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [object] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["chat"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["chat"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["chat"] : undefined; | ||
chat: [U["callback_query"]] extends [object] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["chat"] : [U["deleted_business_messages"]] extends [object] ? U["deleted_business_messages"]["chat"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["chat"] : [U["message_reaction_count"]] extends [object] ? U["message_reaction_count"]["chat"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [object] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["chat"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["chat"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["chat"] : undefined; | ||
senderChat: [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["sender_chat"] : undefined; | ||
from: [U["business_connection"]] extends [object] ? U["business_connection"]["user"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["user"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["boost"]["source"]["user"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["source"]["user"] : [U["callback_query"]] extends [object] ? U["callback_query"]["from"] : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["from"] : [U["inline_query"]] extends [object] ? U["inline_query"]["from"] : [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"]["from"] : [U["shipping_query"]] extends [object] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"]["from"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [object] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["from"] : undefined; | ||
msgId: [Shortcuts<U>["msg"]] extends [object] ? number : U["message_reaction"] extends [object] ? number : U["message_reaction_count"] extends [object] ? number : undefined; | ||
businessConnectionId: [Shortcuts<U>["msg"]] extends [object] ? string | undefined : [U["business_connection"]] extends [object] ? [U["business_connection"]["id"]] : [U["deleted_business_messages"]] extends [object] ? [U["deleted_business_messages"]["business_connection_id"]] : undefined; | ||
msgId: [U["callback_query"]] extends [object] ? number | undefined : [Shortcuts<U>["msg"]] extends [object] ? number : [U["message_reaction"]] extends [object] ? number : [U["message_reaction_count"]] extends [object] ? number : undefined; | ||
chatId: [Shortcuts<U>["chat"]] extends [object] ? number : [U["business_connection"]] extends [object] ? number : undefined; | ||
businessConnectionId: [U["callback_query"]] extends [object] ? string | undefined : [Shortcuts<U>["msg"]] extends [object] ? string | undefined : [U["business_connection"]] extends [object] ? string : [U["deleted_business_messages"]] extends [object] ? string : undefined; | ||
} | ||
@@ -851,6 +858,5 @@ declare const L1_SHORTCUTS: { | ||
entities: "text"; | ||
caption: CaptionMessages; | ||
caption_entities: CaptionMessages; | ||
caption_entities: "caption"; | ||
is_topic_message: "message_thread_id"; | ||
}; | ||
type CaptionMessages = "animation" | "audio" | "document" | "photo" | "video" | "voice"; | ||
export {}; |
@@ -275,2 +275,3 @@ "use strict"; | ||
pinned_message: {}, | ||
chat_background_set: {}, | ||
invoice: {}, | ||
@@ -277,0 +278,0 @@ proximity_alert_triggered: {}, |
{ | ||
"name": "grammy", | ||
"description": "The Telegram Bot Framework.", | ||
"version": "1.22.4", | ||
"version": "1.23.0", | ||
"author": "KnorpelSenf", | ||
@@ -20,3 +20,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@grammyjs/types": "3.6.2", | ||
"@grammyjs/types": "3.7.0", | ||
"abort-controller": "^3.0.0", | ||
@@ -23,0 +23,0 @@ "debug": "^4.3.4", |
@@ -291,2 +291,6 @@ <div align="center"><a href="https://grammy.dev"><img src="https://raw.githubusercontent.com/grammyjs/website/main/logos/grammY.png" alt="grammY"></a></h1></div> | ||
<td align="center" valign="top" width="11.11%"><a href="http://gabelluardo.github.io"><img src="https://avatars.githubusercontent.com/u/42920247?v=4?s=100" width="100px;" alt="Gabriele Belluardo"/><br /><sub><b>Gabriele Belluardo</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Agabelluardo" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=gabelluardo" title="Code">π»</a></td> | ||
<td align="center" valign="top" width="11.11%"><a href="https://github.com/dimpurr"><img src="https://avatars.githubusercontent.com/u/5173244?v=4?s=100" width="100px;" alt="Dim Chen"/><br /><sub><b>Dim Chen</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adimpurr" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dimpurr" title="Code">π»</a></td> | ||
<td align="center" valign="top" width="11.11%"><a href="http://www.fwqaq.us"><img src="https://avatars.githubusercontent.com/u/82551626?v=4?s=100" width="100px;" alt="fwqaaq"/><br /><sub><b>fwqaaq</b></sub></a><br /><a href="#ideas-fwqaaq" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/commits?author=fwqaaq" title="Code">π»</a></td> | ||
<td align="center" valign="top" width="11.11%"><a href="https://github.com/janek"><img src="https://avatars.githubusercontent.com/u/2146927?v=4?s=100" width="100px;" alt="Janek Szynal"/><br /><sub><b>Janek Szynal</b></sub></a><br /><a href="#ideas-janek" title="Ideas, Planning, & Feedback">π€</a></td> | ||
<td align="center" valign="top" width="11.11%"><a href="https://github.com/mordv"><img src="https://avatars.githubusercontent.com/u/32086218?v=4?s=100" width="100px;" alt="Alexander Mordvinov"/><br /><sub><b>Alexander Mordvinov</b></sub></a><br /><a href="#ideas-mordv" title="Ideas, Planning, & Feedback">π€</a></td> | ||
</tr> | ||
@@ -293,0 +297,0 @@ </tbody> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1002543
19977
306
+ Added@grammyjs/types@3.7.0(transitive)
- Removed@grammyjs/types@3.6.2(transitive)
Updated@grammyjs/types@3.7.0