合并 origin/main 设备注册后,纳入本地 music 模块、seed 命令与 popadmin 相关路由/文档;music migration 编号为 0020 以避免与 0019_devices 冲突。 Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package entity
|
|
|
|
import (
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
const (
|
|
// BotCount is how many seeded robot accounts the seed command ensures.
|
|
BotCount = 100
|
|
// BotEmailDomain is the reserved mailbox domain for seed bots (not OTP-free).
|
|
BotEmailDomain = "spark.bot"
|
|
)
|
|
|
|
var botEmailRe = regexp.MustCompile(`^bot(0[0-9]{2}|100)@spark\.bot$`)
|
|
|
|
// BotEmail returns bot001@spark.bot … bot100@spark.bot.
|
|
func BotEmail(index int) string {
|
|
if index < 1 || index > BotCount {
|
|
return ""
|
|
}
|
|
return fmt.Sprintf("bot%03d@%s", index, BotEmailDomain)
|
|
}
|
|
|
|
// BotSparkID returns sparkbot001 … sparkbot100 (ValidSparkID length).
|
|
func BotSparkID(index int) string {
|
|
if index < 1 || index > BotCount {
|
|
return ""
|
|
}
|
|
return fmt.Sprintf("sparkbot%03d", index)
|
|
}
|
|
|
|
// IsBotEmail reports whether email is a seeded robot mailbox.
|
|
func IsBotEmail(email string) bool {
|
|
return botEmailRe.MatchString(NormalizeEmail(email))
|
|
}
|
|
|
|
// WelcomeBotIndex is the robot friended to every formal/test user for greetings.
|
|
const WelcomeBotIndex = 1
|
|
|
|
// SampleGroupBotCount is how many robots join the English sample group (owner + peers).
|
|
const SampleGroupBotCount = 8
|
|
|
|
// SampleGroupName is the seeded multi-bot English sample chat.
|
|
const SampleGroupName = "Spark Samples"
|