guild.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package discordgo
  2. // A Guild holds all data related to a specific Discord Guild. Guilds are also
  3. // sometimes referred to as Servers in the Discord client.
  4. type Guild struct {
  5. ID string `json:"id"`
  6. Name string `json:"name"`
  7. Icon string `json:"icon"`
  8. Region string `json:"region"`
  9. AfkTimeout int `json:"afk_timeout"`
  10. AfkChannelID string `json:"afk_channel_id"`
  11. EmbedChannelID string `json:"embed_channel_id"`
  12. EmbedEnabled bool `json:"embed_enabled"`
  13. OwnerID string `json:"owner_id"`
  14. Large bool `json:"large"` // ??
  15. JoinedAt string `json:"joined_at"` // make this a timestamp
  16. Roles []Role `json:"roles"`
  17. Members []Member `json:"members"`
  18. Presences []Presence `json:"presences"`
  19. Channels []Channel `json:"channels"`
  20. VoiceStates []VoiceState `json:"voice_states"`
  21. }
  22. // A Role stores information about Discord guild member roles.
  23. type Role struct {
  24. ID string `json:"id"`
  25. Name string `json:"name"`
  26. Managed bool `json:"managed"`
  27. Color int `json:"color"`
  28. Hoist bool `json:"hoist"`
  29. Position int `json:"position"`
  30. Permissions int `json:"permissions"`
  31. }
  32. // A VoiceState stores the voice states of Guilds
  33. type VoiceState struct {
  34. UserID string `json:"user_id"`
  35. Suppress bool `json:"suppress"`
  36. SessionID string `json:"session_id"`
  37. SelfMute bool `json:"self_mute"`
  38. SelfDeaf bool `json:"self_deaf"`
  39. Mute bool `json:"mute"`
  40. Deaf bool `json:"deaf"`
  41. ChannelID string `json:"channel_id"`
  42. }
  43. // A Presence stores the online, offline, or idle and game status of Guild members.
  44. type Presence struct {
  45. User User `json:"user"`
  46. Status string `json:"status"`
  47. GameID int `json:"game_id"`
  48. }
  49. // A Member stores user information for Guild members.
  50. type Member struct {
  51. GuildID string `json:"guild_id"`
  52. JoinedAt string `json:"joined_at"`
  53. Deaf bool `json:"deaf"`
  54. Mute bool `json:"mute"`
  55. User User `json:"user"`
  56. Roles []string `json:"roles"`
  57. }
  58. /*
  59. TODO: How to name these? If we make a variable to store
  60. channels from READY packet, etc. We can't have a Channel
  61. func? And which is better. Channels func gets live up
  62. to date data on each call.. so, there is some benefit there.
  63. Maybe it should have both, but make the Channels check and
  64. pull new data based on a cache time?
  65. func (s *Server) Channels() (c []Channel, err error) {
  66. c, err = Channels(s.Session, s.Id)
  67. return
  68. }
  69. */
  70. /*
  71. func (s *Server) Members() (m []Users, err error) {
  72. }
  73. */