types.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package telegram
  2. import (
  3. "fmt"
  4. "time"
  5. )
  6. // Account TG 账号信息
  7. type Account struct {
  8. Phone string
  9. SessionFile string
  10. AppID int
  11. AppHash string
  12. }
  13. // ChannelInfo 频道基本信息
  14. type ChannelInfo struct {
  15. Username string
  16. Title string
  17. MemberCount int
  18. About string
  19. IsChannel bool
  20. IsGroup bool
  21. }
  22. // Message TG 消息
  23. type Message struct {
  24. ID int
  25. Text string
  26. ForwardFromChannel string // forward 来源频道用户名
  27. Links []string // 消息中的 t.me 链接
  28. IsService bool // 系统消息
  29. }
  30. // UserInfo TG 用户信息(验证商户时用)
  31. type UserInfo struct {
  32. ID int64
  33. Username string
  34. FirstName string
  35. LastName string
  36. IsBot bool
  37. IsPremium bool
  38. LastOnline *time.Time
  39. IsChannel bool
  40. IsGroup bool
  41. Exists bool // false 表示不存在/已注销
  42. }
  43. // FloodWaitError FloodWait 错误,包含等待时长
  44. type FloodWaitError struct {
  45. Seconds int
  46. }
  47. func (e *FloodWaitError) Error() string {
  48. return fmt.Sprintf("FloodWait: %d seconds", e.Seconds)
  49. }