feat: enable telegram reaction notifications by default

This commit is contained in:
Peter Steinberger
2026-01-16 20:51:39 +00:00
parent e7c42884fc
commit 56efbce31e
5 changed files with 38 additions and 5 deletions

View File

@@ -2247,6 +2247,37 @@ describe("createTelegramBot", () => {
expect(enqueueSystemEvent).not.toHaveBeenCalled();
});
it("defaults reactionNotifications to own", async () => {
onSpy.mockReset();
enqueueSystemEvent.mockReset();
wasSentByBot.mockReturnValue(true);
loadConfig.mockReturnValue({
channels: {
telegram: { dmPolicy: "open" },
},
});
createTelegramBot({ token: "tok" });
const handler = getOnHandler("message_reaction") as (
ctx: Record<string, unknown>,
) => Promise<void>;
await handler({
update: { update_id: 502 },
messageReaction: {
chat: { id: 1234, type: "private" },
message_id: 43,
user: { id: 9, first_name: "Ada" },
date: 1736380800,
old_reaction: [],
new_reaction: [{ type: "emoji", emoji: "👍" }],
},
});
expect(enqueueSystemEvent).toHaveBeenCalledTimes(1);
});
it("allows reaction in all mode regardless of message sender", async () => {
onSpy.mockReset();
enqueueSystemEvent.mockReset();

View File

@@ -322,8 +322,8 @@ export function createTelegramBot(opts: TelegramBotOptions) {
const messageId = reaction.message_id;
const user = reaction.user;
// Resolve reaction notification mode (default: "off")
const reactionMode = telegramCfg.reactionNotifications ?? "off";
// Resolve reaction notification mode (default: "own")
const reactionMode = telegramCfg.reactionNotifications ?? "own";
if (reactionMode === "off") return;
if (user?.is_bot) return;
if (reactionMode === "own" && !wasSentByBot(chatId, messageId)) return;