Jelajahi Sumber

Removed new_basic example. See pingpong instead :)

Bruce 8 tahun lalu
induk
melakukan
2953721ea0
2 mengubah file dengan 0 tambahan dan 88 penghapusan
  1. 0 35
      examples/new_basic/README.md
  2. 0 53
      examples/new_basic/main.go

+ 0 - 35
examples/new_basic/README.md

@@ -1,35 +0,0 @@
-<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png">
-Basic New Example
-====
-
-This example demonstrates how to utilize DiscordGo to connect to Discord
-and print out all received chat messages.
-
-This example uses the high level New() helper function to connect to Discord.
-
-### Build
-
-This assumes you already have a working Go environment setup and that
-DiscordGo is correctly installed on your system.
-
-```sh
-go build
-```
-
-### Usage
-
-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:
-  -t string
-        Bot Token
-```
-
-The below example shows how to start the bot
-
-```sh
-./new_basic -t YOUR_BOT_TOKEN
-```

+ 0 - 53
examples/new_basic/main.go

@@ -1,53 +0,0 @@
-package main
-
-import (
-	"flag"
-	"fmt"
-	"time"
-
-	"github.com/bwmarrin/discordgo"
-)
-
-// Variables used for command line parameters
-var (
-	Token string
-)
-
-func init() {
-
-	flag.StringVar(&Token, "t", "", "Bot Token")
-	flag.Parse()
-}
-
-func main() {
-
-	// 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
-	}
-
-	// Register messageCreate as a callback for the messageCreate events.
-	dg.AddHandler(messageCreate)
-
-	// Open the websocket and begin listening.
-	err = dg.Open()
-	if err != nil {
-		fmt.Println("error opening connection,", err)
-		return
-	}
-
-	fmt.Println("Bot is now running.  Press CTRL-C to exit.")
-	// Simple way to keep program running until CTRL-C is pressed.
-	<-make(chan struct{})
-	return
-}
-
-// 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 %20s > %s\n", m.ChannelID, time.Now().Format(time.Stamp), m.Author.Username, m.Content)
-}