feat: sync built-in sticker bot
This commit is contained in:
parent
7096625e13
commit
6867d201ed
60 changed files with 7063 additions and 144 deletions
|
|
@ -8,6 +8,12 @@ const (
|
|||
BotFatherUserID int64 = 93372553
|
||||
// BotFatherAccessHash 固定不变;与迁移 0090 的种子行双写,必须保持一致。
|
||||
BotFatherAccessHash int64 = 7421896403922962293
|
||||
|
||||
// StickersBotUserID 是内置 @Stickers 账号。它是 server 内置 service bot,
|
||||
// 不走外部 Bot API 进程。
|
||||
StickersBotUserID int64 = 1063110917
|
||||
// StickersBotAccessHash 固定不变;与 postgres 种子行双写,必须保持一致。
|
||||
StickersBotAccessHash int64 = 5213187021149032991
|
||||
)
|
||||
|
||||
// OfficialSystemUser 返回第一阶段内置的官方系统账号。
|
||||
|
|
@ -36,6 +42,19 @@ func BotFatherUser() User {
|
|||
}
|
||||
}
|
||||
|
||||
// StickersBotUser 返回内置 @Stickers 账号。username 不以 bot 结尾属种子例外(与官方一致)。
|
||||
func StickersBotUser() User {
|
||||
return User{
|
||||
ID: StickersBotUserID,
|
||||
AccessHash: StickersBotAccessHash,
|
||||
FirstName: "Stickers",
|
||||
Username: "Stickers",
|
||||
Verified: true,
|
||||
Bot: true,
|
||||
BotInfoVersion: 2,
|
||||
}
|
||||
}
|
||||
|
||||
// SystemUserByID 返回内置系统账号;非系统账号返回 ok=false。
|
||||
// 所有对 777000 的硬编码注入点统一经此函数,新增内置账号只改这里。
|
||||
func SystemUserByID(id int64) (User, bool) {
|
||||
|
|
@ -44,6 +63,8 @@ func SystemUserByID(id int64) (User, bool) {
|
|||
return OfficialSystemUser(), true
|
||||
case BotFatherUserID:
|
||||
return BotFatherUser(), true
|
||||
case StickersBotUserID:
|
||||
return StickersBotUser(), true
|
||||
}
|
||||
return User{}, false
|
||||
}
|
||||
|
|
@ -55,7 +76,7 @@ func IsSystemUserID(id int64) bool {
|
|||
|
||||
func SystemUserByPhone(phone string) (User, bool) {
|
||||
phone = NormalizePhone(phone)
|
||||
for _, id := range []int64{OfficialSystemUserID, BotFatherUserID} {
|
||||
for _, id := range []int64{OfficialSystemUserID, BotFatherUserID, StickersBotUserID} {
|
||||
u, ok := SystemUserByID(id)
|
||||
if !ok || u.Phone == "" {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue