discord.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /******************************************************************************
  2. * A Discord API for Golang.
  3. *
  4. * Currently only the REST API is functional. I will add on the websocket
  5. * layer once I get the API section where I want it.
  6. *
  7. * The idea is that this file is where we pull together the wsapi, and
  8. * restapi to create a single do-it-all struct
  9. *
  10. * NOTE!!! Currently this file has no purpose, it is here for future
  11. * access methods. EVERYTHING HERE will just go away or be changed
  12. * substantially in the future.
  13. */
  14. package discordgo
  15. // A Discord structure represents a all-inclusive (hopefully) structure to
  16. // access the Discord REST API for a given authenticated user.
  17. /*
  18. type Discord struct {
  19. Session *Session
  20. User User
  21. Servers []Server
  22. }
  23. */
  24. // New creates a new connection to Discord and returns a Discord structure.
  25. // This provides an easy entry where most commonly needed information is
  26. // automatically fetched.
  27. // TODO add websocket code in here too
  28. /*
  29. func New(email string, password string) (d *Discord, err error) {
  30. session := Session{}
  31. session.Token, err = session.Login(email, password)
  32. if err != nil {
  33. return
  34. }
  35. user, err := session.Self()
  36. if err != nil {
  37. return
  38. }
  39. servers, err := session.Servers()
  40. d = &Discord{session, user, servers}
  41. return
  42. }
  43. */
  44. // Renew essentially reruns the New command without creating a new session.
  45. // This will update all the user, server, and channel information that was
  46. // fetched with the New command. This is not an efficient way of doing this
  47. // but if used infrequently it does provide convenience.
  48. /*
  49. func (d *Discord) Renew() (err error) {
  50. d.User, err = Users(&d.Session, "@me")
  51. d.Servers, err = Servers(&d.Session, "@me")
  52. return
  53. }
  54. */