From b8af1740fbc8231231942e53ad41a816d368ccdb Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Wed, 2 May 2018 09:26:01 +0400 Subject: [PATCH] Fix getting league chats This is used in /send_league, for example. --- lib/datacache/chats.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/datacache/chats.go b/lib/datacache/chats.go index 044b90c..1d2ce4a 100644 --- a/lib/datacache/chats.go +++ b/lib/datacache/chats.go @@ -103,8 +103,10 @@ func (dc *DataCache) GetLeaguePrivateChats() []dbmapping.Chat { for i := range dc.players { if dc.players[i].Status != "banned" && dc.players[i].Status != "spy" && dc.players[i].Status != "league_changed" && dc.players[i].LeagueID == 1 { - if dc.chats[dc.players[i].TelegramID] != nil { - chats = append(chats, *dc.chats[dc.players[i].TelegramID]) + for ii := range dc.chats { + if int(dc.chats[ii].TelegramID) == int(dc.players[i].TelegramID) { + chats = append(chats, *dc.chats[ii]) + } } } }