rename package
This commit is contained in:
parent
135709e698
commit
dcf839ed77
13
cron/cron.go
13
cron/cron.go
|
@ -5,12 +5,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
"twdcbot/discord"
|
|
||||||
"twdcbot/scraper"
|
"github.com/tribalwarshelp/dcbot/discord"
|
||||||
"twdcbot/server"
|
"github.com/tribalwarshelp/dcbot/scraper"
|
||||||
"twdcbot/tribalwars"
|
"github.com/tribalwarshelp/dcbot/server"
|
||||||
"twdcbot/tribe"
|
"github.com/tribalwarshelp/dcbot/tribalwars"
|
||||||
"twdcbot/utils"
|
"github.com/tribalwarshelp/dcbot/tribe"
|
||||||
|
"github.com/tribalwarshelp/dcbot/utils"
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,9 +5,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"twdcbot/models"
|
|
||||||
"twdcbot/server"
|
"github.com/tribalwarshelp/dcbot/models"
|
||||||
"twdcbot/tribe"
|
"github.com/tribalwarshelp/dcbot/server"
|
||||||
|
"github.com/tribalwarshelp/dcbot/tribe"
|
||||||
|
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
version: '3.6'
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: 'postgres:10.13'
|
|
||||||
container_name: twdcpg
|
|
||||||
networks:
|
|
||||||
- internal
|
|
||||||
volumes:
|
|
||||||
- '/twdcpg:/var/lib/postgresql/data'
|
|
||||||
environment:
|
|
||||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
|
||||||
- POSTGRES_DB=twdcbot
|
|
||||||
- TZ=UTC
|
|
||||||
bot:
|
|
||||||
build: ./
|
|
||||||
container_name: twdc
|
|
||||||
networks:
|
|
||||||
- internal
|
|
||||||
environment:
|
|
||||||
- WAIT_HOSTS=db:5432
|
|
||||||
- DB_HOST=db
|
|
||||||
- DB_NAME=twdcbot
|
|
||||||
- DB_PORT=5432
|
|
||||||
- DB_USER=postgres
|
|
||||||
- DB_PASSWORD=${POSTGRES_PASSWORD}
|
|
||||||
- TZ=UTC
|
|
||||||
- BOT_TOKEN
|
|
||||||
|
|
||||||
networks:
|
|
||||||
internal:
|
|
||||||
external: false
|
|
3
go.mod
3
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module twdcbot
|
module github.com/tribalwarshelp/dcbot
|
||||||
|
|
||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ require (
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
|
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
|
||||||
github.com/temoto/robotstxt v1.1.1 // indirect
|
github.com/temoto/robotstxt v1.1.1 // indirect
|
||||||
|
github.com/tribalwarshelp/shared v0.0.0-20200602060635-0b3cb090edc5
|
||||||
golang.org/x/net v0.0.0-20200528225125-3c3fba18258b // indirect
|
golang.org/x/net v0.0.0-20200528225125-3c3fba18258b // indirect
|
||||||
google.golang.org/protobuf v1.24.0 // indirect
|
google.golang.org/protobuf v1.24.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -120,6 +120,8 @@ github.com/temoto/robotstxt v1.1.1 h1:Gh8RCs8ouX3hRSxxK7B1mO5RFByQ4CmJZDwgom++Ja
|
||||||
github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo=
|
github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo=
|
||||||
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
|
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
|
||||||
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
|
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
|
||||||
|
github.com/tribalwarshelp/shared v0.0.0-20200602060635-0b3cb090edc5 h1:LeReuMU2zNi7tftm8nytrmkuD4BtLFUYZ3nlSZLE6ow=
|
||||||
|
github.com/tribalwarshelp/shared v0.0.0-20200602060635-0b3cb090edc5/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y=
|
||||||
github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk=
|
github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk=
|
||||||
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
|
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
|
||||||
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
|
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
|
||||||
|
|
14
main.go
14
main.go
|
@ -5,11 +5,13 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
_cron "twdcbot/cron"
|
|
||||||
"twdcbot/discord"
|
_cron "github.com/tribalwarshelp/dcbot/cron"
|
||||||
"twdcbot/mode"
|
"github.com/tribalwarshelp/dcbot/discord"
|
||||||
server_repository "twdcbot/server/repository"
|
server_repository "github.com/tribalwarshelp/dcbot/server/repository"
|
||||||
tribe_repository "twdcbot/tribe/repository"
|
tribe_repository "github.com/tribalwarshelp/dcbot/tribe/repository"
|
||||||
|
|
||||||
|
"github.com/tribalwarshelp/shared/mode"
|
||||||
|
|
||||||
"github.com/go-pg/pg/v10"
|
"github.com/go-pg/pg/v10"
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
@ -77,6 +79,4 @@ func main() {
|
||||||
<-channel
|
<-channel
|
||||||
|
|
||||||
log.Print("shutting down")
|
log.Print("shutting down")
|
||||||
os.Exit(0)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
35
mode/mode.go
35
mode/mode.go
|
@ -1,35 +0,0 @@
|
||||||
package mode
|
|
||||||
|
|
||||||
import "os"
|
|
||||||
|
|
||||||
const (
|
|
||||||
EnvMode = "mode"
|
|
||||||
DevelopmentMode = "development"
|
|
||||||
ProductionMode = "production"
|
|
||||||
TestMode = "test"
|
|
||||||
)
|
|
||||||
|
|
||||||
var mode = DevelopmentMode
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
Set(os.Getenv(EnvMode))
|
|
||||||
}
|
|
||||||
|
|
||||||
func Set(value string) {
|
|
||||||
if value == "" {
|
|
||||||
value = DevelopmentMode
|
|
||||||
}
|
|
||||||
|
|
||||||
switch value {
|
|
||||||
case DevelopmentMode,
|
|
||||||
ProductionMode,
|
|
||||||
TestMode:
|
|
||||||
mode = value
|
|
||||||
default:
|
|
||||||
panic("unknown mode: " + value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Get() string {
|
|
||||||
return mode
|
|
||||||
}
|
|
|
@ -7,8 +7,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
"twdcbot/tribalwars"
|
|
||||||
"twdcbot/utils"
|
"github.com/tribalwarshelp/dcbot/tribalwars"
|
||||||
|
"github.com/tribalwarshelp/dcbot/utils"
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
"github.com/gocolly/colly"
|
"github.com/gocolly/colly"
|
||||||
|
|
|
@ -2,7 +2,8 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"twdcbot/models"
|
|
||||||
|
"github.com/tribalwarshelp/dcbot/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Repository interface {
|
type Repository interface {
|
||||||
|
|
|
@ -2,8 +2,9 @@ package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"twdcbot/models"
|
|
||||||
"twdcbot/server"
|
"github.com/tribalwarshelp/dcbot/models"
|
||||||
|
"github.com/tribalwarshelp/dcbot/server"
|
||||||
|
|
||||||
"github.com/go-pg/pg/v10"
|
"github.com/go-pg/pg/v10"
|
||||||
"github.com/go-pg/pg/v10/orm"
|
"github.com/go-pg/pg/v10/orm"
|
||||||
|
|
|
@ -2,7 +2,8 @@ package tribe
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"twdcbot/models"
|
|
||||||
|
"github.com/tribalwarshelp/dcbot/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Repository interface {
|
type Repository interface {
|
||||||
|
|
|
@ -2,8 +2,9 @@ package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"twdcbot/models"
|
|
||||||
"twdcbot/tribe"
|
"github.com/tribalwarshelp/dcbot/models"
|
||||||
|
"github.com/tribalwarshelp/dcbot/tribe"
|
||||||
|
|
||||||
"github.com/go-pg/pg/v10"
|
"github.com/go-pg/pg/v10"
|
||||||
"github.com/go-pg/pg/v10/orm"
|
"github.com/go-pg/pg/v10/orm"
|
||||||
|
|
Reference in New Issue