Update examples to use Bot tokens.

This commit is contained in:
Chris Rhodes 2016-10-29 16:30:07 -07:00
parent 212fc66a25
commit e37343d4d4
8 changed files with 27 additions and 60 deletions

View file

@ -21,13 +21,13 @@ cp ../src/github.com/bwmarrin/discordgo/examples/airhorn/airhorn.dca .
```
Usage of ./airhorn:
-t string
Account Token
Bot Token
```
The below example shows how to start the bot.
```sh
./airhorn -t "Bot YOUR_BOT_TOKEN"
./airhorn -t YOUR_BOT_TOKEN
```
### Creating sounds

View file

@ -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

View file

@ -34,7 +34,7 @@ Usage of ./ocalfile:
Avatar File Name.
```
For example to start application with Token and a non-default avatar:
For example to start application with a bot token and a non-default avatar:
```sh
./localfile -t "Bot YOUR_BOT_TOKEN" -f "./pathtoavatar.jpg"

View file

@ -34,7 +34,7 @@ Usage of ./url:
Link to the avatar image.
```
For example to start application with Token and a non-default avatar:
For example to start application with a bot token and a non-default avatar:
```sh
./url -t "Bot YOUR_BOT_TOKEN" -l "http://bwmarrin.github.io/discordgo/img/discordgo.png"

View file

@ -3,7 +3,7 @@ Basic New Example
====
This example demonstrates how to utilize DiscordGo to connect to Discord
and print out all received chat messages.
and print out all received chat messages.
This example uses the high level New() helper function to connect to Discord.
@ -18,30 +18,18 @@ go build
### Usage
You must authenticate using either an Authentication Token or both Email and
Password for an account. Keep in mind official Bot accounts only support
authenticating via Token.
This example uses bot tokens for authentication only.
While user/password is supported by DiscordGo, it is not recommended.
```
./new_basic --help
Usage of ./new_basic:
-e string
Account Email
-p string
Account Password
-t string
Account Token
Bot Token
```
The below example shows how to start the bot using an Email and Password for
authentication.
The below example shows how to start the bot
```sh
./new_basic -e EmailHere -p PasswordHere
```
The below example shows how to start the bot using the bot user's token
```sh
./new_basic -t "Bot YOUR_BOT_TOKEN"
./new_basic -t YOUR_BOT_TOKEN
```

View file

@ -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

View file

@ -17,30 +17,18 @@ go build
### Usage
You must authenticate using either an Authentication Token or both Email and
Password for an account. Keep in mind official Bot accounts only support
authenticating via Token.
This example uses bot tokens for authentication only.
While user/password is supported by DiscordGo, it is not recommended.
```
./pingpong --help
Usage of ./pingpong:
-e string
Account Email
-p string
Account Password
-t string
Account Token
Bot Token
```
The below example shows how to start the bot using an Email and Password for
authentication.
The below example shows how to start the bot
```sh
./pingpong -e EmailHere -p PasswordHere
```
The below example shows how to start the bot using the bot user's token
```sh
./pingpong -t "Bot YOUR_BOT_TOKEN"
./pingpong -t YOUR_BOT_TOKEN
```

View file

@ -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