Skip to content
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@grammyjs/parse-mode": "^1.11.1",
"@grammyjs/runner": "^2.0.3",
"@influxdata/influxdb-client": "^1.35.0",
"@polinetwork/backend": "^0.15.5",
"@polinetwork/backend": "^0.15.7",
"@t3-oss/env-core": "^0.13.4",
"@trpc/client": "^11.5.1",
"@types/ssdeep.js": "^0.0.2",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/middlewares/bot-membership-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Filter } from "grammy"
import type { Chat } from "grammy/types"
import { api } from "@/backend"
import { GroupManagement } from "@/lib/group-management"
import { RedisFallbackAdapter } from "@/lib/redis-fallback-adapter"
import { logger } from "@/logger"
Expand Down Expand Up @@ -47,9 +48,14 @@ export class BotMembershipHandler<C extends TelemetryContextFlavor<Context>> ext
super("bot_membership_handler")

// TEMP: this is for initial migration from previous bot
this.composer.filter(predicate, async (ctx, next) => {
this.composer.fork().filter(predicate, async (ctx, next) => {
if (ctx.chat.type === "private") return next()
if (await this.TEMP_redis.has(ctx.chat.id.toString())) return next()

const redisCheck = await this.TEMP_redis.has(ctx.chat.id.toString())
if (redisCheck) {
const backendGroup = await api.tg.groups.getById.query({ telegramId: ctx.chat.id }).catch(() => null)
if (backendGroup !== null) return next()
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

const me = await ctx.getChatMember(ctx.me.id).catch(() => ({ status: "undefined" }))
if (me.status !== "administrator") {
Expand Down
5 changes: 3 additions & 2 deletions src/middlewares/message-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ async function makeResponse(
),
}
}
const inviteLink =
chat.invite_link ?? (await api.tg.groups.getById.query({ telegramId: chat.id }))[0].link ?? undefined

const dbGroup = await api.tg.groups.getById.query({ telegramId: chat.id })
const inviteLink = chat.invite_link ?? dbGroup?.link ?? undefined

const message = await MessageUserStorage.getInstance().get(chatId, messageId)
if (message === null) {
Expand Down
Loading