forked from pothtonswer/discordmuffin
Update examples to use Bot tokens.
This commit is contained in:
parent
212fc66a25
commit
e37343d4d4
8 changed files with 27 additions and 60 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue