Added test flag to connect and the immediately disconnect.
parent
8afc7ffa58
commit
0c0204caa2
|
@ -12,7 +12,7 @@ steps:
|
|||
commands:
|
||||
- go get
|
||||
- go build
|
||||
- ./discord-buttsbot-go
|
||||
- ./discord-buttsbot-go -test
|
||||
- name: discord
|
||||
image: appleboy/drone-discord
|
||||
settings:
|
||||
|
|
10
buttsbot.go
10
buttsbot.go
|
@ -1,16 +1,17 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
var Session, _ = discordgo.New()
|
||||
var testPtr = flag.Bool("test", false, "Test mode")
|
||||
|
||||
func init() {
|
||||
Session.Token = os.Getenv("DISCORD_TOKEN")
|
||||
|
@ -37,6 +38,11 @@ func main () {
|
|||
|
||||
//Wait for a CTRL-C
|
||||
log.Printf("Now running. Press CTRL-C to exit.")
|
||||
if *testPtr == true {
|
||||
log.Printf("Test successful! Now quiting.")
|
||||
Session.Close()
|
||||
os.Exit(0)
|
||||
}
|
||||
sc := make(chan os.Signal, 1)
|
||||
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
||||
<-sc
|
||||
|
|
Loading…
Reference in New Issue