mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-15 00:17:53 +00:00
chore: drop CF→AWS migration tooling and stale JS-port references
The CF→AWS data migration (closed 2026-05-16) is long done and the tooling isn't wired into any production path. Remove the one-shot binary, its support package, and the migration runbook. In live code, replace 'JS-parity' / 'same shape as JS' / 'cross-runtime KV migration' comments with the real, stable reason for each behavior (wire-format invariant, null-vs-zero distinction, CloudWatch alarm field name, etc.). 24 files touched across lolschedule, loldle, wordle, twentyq, trading, misc, util, server, metrics, ai, keylock. - delete cmd/migrate_cf_data/ - delete internal/migration/ - delete docs/cf-to-aws-migration-runbook.md
This commit is contained in:
1 parent
c901f3ad40
commit
ec77a24db7
47 files changed
+142
-1491
No files matched your search
@@ -15,14 +15,11 @@ import (
|
||||
"github.com/go-telegram/bot/models"
|
||||
)
|
||||
|
||||
// SubjectFor mirrors JS getSubject: group/supergroup → chat ID (shared game
|
||||
// state), otherwise → user ID. Returns "" when no usable id is present
|
||||
// (caller should reply with a "cannot identify chat" error). Channels and
|
||||
// unknown chat types fall through to From.ID.
|
||||
//
|
||||
// Canonical shape: the wordle module previously had an explicit
|
||||
// ChatTypePrivate branch returning From.ID, which is identical to the
|
||||
// default branch — folded together here.
|
||||
// SubjectFor returns the identity key per-module state should be scoped by:
|
||||
// group/supergroup → chat ID (shared game state), otherwise → user ID.
|
||||
// Returns "" when no usable id is present (caller should reply with a
|
||||
// "cannot identify chat" error). Channels and unknown chat types fall
|
||||
// through to From.ID.
|
||||
func SubjectFor(msg *models.Message) string {
|
||||
if msg == nil {
|
||||
return ""
|
||||
@@ -39,7 +36,7 @@ func SubjectFor(msg *models.Message) string {
|
||||
}
|
||||
|
||||
// ArgAfterCommand returns everything after the first space in text, trimmed.
|
||||
// Works for `/cmd arg`, `/cmd@bot arg`, etc. JS-parity.
|
||||
// Works for `/cmd arg`, `/cmd@bot arg`, etc.
|
||||
func ArgAfterCommand(text string) string {
|
||||
if text == "" {
|
||||
return ""
|
||||
@@ -88,9 +85,9 @@ func ReplyHTML(ctx context.Context, b *bot.Bot, msg *models.Message, text string
|
||||
}
|
||||
|
||||
// WinRate computes wins/played as a percentage rounded to nearest int.
|
||||
// math.Round matches JS Math.round (round half away from zero for positive
|
||||
// inputs); plain int(...) truncation would render 2/3 as 66% where JS shows
|
||||
// 67%. Returns 0 when played == 0 (avoids NaN).
|
||||
// Uses math.Round (round half away from zero for positive inputs) so 2/3
|
||||
// renders as 67%, not 66% as plain int(...) truncation would give.
|
||||
// Returns 0 when played == 0 (avoids NaN).
|
||||
func WinRate(wins, played int) int {
|
||||
if played <= 0 {
|
||||
return 0
|
||||
|
||||
@@ -32,7 +32,7 @@ func infoCommand() modules.Command {
|
||||
}
|
||||
chatID := fmt.Sprintf("%d", msg.Chat.ID)
|
||||
// Telegram omits message_thread_id outside forum topics, so a 0
|
||||
// here is "no thread", same as JS's `?? "n/a"`.
|
||||
// here means "no thread" — render as "n/a" instead of "0".
|
||||
threadID := "n/a"
|
||||
if msg.MessageThreadID != 0 {
|
||||
threadID = fmt.Sprintf("%d", msg.MessageThreadID)
|
||||
|
||||
@@ -57,8 +57,7 @@ func stickerIDCommand() modules.Command {
|
||||
}
|
||||
}
|
||||
|
||||
// stickerFrom pulls the sticker out of the *replied-to* message, mirroring the
|
||||
// JS handler: ctx.message.reply_to_message.sticker.
|
||||
// stickerFrom pulls the sticker out of the *replied-to* message.
|
||||
func stickerFrom(msg *models.Message) *models.Sticker {
|
||||
if msg.ReplyToMessage == nil {
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user