diff --git a/examples/avatar/README.md b/examples/avatar/README.md index de4f80d..208bf9e 100644 --- a/examples/avatar/README.md +++ b/examples/avatar/README.md @@ -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. diff --git a/examples/avatar/localfile/main.go b/examples/avatar/localfile/main.go index ea2fb07..616546c 100644 --- a/examples/avatar/localfile/main.go +++ b/examples/avatar/localfile/main.go @@ -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) -} diff --git a/examples/avatar/url/main.go b/examples/avatar/url/main.go index 7a60682..0caf478 100644 --- a/examples/avatar/url/main.go +++ b/examples/avatar/url/main.go @@ -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) -}