summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/bwmarrin/discordgo/examples
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-01-28 22:45:32 +0100
committerWim <wim@42.be>2017-01-28 22:45:32 +0100
commit79e6c9fa6cfca4bfe8913fd891fd9b12bd5bb505 (patch)
treebbcbbcf10127a0f5d030345b4beabbc9df7713d2 /vendor/github.com/bwmarrin/discordgo/examples
parent1426ddec5f2250024c80765017b899e847bf2996 (diff)
downloadmatterbridge-msglm-79e6c9fa6cfca4bfe8913fd891fd9b12bd5bb505.tar.gz
matterbridge-msglm-79e6c9fa6cfca4bfe8913fd891fd9b12bd5bb505.tar.bz2
matterbridge-msglm-79e6c9fa6cfca4bfe8913fd891fd9b12bd5bb505.zip
Update vendor
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/examples')
-rw-r--r--vendor/github.com/bwmarrin/discordgo/examples/airhorn/main.go12
-rw-r--r--vendor/github.com/bwmarrin/discordgo/examples/new_basic/main.go13
-rw-r--r--vendor/github.com/bwmarrin/discordgo/examples/pingpong/main.go14
3 files changed, 17 insertions, 22 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/examples/airhorn/main.go b/vendor/github.com/bwmarrin/discordgo/examples/airhorn/main.go
index cc61301c..ff5e5214 100644
--- a/vendor/github.com/bwmarrin/discordgo/examples/airhorn/main.go
+++ b/vendor/github.com/bwmarrin/discordgo/examples/airhorn/main.go
@@ -13,7 +13,7 @@ import (
)
func init() {
- flag.StringVar(&token, "t", "", "Account Token")
+ flag.StringVar(&token, "t", "", "Bot Token")
flag.Parse()
}
@@ -34,8 +34,8 @@ func main() {
return
}
- // Create a new Discord session using the provided token.
- dg, err := discordgo.New(token)
+ // Create a new Discord session using the provided bot token.
+ dg, err := discordgo.New("Bot " + token)
if err != nil {
fmt.Println("Error creating Discord session: ", err)
return
@@ -102,7 +102,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
// This function will be called (due to AddHandler above) every time a new
// guild is joined.
func guildCreate(s *discordgo.Session, event *discordgo.GuildCreate) {
- if event.Guild.Unavailable != nil {
+ if event.Guild.Unavailable {
return
}
@@ -131,6 +131,10 @@ func loadSound() error {
// If this is the end of the file, just return.
if err == io.EOF || err == io.ErrUnexpectedEOF {
+ file.Close()
+ if err != nil {
+ return err
+ }
return nil
}
diff --git a/vendor/github.com/bwmarrin/discordgo/examples/new_basic/main.go b/vendor/github.com/bwmarrin/discordgo/examples/new_basic/main.go
index c3861ac0..0191bb06 100644
--- a/vendor/github.com/bwmarrin/discordgo/examples/new_basic/main.go
+++ b/vendor/github.com/bwmarrin/discordgo/examples/new_basic/main.go
@@ -10,24 +10,19 @@ import (
// Variables used for command line parameters
var (
- Email string
- Password string
- Token string
+ Token string
)
func init() {
- flag.StringVar(&Email, "e", "", "Account Email")
- flag.StringVar(&Password, "p", "", "Account Password")
- flag.StringVar(&Token, "t", "", "Account Token")
+ flag.StringVar(&Token, "t", "", "Bot Token")
flag.Parse()
}
func main() {
- // Create a new Discord session using the provided login information.
- // Use discordgo.New(Token) to just use a token for login.
- dg, err := discordgo.New(Email, Password, Token)
+ // Create a new Discord session using the provided bot token.
+ dg, err := discordgo.New("Bot " + Token)
if err != nil {
fmt.Println("error creating Discord session,", err)
return
diff --git a/vendor/github.com/bwmarrin/discordgo/examples/pingpong/main.go b/vendor/github.com/bwmarrin/discordgo/examples/pingpong/main.go
index e6893ca1..2edd957e 100644
--- a/vendor/github.com/bwmarrin/discordgo/examples/pingpong/main.go
+++ b/vendor/github.com/bwmarrin/discordgo/examples/pingpong/main.go
@@ -9,24 +9,20 @@ import (
// Variables used for command line parameters
var (
- Email string
- Password string
- Token string
- BotID string
+ Token string
+ BotID string
)
func init() {
- flag.StringVar(&Email, "e", "", "Account Email")
- flag.StringVar(&Password, "p", "", "Account Password")
- flag.StringVar(&Token, "t", "", "Account Token")
+ flag.StringVar(&Token, "t", "", "Bot Token")
flag.Parse()
}
func main() {
- // Create a new Discord session using the provided login information.
- dg, err := discordgo.New(Email, Password, Token)
+ // Create a new Discord session using the provided bot token.
+ dg, err := discordgo.New("Bot " + Token)
if err != nil {
fmt.Println("error creating Discord session,", err)
return