server.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package discordgo
  2. type Server struct {
  3. Id int `json:"id,string"`
  4. Name string `json:"name"`
  5. Icon string `json:"icon"`
  6. Region string `json:"region"`
  7. Joined_at string `json:"joined_at"`
  8. Afk_timeout int `json:"afk_timeout"`
  9. Afk_channel_id int `json:"afk_channel_id"`
  10. Embed_channel_id int `json:"embed_channel_id"`
  11. Embed_enabled bool `json:"embed_enabled"`
  12. Owner_id int `json:"owner_id,string"`
  13. Large bool `json:"large"` // ??
  14. JoinedAt string `json:"joined_at"` // make this a timestamp
  15. Roles []Role `json:"roles"`
  16. Members []Member `json:"members"`
  17. Presences []Presence `json:"presences"`
  18. Channels []Channel `json:"channels"`
  19. // VoiceStates []VoiceState `json:"voice_states"`
  20. Session *Session // I got to be doing it wrong here.
  21. }
  22. type VoiceStates struct {
  23. UserId int `json:"user_id,string"`
  24. Suppress bool `json:"suppress"`
  25. SessionId string `json:"session_id"`
  26. SelfMute bool `json:"self_mute"`
  27. SelfDeaf bool `json:"self_deaf"`
  28. Mute bool `json:"mute"`
  29. Deaf bool `json:"deaf"`
  30. ChannelId int `json:"channel_id,string"`
  31. }
  32. type Presence struct {
  33. User User `json:"user"`
  34. Status string `json:"status"`
  35. GameId int `json:"game_id"`
  36. }
  37. // TODO: Member vs User?
  38. type Member struct {
  39. JoinedAt string `json:"joined_at"`
  40. Deaf bool `json:"deaf"`
  41. mute bool `json:"mute"`
  42. User User `json:"user"`
  43. Roles []Role `json:"roles"`
  44. }
  45. type Role struct {
  46. Id int `json:"id,string"`
  47. Name string `json:"name"`
  48. Managed bool `json:"managed"`
  49. Color int `json:"color"`
  50. Hoist bool `json:"hoist"`
  51. Position int `json:"position"`
  52. Permissions int `json:"permissions"`
  53. }
  54. // Channels returns an array of Channel structures for channels within
  55. // this Server
  56. /*
  57. TODO: How to name these? If we make a variable to store
  58. channels from READY packet, etc. We can't have a Channel
  59. func? And which is better. Channels func gets live up
  60. to date data on each call.. so, there is some benefit there.
  61. Maybe it should have both, but make the Channels check and
  62. pull new data based on a cache time?
  63. func (s *Server) Channels() (c []Channel, err error) {
  64. c, err = Channels(s.Session, s.Id)
  65. return
  66. }
  67. */
  68. /*
  69. func (s *Server) Members() (m []Users, err error) {
  70. }
  71. */