✨ Add some small logs and optimze Dockerfile
This commit is contained in:
parent
7690ecb52e
commit
4b4e2fd4f0
@ -1,8 +1,12 @@
|
||||
# build stage
|
||||
FROM golang:1.13-stretch AS build-env
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.mod /src/go.mod
|
||||
RUN go mod download
|
||||
|
||||
COPY . /src
|
||||
|
||||
#ENV GOPROXY=http://192.168.0.143:3000
|
||||
|
||||
ENV GO113MODULE=on
|
||||
|
@ -1,6 +1,7 @@
|
||||
package channels
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.dragon-labs.de/alphyron/group_helper/logic"
|
||||
"git.dragon-labs.de/alphyron/group_helper/message"
|
||||
"git.dragon-labs.de/alphyron/group_helper/models"
|
||||
@ -16,13 +17,14 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group
|
||||
select {
|
||||
case <-ticker.C:
|
||||
|
||||
delete := make([]*obj.VerifyUser, 0)
|
||||
deleteVerifyUser := make([]*obj.VerifyUser, 0)
|
||||
|
||||
groups := make(map[int64]*models.Group, 0)
|
||||
users := make(map[int]*models.User, 0)
|
||||
|
||||
for _, user := range data.Users {
|
||||
user.LeftTime -= 1
|
||||
log.Println(fmt.Sprintf("Verify checker: (%d/%d/%d)", user.GroupID, user.UserID, user.LeftTime))
|
||||
|
||||
if user.LeftTime <= 0 {
|
||||
log.Println(len(data.Users))
|
||||
@ -57,7 +59,7 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group
|
||||
}
|
||||
|
||||
member, _ := bot.GetChatMember(userconfig)
|
||||
delete = append(delete, user)
|
||||
deleteVerifyUser = append(deleteVerifyUser, user)
|
||||
_, err := groupHelperService.UserLeaveGroup(users[user.UserID], groups[user.GroupID])
|
||||
|
||||
if err != nil {
|
||||
@ -115,7 +117,7 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group
|
||||
}
|
||||
}
|
||||
|
||||
for _, user := range delete {
|
||||
for _, user := range deleteVerifyUser {
|
||||
data.RemoveUser(user.UserID, user.GroupID)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user