Skip to content

Commit

Permalink
Merge pull request #6 from Wadimich/master
Browse files Browse the repository at this point in the history
New features and fixes
  • Loading branch information
FM1337 committed Nov 3, 2017
2 parents 2c59968 + 8b63977 commit 4647870
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .envexample
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ AdminIDs = "AdminIDsHere,SeperateByComma"
Prefix = "$"

ModListLocation = "/path/to/mods/mod-list.json"

GameName = "Factorio"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.env
*.exe
/.exit
/error.log
/FactoCord
.idea/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ FactoCord uses the following packages:
- [godotenv](https://github.com/joho/godotenv/)
- [tails](https://github.com/hpcloud/tail)

You will need to add these lib as go get:

- `go get github.com/bwmarrin/discordgo`
- `go get github.com/joho/godotenv`
- `go get github.com/hpcloud/tail/...`

To compile just do `go build`


Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"syscall"
"time"

"github.com/FactoKit/FactoCord/commands"
"github.com/FactoKit/FactoCord/commands/admin"
"github.com/FactoKit/FactoCord/support"
"./support"
"./commands"
"./commands/admin"
"github.com/bwmarrin/discordgo"
_ "github.com/joho/godotenv/autoload"
)
Expand Down Expand Up @@ -131,6 +131,7 @@ func discord() {
bot.AddHandlerOnce(support.Chat)
time.Sleep(3 * time.Second)
bot.ChannelMessageSend(support.Config.FactorioChannelID, "The server has started!")
bot.UpdateStatus(0, support.Config.GameName)
fmt.Println("Bot is now running. Press CTRL-C to exit.")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
Expand Down
2 changes: 2 additions & 0 deletions support/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type config struct {
AdminIDs []string
Prefix string
ModListLocation string
GameName string
}

func (conf *config) LoadEnv() {
Expand All @@ -35,6 +36,7 @@ func (conf *config) LoadEnv() {
AdminIDs: strings.Split(os.Getenv("AdminIDs"), ","),
Prefix: os.Getenv("Prefix"),
ModListLocation: os.Getenv("ModListLocation"),
GameName: os.Getenv("GameName"),
}

}

0 comments on commit 4647870

Please sign in to comment.