mirror of
https://github.com/FactoKit/FactoCord.git
synced 2024-11-24 08:02:15 +02:00
few changes
This commit is contained in:
parent
827b9755f2
commit
e796976879
@ -1,10 +1,11 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"FactorioCord/support"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/FM1337/FactorioCord/support"
|
||||||
|
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"FactorioCord/commands/admin"
|
|
||||||
"FactorioCord/support"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/FM1337/FactorioCord/support"
|
||||||
|
|
||||||
|
"github.com/FM1337/FactorioCord/commands/admin"
|
||||||
|
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
16
main.go
16
main.go
@ -1,9 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"FactorioCord/commands"
|
|
||||||
"FactorioCord/commands/admin"
|
|
||||||
"FactorioCord/support"
|
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -16,6 +13,12 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/fm1337/FactorioCord/commands"
|
||||||
|
|
||||||
|
"github.com/FM1337/FactorioCord/commands/admin"
|
||||||
|
|
||||||
|
"github.com/FM1337/FactorioCord/support"
|
||||||
|
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
_ "github.com/joho/godotenv/autoload"
|
_ "github.com/joho/godotenv/autoload"
|
||||||
)
|
)
|
||||||
@ -27,9 +30,8 @@ var Session *discordgo.Session
|
|||||||
func main() {
|
func main() {
|
||||||
support.Config.LoadEnv()
|
support.Config.LoadEnv()
|
||||||
Running = false
|
Running = false
|
||||||
err := os.Remove("factorio.log")
|
|
||||||
|
|
||||||
if err != nil {
|
if err := os.Remove("factorio.log"); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ func main() {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
Console := bufio.NewReader(os.Stdin)
|
Console := bufio.NewReader(os.Stdin)
|
||||||
for true == true {
|
for {
|
||||||
line, _, err := Console.ReadLine()
|
line, _, err := Console.ReadLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -77,7 +79,7 @@ func main() {
|
|||||||
// Wait 10 seconds on start up before continuing
|
// Wait 10 seconds on start up before continuing
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
|
|
||||||
for true == true {
|
for {
|
||||||
support.CacheDiscordMembers(Session)
|
support.CacheDiscordMembers(Session)
|
||||||
//sleep for 4 hours (caches every 4 hours)
|
//sleep for 4 hours (caches every 4 hours)
|
||||||
time.Sleep(4 * time.Hour)
|
time.Sleep(4 * time.Hour)
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Chat(s *discordgo.Session, m *discordgo.MessageCreate) {
|
func Chat(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||||
for true == true {
|
for {
|
||||||
t, err := tail.TailFile("factorio.log", tail.Config{Follow: true})
|
t, err := tail.TailFile("factorio.log", tail.Config{Follow: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -19,7 +19,7 @@ type config struct {
|
|||||||
|
|
||||||
func (conf *config) LoadEnv() {
|
func (conf *config) LoadEnv() {
|
||||||
if _, err := os.Stat(".env"); os.IsNotExist(err) {
|
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)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user