Archived
1

Pin to all squads at :55 of every even hour

Closes #9
This commit is contained in:
2017-11-24 13:24:36 +04:00
parent a32ed89be8
commit b038d5b10d
8 changed files with 64 additions and 5 deletions

View File

@@ -38,6 +38,19 @@ func (s *Squader) GetSquadByID(squadID int) (dbmapping.SquadChat, bool) {
return squadFull, true
}
// GetAllSquadChats returns all main squad chats
func (s *Squader) GetAllSquadChats() ([]dbmapping.Chat, bool) {
groupChats := []dbmapping.Chat{}
err := c.Db.Select(&groupChats, "SELECT ch.* FROM chats ch, squads s WHERE s.chat_id=ch.id")
if err != nil {
c.Log.Error(err)
return groupChats, false
}
return groupChats, true
}
// GetUserRolesInSquads lists all user roles
func (s *Squader) GetUserRolesInSquads(playerRaw *dbmapping.Player) ([]dbmapping.SquadPlayerFull, bool) {
userRoles := []dbmapping.SquadPlayerFull{}

View File

@@ -12,6 +12,7 @@ import (
type SquaderInterface interface {
Init()
GetAllSquadChats() ([]dbmapping.Chat, bool)
GetSquadByID(squadID int) (dbmapping.SquadChat, bool)
GetUserRolesInSquads(playerRaw *dbmapping.Player) ([]dbmapping.SquadPlayerFull, bool)