mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
refactor!: rebrand miti99bot to tiennm99bot
BREAKING CHANGE: the Go module path is now github.com/tiennm99/tiennm99bot, the default sticker pack is stickers_by_<bot username>, and the health body, deploy DM, User-Agents and image names say tiennm99bot.
This commit is contained in:
1 parent
79104ef3d7
commit
7008a57cf5
160 files changed
+388
-387
No files matched your search
+3
-3
@@ -1,4 +1,4 @@
|
||||
# miti99bot — self-host (Coolify + MongoDB Atlas) environment.
|
||||
# tiennm99bot — self-host (Coolify + MongoDB Atlas) environment.
|
||||
# Copy to .env and fill in. .env is gitignored — never commit real secrets.
|
||||
|
||||
# ============================ Required ============================
|
||||
@@ -9,7 +9,7 @@ TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
|
||||
# db username + password — treat it as a secret (it is never logged).
|
||||
# Create a least-privilege user: readWrite on this one database only.
|
||||
MONGO_URL=mongodb+srv://botuser:STRONG_UNIQUE_PASSWORD@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority
|
||||
MONGO_DATABASE=miti99bot
|
||||
MONGO_DATABASE=tiennm99bot
|
||||
|
||||
# ============================ Operational =========================
|
||||
# Comma-separated module list. Empty = load every module, including any module
|
||||
@@ -30,7 +30,7 @@ BOT_USERNAME=
|
||||
# MUST end in _by_<this bot username>: Telegram requires that suffix on sets a
|
||||
# bot creates and refuses to edit sets it did not create, so the suffix is what
|
||||
# proves the pack is manageable. Created automatically, owned by OWNER_ID, on
|
||||
# the first /addsticker if it does not exist yet. Unset = miti99_by_<bot username>.
|
||||
# the first /addsticker if it does not exist yet. Unset = stickers_by_<bot username>.
|
||||
STICKER_PACK_NAME=
|
||||
|
||||
# SOURCE_COMMIT (commit SHA) is read at startup for the deploynotify owner DM.
|
||||
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
run: go build ./...
|
||||
|
||||
- name: docker build
|
||||
run: docker build -t miti99bot .
|
||||
run: docker build -t tiennm99bot .
|
||||
|
||||
renderer:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -99,4 +99,4 @@ jobs:
|
||||
- run: npm run api:smoke
|
||||
|
||||
- name: docker build
|
||||
run: docker build -t miti99bot-renderer .
|
||||
run: docker build -t tiennm99bot-renderer .
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Project Context
|
||||
|
||||
`miti99bot` is a Go Telegram bot with pluggable modules under
|
||||
`tiennm99bot` is a Go Telegram bot with pluggable modules under
|
||||
`internal/modules`. Runtime storage is MongoDB when `MONGO_URL` is set and
|
||||
in-memory otherwise, which is what tests and local no-database runs use. Read
|
||||
`README.md` before implementation work.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# miti99bot
|
||||
# tiennm99bot
|
||||
|
||||
Plug-n-play Telegram bot framework in Go. Self-hosted on Coolify + MongoDB
|
||||
Atlas via long polling and an in-process cron scheduler.
|
||||
@@ -286,13 +286,13 @@ variable, and [`.env.example`](.env.example) for a template.
|
||||
Persistent MongoDB locally (auto-selected when `MONGO_URL` is set):
|
||||
|
||||
```sh
|
||||
docker run -d --rm --name miti99bot-mongo -p 27017:27017 mongo:8
|
||||
docker run -d --rm --name tiennm99bot-mongo -p 27017:27017 mongo:8
|
||||
```
|
||||
|
||||
Then set `MONGO_URL=mongodb://127.0.0.1:27017` and
|
||||
`MONGO_DATABASE=miti99bot_dev` using the shell syntax above before running
|
||||
`MONGO_DATABASE=tiennm99bot_dev` using the shell syntax above before running
|
||||
`go run ./cmd/server`. Stop the local database with
|
||||
`docker stop miti99bot-mongo`.
|
||||
`docker stop tiennm99bot-mongo`.
|
||||
|
||||
MongoDB integration tests use Testcontainers to start MongoDB 8 automatically.
|
||||
Keep Docker Desktop or another compatible Docker daemon running, then use the
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
func TestResolveBotUsername(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
)
|
||||
|
||||
const commandMenuTimeout = 8 * time.Second
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/stock"
|
||||
moduleutil "github.com/tiennm99/miti99bot/internal/modules/util"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/stock"
|
||||
moduleutil "github.com/tiennm99/tiennm99bot/internal/modules/util"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
func TestBotCommandMenu_UsesLoadedPublicCommandsInModuleOrder(t *testing.T) {
|
||||
|
||||
+26
-26
@@ -1,4 +1,4 @@
|
||||
// Command server runs miti99bot: it loads configuration from the environment,
|
||||
// Command server runs tiennm99bot: it loads configuration from the environment,
|
||||
// opens the storage backend, builds the module registry, and then serves
|
||||
// Telegram updates by long polling while an in-process scheduler fires module
|
||||
// crons. A small HTTP server answers the container health check.
|
||||
@@ -19,31 +19,31 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/cron"
|
||||
"github.com/tiennm99/miti99bot/internal/deploynotify"
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/metrics"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/alias"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/amlich"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/blacklist"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/coin"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/gold"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/lol"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/loldle"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/misc"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/random"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/stats"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/sticker"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/weather"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/wordle"
|
||||
"github.com/tiennm99/miti99bot/internal/server"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/systemstate"
|
||||
"github.com/tiennm99/miti99bot/internal/telegram"
|
||||
"github.com/tiennm99/tiennm99bot/internal/cron"
|
||||
"github.com/tiennm99/tiennm99bot/internal/deploynotify"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/metrics"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/alias"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/amlich"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/blacklist"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/coin"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/gold"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/lol"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/loldle"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/misc"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/random"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/stats"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/sticker"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/weather"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/wordle"
|
||||
"github.com/tiennm99/tiennm99bot/internal/server"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/systemstate"
|
||||
"github.com/tiennm99/tiennm99bot/internal/telegram"
|
||||
)
|
||||
|
||||
// gitSHA is the local-build fallback read from the VCS metadata that go build
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/systemstate"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/systemstate"
|
||||
)
|
||||
|
||||
func TestResolveCommitSHA(t *testing.T) {
|
||||
|
||||
+4
-4
@@ -3,13 +3,13 @@ services:
|
||||
build:
|
||||
context: .
|
||||
# Or pin a prebuilt image instead of building:
|
||||
# image: ghcr.io/tiennm99/miti99bot:latest
|
||||
# image: ghcr.io/tiennm99/tiennm99bot:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# --- Required ---
|
||||
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN} # from @BotFather — SECRET
|
||||
MONGO_URL: ${MONGO_URL} # Atlas SRV string incl. credentials — SECRET
|
||||
MONGO_DATABASE: ${MONGO_DATABASE} # e.g. miti99bot
|
||||
MONGO_DATABASE: ${MONGO_DATABASE} # e.g. tiennm99bot
|
||||
|
||||
# --- Optional (commented out; the code falls back to each default) ---
|
||||
# Coolify injects every dashboard variable into each service through its
|
||||
@@ -24,7 +24,7 @@ services:
|
||||
# LOL_PANDASCORE_TOKEN: ${LOL_PANDASCORE_TOKEN:-} # PandaScore token — SECRET; empty = /lol* fetches fail
|
||||
# GOLD_VNAPP_API_KEY: ${GOLD_VNAPP_API_KEY:-} # VNAppMob key — SECRET; empty = fetched and cached in Mongo
|
||||
# BOT_USERNAME: ${BOT_USERNAME:-} # bot username without "@"; empty = getMe at startup
|
||||
# STICKER_PACK_NAME: ${STICKER_PACK_NAME:-} # /addsticker set; empty = miti99_by_<bot username>
|
||||
# STICKER_PACK_NAME: ${STICKER_PACK_NAME:-} # /addsticker set; empty = stickers_by_<bot username>
|
||||
# LOG_LEVEL: ${LOG_LEVEL:-info} # debug|info|warn|error
|
||||
|
||||
# --- Fixed by this stack (not Coolify settings) ---
|
||||
@@ -50,7 +50,7 @@ services:
|
||||
expose:
|
||||
- "8080"
|
||||
# Coolify's UI health check does not apply to Docker Compose apps; it reads
|
||||
# this block instead. GET / returns text/plain "miti99bot ok". It proves the
|
||||
# this block instead. GET / returns text/plain "tiennm99bot ok". It proves the
|
||||
# process is serving, not that Mongo is reachable — see
|
||||
# docs/deploy-coolify-selfhosted.md. busybox wget ships in the Alpine image.
|
||||
healthcheck:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Deploy: Self-host (Coolify + MongoDB Atlas)
|
||||
|
||||
Run `miti99bot` as a long-lived container on [Coolify](https://coolify.io) with
|
||||
Run `tiennm99bot` as a long-lived container on [Coolify](https://coolify.io) with
|
||||
[MongoDB Atlas](https://www.mongodb.com/atlas) (free M0) for storage.
|
||||
|
||||
## Architecture
|
||||
@@ -30,12 +30,12 @@ Copy [`.env.example`](../.env.example) → `.env` (gitignored) and fill in.
|
||||
|---|---|---|
|
||||
| `TELEGRAM_BOT_TOKEN` | ✅ | from @BotFather; startup fails without it |
|
||||
| `MONGO_URL` | ✅ | Atlas SRV string **incl. credentials** — secret, never logged |
|
||||
| `MONGO_DATABASE` | ✅ | e.g. `miti99bot` |
|
||||
| `MONGO_DATABASE` | ✅ | e.g. `tiennm99bot` |
|
||||
| `MODULES` | optional | CSV; empty = all modules, including any added later |
|
||||
| `OWNER_ID` | optional | Telegram user id for owner-only commands, the deploy DM, and the `/addsticker` pack owner. Unset = owner-only commands are denied and `/addsticker` refuses |
|
||||
| `ADMIN_IDS` | optional | CSV of Telegram user ids for admin-only commands |
|
||||
| `BOT_USERNAME` | optional | the bot's Telegram username, without `@`; unset = asked from Telegram (`getMe`) once at startup. Used for the default sticker pack name and the lol User-Agent |
|
||||
| `STICKER_PACK_NAME` | optional | set `/addsticker` writes to; default `miti99_by_<bot username>`. See [sticker packs](sticker-packs.md) |
|
||||
| `STICKER_PACK_NAME` | optional | set `/addsticker` writes to; default `stickers_by_<bot username>`. See [sticker packs](sticker-packs.md) |
|
||||
| `LOL_PANDASCORE_TOKEN` | optional | PandaScore API token for the lol module (free tier) — secret, never logged; without it every `/lol*` fetch fails (stale cache may still serve briefly) |
|
||||
| `RENDERER_URL` | leave unset | base URL of the animation renderer; fixed by `compose.yml` to the bundled renderer (`http://renderer:3000`), so a Coolify value is ignored |
|
||||
| `LOG_LEVEL` | optional | `debug`, `info` (default), `warn`, or `error`; logs are JSON on stdout |
|
||||
@@ -115,7 +115,7 @@ MP4, with the same text fallback.
|
||||
|
||||
1. Create a free **M0** cluster (512 MB — ample for the tiny paper-trading KV).
|
||||
2. **Database user (least privilege):** create a user with role
|
||||
**`readWrite` on the single app database only** (e.g. `miti99bot`) — never
|
||||
**`readWrite` on the single app database only** (e.g. `tiennm99bot`) — never
|
||||
Atlas admin or cluster-wide. Use a **strong unique password**.
|
||||
3. **Network access:** add `0.0.0.0/0`.
|
||||
|
||||
@@ -181,7 +181,7 @@ MP4, with the same text fallback.
|
||||
6. **Health check:** Coolify's UI health-check settings do not apply to
|
||||
Docker Compose apps; Coolify reads each service's `healthcheck:` in
|
||||
`compose.yml` instead. The `bot` service checks `GET /` (returns
|
||||
`text/plain` `miti99bot ok`) with the image's busybox `wget`, and the
|
||||
`text/plain` `tiennm99bot ok`) with the image's busybox `wget`, and the
|
||||
`renderer` service checks `/api/healthz`. Note: `/` reports healthy even if
|
||||
Mongo is unreachable (the driver auto-reconnects on the next op); a DB
|
||||
outage will not mark the container unhealthy — accepted trade-off.
|
||||
@@ -246,5 +246,5 @@ endpoint from inside the container:
|
||||
docker compose exec bot wget -qO- http://127.0.0.1:8080/
|
||||
```
|
||||
|
||||
It returns `miti99bot ok`. The bot's webhook must be unset (the container
|
||||
It returns `tiennm99bot ok`. The bot's webhook must be unset (the container
|
||||
clears it on startup) or `getUpdates` 409s.
|
||||
@@ -24,7 +24,7 @@ Single-shot: one message replying to the media to add. No conversation state.
|
||||
|
||||
| Env | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `STICKER_PACK_NAME` | `miti99_by_<bot username>` | The Telegram set to write to |
|
||||
| `STICKER_PACK_NAME` | `stickers_by_<bot username>` | The Telegram set to write to |
|
||||
| `OWNER_ID` | — | Must be the account that **owns** that set |
|
||||
|
||||
`OWNER_ID` is reused rather than given a sticker-specific twin because
|
||||
@@ -52,7 +52,7 @@ before any download or API call:
|
||||
|
||||
**The pack creates itself on first use.** If the set does not exist, the first
|
||||
`/addsticker` creates it — owned by `OWNER_ID`, titled with the slug half of the
|
||||
name (`miti99_by_examplebot` → *miti99*), and seeded with the sticker that
|
||||
name (`stickers_by_examplebot` → *stickers*), and seeded with the sticker that
|
||||
triggered it, because Telegram cannot create an empty set. The reply says
|
||||
*"Created the shared pack with this sticker."*
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/tiennm99/miti99bot
|
||||
module github.com/tiennm99/tiennm99bot
|
||||
|
||||
go 1.26.5
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
)
|
||||
|
||||
// cronTimeout caps a single in-process cron fire so a slow handler cannot
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// buildReg builds a registry with a single module exposing one cron whose
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
)
|
||||
|
||||
// defaultTimeout caps the whole Run path (Telegram send) so a misbehaving
|
||||
@@ -71,7 +71,7 @@ func skipReason(cfg Config) string {
|
||||
// renderMessage builds the DM text. Keep the format stable so the owner can
|
||||
// search their Telegram history by SHA.
|
||||
func renderMessage(sha string) string {
|
||||
return fmt.Sprintf("🚀 miti99bot deployed: %s", sha)
|
||||
return fmt.Sprintf("🚀 tiennm99bot deployed: %s", sha)
|
||||
}
|
||||
|
||||
// sendMessage routes through Config.Sender when set (tests); otherwise it
|
||||
|
||||
@@ -86,7 +86,7 @@ func TestRenderMessage_ContainsSHA(t *testing.T) {
|
||||
if !strings.Contains(got, "deadbeef") {
|
||||
t.Errorf("message %q missing SHA", got)
|
||||
}
|
||||
if !strings.Contains(got, "miti99bot") {
|
||||
if !strings.Contains(got, "tiennm99bot") {
|
||||
t.Errorf("message %q missing bot name", got)
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
)
|
||||
|
||||
// DefaultFlushInterval is how often Run flushes counters to the log. 60s
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
logger "github.com/tiennm99/miti99bot/internal/log"
|
||||
logger "github.com/tiennm99/tiennm99bot/internal/log"
|
||||
)
|
||||
|
||||
// captureLogger swaps the package-level logger for one writing to buf and
|
||||
|
||||
@@ -16,8 +16,8 @@ package alias
|
||||
import (
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// Alias is one name-to-content binding.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// inlineQuery builds an inline-mode update: "@botname <query>" typed in any chat.
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/alias"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/alias"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// The headline of the fallback: a saved name becomes its own command.
|
||||
@@ -40,9 +40,9 @@ func TestFallback_ToleratesAtBotnameSuffix(t *testing.T) {
|
||||
|
||||
rb.Reset()
|
||||
// The fixture builder stops the entity at '@', but real Telegram includes
|
||||
// the whole "/cheer@miti99bot" in it — which is the case the stripping
|
||||
// the whole "/cheer@tiennm99bot" in it — which is the case the stripping
|
||||
// exists for, so the entity is widened here to match the wire format.
|
||||
upd := testutil.NewPrivateMessage(7, "/cheer@miti99bot")
|
||||
upd := testutil.NewPrivateMessage(7, "/cheer@tiennm99bot")
|
||||
upd.Message.Entities[0].Length = len(upd.Message.Text)
|
||||
rb.Bot.ProcessUpdate(context.Background(), upd)
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/alias"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/alias"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installAlias builds a registry holding only the alias module. Every command
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package amlich
|
||||
|
||||
import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
)
|
||||
|
||||
// New is the module Factory. The module is stateless — pure calendar math with
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
// saigonLocation pins "today" for /amlich without an argument. FixedZone (not
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installAmlich wires the amlich module to a recording bot. The module is
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
package blacklist
|
||||
|
||||
import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// Entry is one stored rule.
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/blacklist"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/blacklist"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installBlacklist builds a registry holding only this module. Every command is
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
package coin
|
||||
|
||||
import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// New is the coin paper-trading module factory. Like every module it is
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
func TestHandleBuyAcceptsCoinFirstOrder(t *testing.T) {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
type fakePriceFetcher struct {
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/keylock"
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/keylock"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
type priceFetcher interface {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// coinDustEpsilon is the tolerance below which balances and quantities are
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
func TestLoadPortfolioFirstTimeUser(t *testing.T) {
|
||||
|
||||
@@ -258,7 +258,7 @@ func getJSON(ctx context.Context, client *http.Client, endpoint string) (*http.R
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("build request: %w", err)
|
||||
}
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (miti99bot)")
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (tiennm99bot)")
|
||||
if client == nil {
|
||||
client = &http.Client{Timeout: coinHTTPTimeout}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
func (s *state) handleStats(ctx context.Context, b *bot.Bot, update *models.Update) error {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// blockingPriceFetcher simulates an upstream that never responds: it blocks
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/metrics"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/metrics"
|
||||
)
|
||||
|
||||
// Auth gates Protected/Private commands by sender Telegram user ID. Public
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/metrics"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/metrics"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// The bot dispatches updates inline on a single polling goroutine
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
)
|
||||
|
||||
func TestAuth_Permits(t *testing.T) {
|
||||
@@ -89,13 +89,13 @@ func TestMatchCommand(t *testing.T) {
|
||||
// the entity. The upstream library's MatchTypeCommand misses this.
|
||||
name: "group slash-help-at-botname",
|
||||
want: "help",
|
||||
update: mkUpdate("/help@miti99bot", cmd(0, 15)),
|
||||
update: mkUpdate("/help@tiennm99bot", cmd(0, 15)),
|
||||
expect: true,
|
||||
},
|
||||
{
|
||||
name: "group slash-help-at-botname with trailing arg",
|
||||
want: "help",
|
||||
update: mkUpdate("/help@miti99bot arg", cmd(0, 15)),
|
||||
update: mkUpdate("/help@tiennm99bot arg", cmd(0, 15)),
|
||||
expect: true,
|
||||
},
|
||||
{
|
||||
@@ -107,7 +107,7 @@ func TestMatchCommand(t *testing.T) {
|
||||
{
|
||||
name: "different command with botname no match",
|
||||
want: "help",
|
||||
update: mkUpdate("/info@miti99bot", cmd(0, 15)),
|
||||
update: mkUpdate("/info@tiennm99bot", cmd(0, 15)),
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
@@ -137,7 +137,7 @@ func TestMatchCommand(t *testing.T) {
|
||||
{
|
||||
name: "uppercase command with botname matches",
|
||||
want: "help",
|
||||
update: mkUpdate("/HELP@miti99bot", cmd(0, 15)),
|
||||
update: mkUpdate("/HELP@tiennm99bot", cmd(0, 15)),
|
||||
expect: true,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ package gold
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// sjcPriceFetcher is the subset of VNAppMobClient needed by the composite
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// stubVNAppMobClient implements just enough of the VNAppMob client contract
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package gold
|
||||
|
||||
import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
)
|
||||
|
||||
// New is the gold paper-trading module factory. It keeps its portfolio state
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
type fakePriceFetcher struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
func TestHandlersRejectExtraArgs(t *testing.T) {
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/keylock"
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/keylock"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
type priceFetcher interface {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// goldDustEpsilon is the tolerance below which balances and quantities are
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
stockmod "github.com/tiennm99/miti99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
stockmod "github.com/tiennm99/tiennm99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// newGoldStore returns a fresh in-memory typed portfolio store for tests.
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -124,7 +124,7 @@ func (c *VNAppMobClient) fetchSJC(ctx context.Context, key string) (buy, sell fl
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("vnappmob: build request: %w", err)
|
||||
}
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (miti99bot)")
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (tiennm99bot)")
|
||||
req.Header.Set("Authorization", "Bearer "+key)
|
||||
|
||||
resp, err := c.httpClient().Do(req)
|
||||
@@ -230,7 +230,7 @@ func (c *VNAppMobClient) refreshKeyLocked(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("vnappmob: build refresh request: %w", err)
|
||||
}
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (miti99bot)")
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (tiennm99bot)")
|
||||
|
||||
resp, err := c.httpClient().Do(req)
|
||||
if err != nil {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
func newTestVNAppMobClient(srv *httptest.Server, coll storage.Collection) *VNAppMobClient {
|
||||
|
||||
@@ -39,8 +39,8 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -51,7 +51,7 @@ const (
|
||||
|
||||
// userAgentProduct leads the User-Agent; Client.userAgent appends the
|
||||
// running bot's t.me link when its username is known.
|
||||
userAgentProduct = "miti99bot/0.1"
|
||||
userAgentProduct = "tiennm99bot/0.1"
|
||||
// pageSize is PandaScore's per_page maximum; 100 covers a dense day in
|
||||
// one request and a full week in a couple.
|
||||
pageSize = 100
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// setTestToken puts a dummy PandaScore token in the environment so client
|
||||
@@ -424,10 +424,10 @@ func TestTruncate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClientUserAgent(t *testing.T) {
|
||||
if got := (&Client{}).userAgent(); got != "miti99bot/0.1" {
|
||||
if got := (&Client{}).userAgent(); got != "tiennm99bot/0.1" {
|
||||
t.Errorf("no username: got %q", got)
|
||||
}
|
||||
if got := (&Client{BotUsername: "examplebot"}).userAgent(); got != "miti99bot/0.1 (https://t.me/examplebot)" {
|
||||
if got := (&Client{BotUsername: "examplebot"}).userAgent(); got != "tiennm99bot/0.1 (https://t.me/examplebot)" {
|
||||
t.Errorf("with username: got %q", got)
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/subscription"
|
||||
)
|
||||
|
||||
// dailyPushCronName is the cron's registry and in-process scheduler key; it
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// fakeSender records every SendMessage call. errOn returns a transient
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/subscription"
|
||||
)
|
||||
|
||||
// state captures everything a lol handler needs at runtime.
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installSchedule wires the lol module to a recording bot, with a
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package lol
|
||||
|
||||
import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/subscription"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// CollectionName is the MongoDB collection/module key used by the registry.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo/options"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil/mongotest"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil/mongotest"
|
||||
)
|
||||
|
||||
var mongoTests mongotest.Manager
|
||||
@@ -29,7 +29,7 @@ func TestInitStore_MongoCreatesMatchCacheTTLIndex(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("NewMongoClient: %v", err)
|
||||
}
|
||||
dbName := fmt.Sprintf("miti99bot_lol_test_%d", time.Now().UnixNano())
|
||||
dbName := fmt.Sprintf("tiennm99bot_lol_test_%d", time.Now().UnixNano())
|
||||
db := client.Database(dbName)
|
||||
defer func() {
|
||||
cleanupCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/keylock"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/keylock"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
const newRoundHint = "🆕 Send <code>/loldle</code> or <code>/loldle <champion></code> to start a new round."
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installLoldle wires the loldle module + auth (owner gates /loldle_setmax,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package loldle
|
||||
|
||||
import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// New is the loldle module Factory. Loads champions.json once at construction
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// MaxGuesses is the default round length. Per-subject overrides land via
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
func newLoldleGames() GameStore {
|
||||
|
||||
@@ -2,7 +2,8 @@ package loldle
|
||||
|
||||
import "math/rand"
|
||||
|
||||
// Sticker file_ids are bot-scoped to @miti99bot. Adding/replacing requires
|
||||
// Sticker file_ids are bot-scoped to @tiennm99bot. The ids below still come
|
||||
// from the previous bot account and must be recaptured. Adding/replacing requires
|
||||
// resending the sticker to the bot and capturing the file_id via util's
|
||||
// /stickerid private command. Empty pools are safe — pickSticker returns ""
|
||||
// and handlers skip the SendSticker call.
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
// ffTemplate is the fixed rant /ff replies with. Static text, no substitution —
|
||||
|
||||
@@ -20,9 +20,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
// petrolimexSearchURL is the CMS search endpoint behind the "Giá bán lẻ xăng
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// petrolimexFixture mirrors the live response shape: records arrive sorted by
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installMisc wires the misc module to a recording bot with a fresh
|
||||
|
||||
@@ -17,10 +17,10 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// lastPingKey is the per-module store key /ping writes and /ping_stats reads.
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// Store behaviour is tested directly here; Telegram command dispatch is covered
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
// xlt1Template is the "đơn xin lỗi T1" văn mẫu /xlt1 replies with. Two %s slots,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// Visibility classifies who may invoke a command. The dispatcher enforces
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/crawler"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/pdf"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/crawler"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/pdf"
|
||||
)
|
||||
|
||||
// Defaults the bot advertises to users or reuses in other crawls.
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/export"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/export"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -39,7 +39,7 @@ const (
|
||||
// cacheDirName is the shared page cache under the system temp directory.
|
||||
// Keeping it outside the per-run directory is what makes a repeat export of the
|
||||
// same novel cost no requests. It is not pruned; a container restart clears it.
|
||||
const cacheDirName = "miti99bot-monkeyd-cache"
|
||||
const cacheDirName = "tiennm99bot-monkeyd-cache"
|
||||
|
||||
// export runs one crawl to completion and delivers the PDF. It is called on its
|
||||
// own goroutine, detached from the Telegram handler context.
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/export"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/pdf"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/export"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/pdf"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
const testNovelURL = "https://monkeydd.com/tro-lai-nam-thang-cu.html"
|
||||
|
||||
@@ -15,10 +15,10 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/export"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/export"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
// commandName is the PDF export command; tagsCommandName is the other one.
|
||||
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/crawler"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/monkeyd/export"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/crawler"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/monkeyd/export"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
// tagsCommandName is the command that reports a novel's tags.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// stubTags returns a fetcher yielding fixed tags and records the URL it saw.
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
var mp4Bytes = []byte("\x00\x00\x00\x18ftypisom-remote")
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// installRandom wires the random module to a recording bot with a fresh
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// fall back to a text reply without it.
|
||||
package random
|
||||
|
||||
import "github.com/tiennm99/miti99bot/internal/modules"
|
||||
import "github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
|
||||
// New is the module Factory. The commands keep no state, so deps is unused.
|
||||
func New(_ modules.Deps) modules.Module {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
const randomUsage = "Usage: /random <option,...>"
|
||||
|
||||
@@ -3,8 +3,8 @@ package random
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
func TestNew_RegistersRandomGroup(t *testing.T) {
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util/chathelper"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules/util/chathelper"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// moduleNameRe is intentionally looser than commandNameRe — it allows hyphen
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
func noopCmd(name string) Command {
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo/options"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/systemstate"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/systemstate"
|
||||
)
|
||||
|
||||
// The retired stock_dividend command's usage rows are soft-deleted (marked
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/systemstate"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil/mongotest"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/systemstate"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil/mongotest"
|
||||
)
|
||||
|
||||
var mongoTests mongotest.Manager
|
||||
@@ -126,7 +126,7 @@ func setupMongoStatsTest(t *testing.T) (context.Context, storage.Collection, sto
|
||||
if err != nil {
|
||||
t.Fatalf("NewMongoClient: %v", err)
|
||||
}
|
||||
dbName := fmt.Sprintf("miti99bot_stats_test_%d", time.Now().UnixNano())
|
||||
dbName := fmt.Sprintf("tiennm99bot_stats_test_%d", time.Now().UnixNano())
|
||||
db := client.Database(dbName)
|
||||
t.Cleanup(func() {
|
||||
cleanupCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/systemstate"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/systemstate"
|
||||
)
|
||||
|
||||
func TestInitStoreMarksStockDividendStatsDeletedAndRetainsHistory(t *testing.T) {
|
||||
|
||||
@@ -13,9 +13,9 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/log"
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/log"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
// topK caps the rows every /stats view shows.
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
"github.com/tiennm99/tiennm99bot/internal/modules"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/testutil"
|
||||
)
|
||||
|
||||
// newStatsCounter returns a fresh counter backed by an in-memory collection.
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo/options"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/tiennm99bot/internal/storage"
|
||||
)
|
||||
|
||||
func bsonField(key string, value any) bson.E {
|
||||
|
||||
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user