chore: refresh gramsrv public release
This commit is contained in:
parent
75cebe8dbf
commit
70b6820474
1274 changed files with 378751 additions and 59919 deletions
|
|
@ -3,6 +3,11 @@ package domain
|
|||
const (
|
||||
// OfficialSystemUserID 是 Telegram 兼容客户端识别的官方系统账号。
|
||||
OfficialSystemUserID int64 = 777000
|
||||
|
||||
// BotFatherUserID 是内置 BotFather 账号,与官方 @BotFather 同 ID。
|
||||
BotFatherUserID int64 = 93372553
|
||||
// BotFatherAccessHash 固定不变;与迁移 0090 的种子行双写,必须保持一致。
|
||||
BotFatherAccessHash int64 = 7421896403922962293
|
||||
)
|
||||
|
||||
// OfficialSystemUser 返回第一阶段内置的官方系统账号。
|
||||
|
|
@ -17,3 +22,47 @@ func OfficialSystemUser() User {
|
|||
Support: true,
|
||||
}
|
||||
}
|
||||
|
||||
// BotFatherUser 返回内置 BotFather 账号。username 不以 bot 结尾属种子例外(与官方一致)。
|
||||
func BotFatherUser() User {
|
||||
return User{
|
||||
ID: BotFatherUserID,
|
||||
AccessHash: BotFatherAccessHash,
|
||||
FirstName: "BotFather",
|
||||
Username: "BotFather",
|
||||
Verified: true,
|
||||
Bot: true,
|
||||
BotInfoVersion: 1,
|
||||
}
|
||||
}
|
||||
|
||||
// SystemUserByID 返回内置系统账号;非系统账号返回 ok=false。
|
||||
// 所有对 777000 的硬编码注入点统一经此函数,新增内置账号只改这里。
|
||||
func SystemUserByID(id int64) (User, bool) {
|
||||
switch id {
|
||||
case OfficialSystemUserID:
|
||||
return OfficialSystemUser(), true
|
||||
case BotFatherUserID:
|
||||
return BotFatherUser(), true
|
||||
}
|
||||
return User{}, false
|
||||
}
|
||||
|
||||
func IsSystemUserID(id int64) bool {
|
||||
_, ok := SystemUserByID(id)
|
||||
return ok
|
||||
}
|
||||
|
||||
func SystemUserByPhone(phone string) (User, bool) {
|
||||
phone = NormalizePhone(phone)
|
||||
for _, id := range []int64{OfficialSystemUserID, BotFatherUserID} {
|
||||
u, ok := SystemUserByID(id)
|
||||
if !ok || u.Phone == "" {
|
||||
continue
|
||||
}
|
||||
if NormalizePhone(u.Phone) == phone {
|
||||
return u, true
|
||||
}
|
||||
}
|
||||
return User{}, false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue