diff --git a/package.json b/package.json index 85b433b1..8189da92 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "backport": "deno2node tsconfig.json" }, "dependencies": { - "@grammyjs/types": "3.4.3", + "@grammyjs/types": "3.4.4", "abort-controller": "^3.0.0", "debug": "^4.3.4", "node-fetch": "^2.7.0" diff --git a/src/context.ts b/src/context.ts index 52d11d70..8a314dd7 100644 --- a/src/context.ts +++ b/src/context.ts @@ -220,7 +220,7 @@ const checker: StaticHas = { } else if (reaction.type === "custom_emoji") { for (const old of old_reaction) { if (old.type !== "custom_emoji") continue; - if (old.custom_emoji === reaction.custom_emoji) { + if (old.custom_emoji_id === reaction.custom_emoji_id) { isOld = true; break; } @@ -239,7 +239,10 @@ const checker: StaticHas = { } else if (reaction.type === "custom_emoji") { for (const wanted of normalized) { if (wanted.type !== "custom_emoji") continue; - if (wanted.custom_emoji === reaction.custom_emoji) { + if ( + wanted.custom_emoji_id === + reaction.custom_emoji_id + ) { return true; } } @@ -614,7 +617,7 @@ export class Context implements RenamedUpdate { if (reaction.type === "emoji") { emoji.push(reaction.emoji); } else if (reaction.type === "custom_emoji") { - customEmoji.push(reaction.custom_emoji); + customEmoji.push(reaction.custom_emoji_id); } } // temporarily move all old emoji to the *Removed arrays @@ -622,7 +625,7 @@ export class Context implements RenamedUpdate { if (reaction.type === "emoji") { emojiRemoved.push(reaction.emoji); } else if (reaction.type === "custom_emoji") { - customEmojiRemoved.push(reaction.custom_emoji); + customEmojiRemoved.push(reaction.custom_emoji_id); } } // temporarily move all new emoji to the *Added arrays diff --git a/src/types.deno.ts b/src/types.deno.ts index e36bf168..b6796673 100644 --- a/src/types.deno.ts +++ b/src/types.deno.ts @@ -11,13 +11,13 @@ import { type InputMediaVideo as InputMediaVideoF, type InputSticker as InputStickerF, type Opts as OptsF, -} from "https://deno.land/x/grammy_types@v3.4.3/mod.ts"; +} from "https://deno.land/x/grammy_types@v3.4.4/mod.ts"; import { debug as d, isDeno } from "./platform.deno.ts"; const debug = d("grammy:warn"); // === Export all API types -export * from "https://deno.land/x/grammy_types@v3.4.3/mod.ts"; +export * from "https://deno.land/x/grammy_types@v3.4.4/mod.ts"; /** A value, or a potentially async function supplying that value */ type MaybeSupplier = T | (() => T | Promise); diff --git a/src/types.web.ts b/src/types.web.ts index 1944ff2e..06f36ea3 100644 --- a/src/types.web.ts +++ b/src/types.web.ts @@ -10,10 +10,10 @@ import { type InputMediaVideo as InputMediaVideoF, type InputSticker as InputStickerF, type Opts as OptsF, -} from "https://deno.land/x/grammy_types@v3.4.3/mod.ts"; +} from "https://deno.land/x/grammy_types@v3.4.4/mod.ts"; // === Export all API types -export * from "https://deno.land/x/grammy_types@v3.4.3/mod.ts"; +export * from "https://deno.land/x/grammy_types@v3.4.4/mod.ts"; /** Something that looks like a URL. */ interface URLLike { diff --git a/test/context.test.ts b/test/context.test.ts index 8201b932..347e2f22 100644 --- a/test/context.test.ts +++ b/test/context.test.ts @@ -261,11 +261,11 @@ describe("Context", () => { message_id: 2, old_reaction: [ { type: "emoji", emoji: "🎉" }, - { type: "custom_emoji", custom_emoji: "id" }, + { type: "custom_emoji", custom_emoji_id: "id" }, ], new_reaction: [ { type: "emoji", emoji: "🎉" }, - { type: "custom_emoji", custom_emoji: "id" }, + { type: "custom_emoji", custom_emoji_id: "id" }, { type: "emoji", emoji: "👍" }, ], }, @@ -283,7 +283,10 @@ describe("Context", () => { assertFalse(Context.has.reaction("👎")(ctx)); assertFalse(ctx.hasReaction("👎")); - const added = { type: "custom_emoji" as const, custom_emoji: "id_new" }; + const added = { + type: "custom_emoji" as const, + custom_emoji_id: "id_new", + }; up = { update_id: 0, message_reaction: { @@ -292,11 +295,11 @@ describe("Context", () => { message_id: 2, old_reaction: [ { type: "emoji", emoji: "🎉" }, - { type: "custom_emoji", custom_emoji: "id" }, + { type: "custom_emoji", custom_emoji_id: "id" }, ], new_reaction: [ { type: "emoji", emoji: "🎉" }, - { type: "custom_emoji", custom_emoji: "id" }, + { type: "custom_emoji", custom_emoji_id: "id" }, added, ], }, @@ -526,9 +529,9 @@ describe("Context", () => { const ye = { type: "emoji", emoji: "👍" }; const no = { type: "emoji", emoji: "👎" }; const ok = { type: "emoji", emoji: "👌" }; - const cye = { type: "custom_emoji", custom_emoji: "id-ye" }; - const cno = { type: "custom_emoji", custom_emoji: "id-no" }; - const cok = { type: "custom_emoji", custom_emoji: "id-ok" }; + const cye = { type: "custom_emoji", custom_emoji_id: "id-ye" }; + const cno = { type: "custom_emoji", custom_emoji_id: "id-no" }; + const cok = { type: "custom_emoji", custom_emoji_id: "id-ok" }; let up = { message_reaction: { old_reaction: [ye, no, cye, cno], @@ -550,10 +553,10 @@ describe("Context", () => { assertEquals(emojiRemoved, [ye.emoji]); assertEquals(emojiKept, [no.emoji]); assertEquals(emojiAdded, [ok.emoji]); - assertEquals(customEmoji, [cok.custom_emoji, cno.custom_emoji]); - assertEquals(customEmojiRemoved, [cye.custom_emoji]); - assertEquals(customEmojiKept, [cno.custom_emoji]); - assertEquals(customEmojiAdded, [cok.custom_emoji]); + assertEquals(customEmoji, [cok.custom_emoji_id, cno.custom_emoji_id]); + assertEquals(customEmojiRemoved, [cye.custom_emoji_id]); + assertEquals(customEmojiKept, [cno.custom_emoji_id]); + assertEquals(customEmojiAdded, [cok.custom_emoji_id]); up = { message: update.message } as Update; ctx = new Context(up, api, me);