mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-10-03 05:12:52 +00:00
Ported loldle game module with full classic-mode comparison engine: 4 commands (3 public + /loldle_setmax private), 7-attribute comparison (gender/species/range_type/resource/regions/positions/release_date) with exact/multi/year scoring, 172-champion dictionary, and sticker pools by outcome. Fixed winRate display discrepancy: JS uses Math.round but Go was using int(...) truncation. Applied math.Round in both loldle and wordle handlers. Rendered output now matches expected percentages (e.g. 67% instead of 66%). Includes comparison/lookup/flavor/state/render golden tests, keylock fan-out tests, and strict render-alignment validation.
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package loldle
|
|
|
|
import "math/rand"
|
|
|
|
// Sticker file_ids are bot-scoped to @miti99bot. 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.
|
|
|
|
// winStickers — cheerful pool used on a successful guess.
|
|
var winStickers = []string{
|
|
"CAACAgIAAxkBAAECGBVp56vuLw5TSWy8TiFGkQYAAWxi0wUAAh9EAAJTD8BJ2wQ6vyMilxs7BA",
|
|
"CAACAgIAAxkBAAECGBhp56wAATkzsBBcIxMSC_8mp2dBczsAAvBEAAL1vklJuCnu695nAvI7BA",
|
|
"CAACAgIAAxkBAAECGBlp56wBZ4rmluL3KNlOuWsyctN0FQACNEQAAue5OEv37J_IfMnpljsE",
|
|
"CAACAgIAAxkBAAECGCFp56w7WlD6vTIsHE2WUTs4C2IjXAAC9FsAAtgFMUu63usfH16ZpzsE",
|
|
}
|
|
|
|
// loseStickers — deflated pool used when the player runs out of guesses.
|
|
var loseStickers = []string{
|
|
"CAACAgIAAxkBAAECGCBp56w3HUyYOHOeMwLfULT8p8SPtQACWkYAAiPesEjnptWk36YKZjsE",
|
|
}
|
|
|
|
// giveupStickers — resigned pool used on /loldle_giveup.
|
|
var giveupStickers = []string{
|
|
"CAACAgIAAxkBAAECGCJp56xIk6B6McSfnYykLhgXVCSnmQACBlkAApSyWEo6G2rnqDvZxjsE",
|
|
}
|
|
|
|
// pickSticker returns one file_id from the pool, or "" when empty. The
|
|
// math/rand global is mutex-protected, so concurrent handlers can call this
|
|
// without their own synchronisation.
|
|
func pickSticker(pool []string) string {
|
|
if len(pool) == 0 {
|
|
return ""
|
|
}
|
|
return pool[rand.Intn(len(pool))]
|
|
}
|