Removed MESSAGE_CREATE event handler and opening of websocket infavour

of the example being simple and to the point.
Added a disclaimer regarding visual change to the main README.md.
This commit is contained in:
VagantemNumen 2016-05-17 19:26:37 +05:00
parent 93d49d7710
commit 7ff5f4b043
No known key found for this signature in database
GPG key ID: 2720AE8E56962CA0
3 changed files with 4 additions and 30 deletions

View file

@ -23,3 +23,7 @@ go build
### Usage
Please refer to the README.md inside the example folder for usage of that particular example.
### Note
Please be aware that you will need to login with the account you just changed avatar of to visually see the change. Alternatively you could query the avatar from dicord servers to make sure the change has indeed occured.

View file

@ -6,7 +6,6 @@ import (
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/bwmarrin/discordgo"
)
@ -39,12 +38,6 @@ func main() {
return
}
// Register messageCreate as a callback for the messageCreate events.
dg.AddHandler(messageCreate)
// Open the websocket and begin listening.
dg.Open()
bot, err := dg.User("@me")
if err != nil {
fmt.Println("error fetching the bot details,", err)
@ -77,11 +70,3 @@ func changeAvatar(s *discordgo.Session) {
fmt.Println(err)
}
}
// This function will be called (due to AddHandler above) every time a new
// message is created on any channel that the autenticated bot has access to.
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
// Print message to stdout.
fmt.Printf("%-20s %-20s\n %20s > %s\n", m.ChannelID, time.Now().Format(time.Stamp), m.Author.Username, m.Content)
}

View file

@ -6,7 +6,6 @@ import (
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/bwmarrin/discordgo"
)
@ -39,12 +38,6 @@ func main() {
return
}
// Register messageCreate as a callback for the messageCreate events.
dg.AddHandler(messageCreate)
// Open the websocket and begin listening.
dg.Open()
bot, err := dg.User("@me")
if err != nil {
fmt.Println("error fetching the bot details,", err)
@ -88,11 +81,3 @@ func changeAvatar(s *discordgo.Session) {
}
}
// This function will be called (due to AddHandler above) every time a new
// message is created on any channel that the autenticated bot has access to.
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
// Print message to stdout.
fmt.Printf("%-20s %-20s\n %20s > %s\n", m.ChannelID, time.Now().Format(time.Stamp), m.Author.Username, m.Content)
}