Skip to content
Open
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
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
redis:
image: redis:7-alpine
container_name: redis_db
restart: always
command: redis-server --requirepass "${REDIS_PASSWORD:-Radmin}"
ports:
- "127.0.0.1:6379:6379"
volumes:
- redis_data:/data

influxdb:
image: influxdb:2.7-alpine
container_name: influx_db
restart: always
ports:
- "127.0.0.1:8086:8086"
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=${INFLUXDB_USERNAME:-Iadmin}
- DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUXDB_PASSWORD:-Iadmin1234567}
- DOCKER_INFLUXDB_INIT_ORG=${INFLUXDB_ORG:-polinetwork}
- DOCKER_INFLUXDB_INIT_BUCKET=${INFLUXDB_BUCKET:-telegram_bot}
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${INFLUXDB_TOKEN:?INFLUXDB_TOKEN is required}
volumes:
- influxdb_data:/var/lib/influxdb2

volumes:
redis_data:
influxdb_data:
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"main": "./dist/bot.js",
"type": "module",
"scripts": {
"start": "NODE_ENV=production node dist/bot.js",
"start": "cross-env NODE_ENV=production node dist/bot.js",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"build": "tsup",
"dev:raw": "NODE_ENV=development tsx watch --clear-screen=false --env-file=.env src/bot.ts",
"dev:raw": "cross-env NODE_ENV=development tsx watch --clear-screen=false --env-file=.env src/bot.ts",
"dev": "pnpm run dev:raw | pino-pretty",
"test": "vitest run",
"typecheck": "tsgo --noEmit",
Expand Down 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.18",
"@polinetwork/backend": "file:../backend/package",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether the local file dependency is resolvable in this checkout.
node - <<'NODE'
const fs = require('fs')
const path = require('path')
const pkg = require('./package.json')
const spec = pkg.dependencies?.['`@polinetwork/backend`']

console.log({ spec })
if (spec?.startsWith('file:')) {
  const target = path.resolve(process.cwd(), spec.slice('file:'.length))
  console.log({ target, exists: fs.existsSync(target) })
  if (!fs.existsSync(target)) process.exitCode = 1
}
NODE

Repository: PoliNetworkOrg/telegram

Length of output: 257


Avoid the sibling-local backend dependency. file:../backend/package only works when that neighboring path exists, so fresh installs in CI or published releases will fail to resolve @polinetwork/backend. Use a workspace dependency or a published semver version instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 42, The package manifest currently depends on a
sibling-local backend path, which breaks installs when that neighboring
directory is absent. Update the dependency for `@polinetwork/backend` in
package.json to use a workspace reference or a published semver version instead
of the file:../backend/package path so fresh CI and release installs can resolve
it reliably.

"@socket.io/devalue-parser": "^0.1.0",
"@t3-oss/env-core": "^0.13.4",
"@trpc/client": "^11.5.1",
Expand All @@ -49,6 +49,7 @@
"nanoid": "^5.1.5",
"neverthrow": "^8.2.0",
"pino": "^10.3.1",
"cross-env": "^7.0.3",
"redis": "^4.7.0",
"secure-json-parse": "^4.0.0",
"socket.io-client": "^4.8.1",
Expand Down
22 changes: 17 additions & 5 deletions pnpm-lock.yaml

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

14 changes: 8 additions & 6 deletions src/commands/moderation/ban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ export const ban = new CommandsCollection<Role>("Banning")
handler: async ({ args, context, repliedTo }) => {
const userOverload = await getOverloadUser(context, repliedTo, args.reasonOrUser, args.reason)
if (userOverload.isErr()) {
void ephemeral(
context.reply(
repliedTo
? fmt(({ n }) => n`There was an error`)
: fmt(({ n }) => n`Target user not found, please try replying to their message`)
if (userOverload.error !== "SILENT_ERROR") {
void ephemeral(
context.reply(
repliedTo
? fmt(({ n }) => n`There was an error`)
: fmt(({ n }) => n`Target user not found, please try replying to their message`)
)
)
)
}
logger.error({ args, repliedTo }, `BAN: ${userOverload.error}`)
return
}
Expand Down
3 changes: 2 additions & 1 deletion src/commands/moderation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import { banAll } from "./banall"
import { del } from "./del"
import { kick } from "./kick"
import { mute } from "./mute"
import { warn } from "./warn"

export const moderation = new CommandsCollection<Role>("Moderation").withCollection(ban, banAll, del, kick, mute)
export const moderation = new CommandsCollection<Role>("Moderation").withCollection(ban, banAll, del, kick, mute, warn)
14 changes: 8 additions & 6 deletions src/commands/moderation/mute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ export const mute = new CommandsCollection<Role>("Muting")
handler: async ({ args, context, repliedTo }) => {
const userOverload = await getOverloadUser(context, repliedTo, args.reasonOrUser, args.reason)
if (userOverload.isErr()) {
void ephemeral(
context.reply(
repliedTo
? fmt(({ n }) => n`There was an error`)
: fmt(({ n }) => n`Target user not found, please try replying to their message`)
if (userOverload.error !== "SILENT_ERROR") {
void ephemeral(
context.reply(
repliedTo
? fmt(({ n }) => n`There was an error`)
: fmt(({ n }) => n`Target user not found, please try replying to their message`)
)
)
)
}
logger.error({ args, repliedTo }, `MUTE: ${userOverload.error}`)
return
}
Expand Down
Loading
Loading