Browse Source

Clean up, notes

Bruce Marriner 9 years ago
parent
commit
2c3ca777f9
6 changed files with 22 additions and 7 deletions
  1. 2 1
      discord.go
  2. 11 5
      session.go
  3. 2 0
      structs.go
  4. 2 0
      users.go
  5. 4 0
      util.go
  6. 1 1
      wsapi.go

+ 2 - 1
discord.go

@@ -18,7 +18,7 @@ const (
 	servers    = discordApi + "guilds"
 	channels   = discordApi + "channels"
 	users      = discordApi + "users"
-)
+) // TODO: make this do something, better names, move to restapi.go
 
 // A Discord structure represents a all-inclusive (hopefully) structure to
 // access the Discord REST API for a given authenticated user.
@@ -31,6 +31,7 @@ type Discord struct {
 // New creates a new connection to Discord and returns a Discord structure.
 // This provides an easy entry where most commonly needed information is
 // automatically fetched.
+// TODO add websocket code in here too
 func New(email string, password string) (d *Discord, err error) {
 
 	session := Session{}

+ 11 - 5
session.go

@@ -10,14 +10,20 @@ import "github.com/gorilla/websocket"
 // Token : The authentication token returned from Discord
 // Debug : If set to ture debug logging will be displayed.
 type Session struct {
-	Token     string
-	Gateway   string
-	Debug     bool
-	Websocket *websocket.Conn
+	Token     string          // Authentication token for this session
+	Gateway   string          // Websocket Gateway for this session
+	Debug     bool            // Debug for printing JSON request/responses
+	Cache     int             // number in X to cache some responses
+	Websocket *websocket.Conn // TODO: use this
+	//TODO, add bools for like.
+	// are we connnected to websocket?
+	// have we authenticated to login?
+	// lets put all the general session
+	// tracking and infos here.. clearly
 }
 
 /******************************************************************************
- * The below functions are "shortcut" methods for functions in client.go
+ * The below functions are "shortcut" methods for functions in restapi.go
  * Reference the client.go file for more documentation.
  */
 func (session *Session) Login(email string, password string) (token string, err error) {

+ 2 - 0
structs.go

@@ -1,5 +1,7 @@
 package discordgo
 
+// TODO: Eventually everything here gets moved to a better place.
+
 type Message struct {
 	Id              int          `json:"id,string"`
 	Author          User         `json:"author"`

+ 2 - 0
users.go

@@ -15,3 +15,5 @@ type PrivateChannel struct {
 	LastMessageId int  `json:"last_message_id,string"`
 	Recipient     User `json:"recipient"`
 }
+
+// PM function to PM a user.

+ 4 - 0
util.go

@@ -1,3 +1,6 @@
+// this file has small funcs used without the pacakge
+// or, one.. util, maybe I'll have more later :)
+
 package discordgo
 
 import (
@@ -6,6 +9,7 @@ import (
 	"fmt"
 )
 
+// convert to return as string
 func printJSON(body []byte) {
 	var prettyJSON bytes.Buffer
 	error := json.Indent(&prettyJSON, body, "", "\t")

+ 1 - 1
wsapi.go

@@ -2,7 +2,7 @@
  * A Discord API for Golang.
  * See discord.go for more information.
  *
- * This file contains functions low level functions for interacting
+ * This file contains low level functions for interacting
  * with the Discord Websocket interface.
  */