1
0
mirror of https://github.com/FactoKit/FactoCord.git synced 2024-11-24 08:02:15 +02:00

few changes

This commit is contained in:
Allen 2017-07-27 18:18:58 -03:00
parent 827b9755f2
commit e796976879
5 changed files with 17 additions and 12 deletions

View File

@ -1,10 +1,11 @@
package admin
import (
"FactorioCord/support"
"io"
"os"
"github.com/FM1337/FactorioCord/support"
"github.com/bwmarrin/discordgo"
)

View File

@ -1,10 +1,12 @@
package commands
import (
"FactorioCord/commands/admin"
"FactorioCord/support"
"strings"
"github.com/FM1337/FactorioCord/support"
"github.com/FM1337/FactorioCord/commands/admin"
"github.com/bwmarrin/discordgo"
)

16
main.go
View File

@ -1,9 +1,6 @@
package main
import (
"FactorioCord/commands"
"FactorioCord/commands/admin"
"FactorioCord/support"
"bufio"
"fmt"
"io"
@ -16,6 +13,12 @@ import (
"syscall"
"time"
"github.com/fm1337/FactorioCord/commands"
"github.com/FM1337/FactorioCord/commands/admin"
"github.com/FM1337/FactorioCord/support"
"github.com/bwmarrin/discordgo"
_ "github.com/joho/godotenv/autoload"
)
@ -27,9 +30,8 @@ var Session *discordgo.Session
func main() {
support.Config.LoadEnv()
Running = false
err := os.Remove("factorio.log")
if err != nil {
if err := os.Remove("factorio.log"); err != nil {
log.Println(err)
}
@ -64,7 +66,7 @@ func main() {
go func() {
Console := bufio.NewReader(os.Stdin)
for true == true {
for {
line, _, err := Console.ReadLine()
if err != nil {
log.Fatal(err)
@ -77,7 +79,7 @@ func main() {
// Wait 10 seconds on start up before continuing
time.Sleep(10 * time.Second)
for true == true {
for {
support.CacheDiscordMembers(Session)
//sleep for 4 hours (caches every 4 hours)
time.Sleep(4 * time.Hour)

View File

@ -11,7 +11,7 @@ import (
)
func Chat(s *discordgo.Session, m *discordgo.MessageCreate) {
for true == true {
for {
t, err := tail.TailFile("factorio.log", tail.Config{Follow: true})
if err != nil {
log.Fatal(err)

View File

@ -19,7 +19,7 @@ type config struct {
func (conf *config) LoadEnv() {
if _, err := os.Stat(".env"); os.IsNotExist(err) {
fmt.Println("Enviroment file not found, cannot continue!")
fmt.Println("Environment file not found, cannot continue!")
os.Exit(1)
}