Archived
1

Ban politic lifted for a while

This commit is contained in:
Vladimir Hodakov 2017-11-29 12:19:30 +04:00
parent 184055e2f8
commit 4d7f545c92

View File

@ -211,24 +211,28 @@ func (s *Squader) getCommandersForSquadViaChat(chatRaw *dbmapping.Chat) ([]dbmap
} }
func (s *Squader) kickUserFromSquadChat(user *tgbotapi.User, chatRaw *dbmapping.Chat) { func (s *Squader) kickUserFromSquadChat(user *tgbotapi.User, chatRaw *dbmapping.Chat) {
chatUserConfig := tgbotapi.ChatMemberConfig{ bastionChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64)
ChatID: chatRaw.TelegramID, hqChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.HeadquartersID, 10, 64)
UserID: user.ID, if chatRaw.TelegramID == bastionChatID {
} chatUserConfig := tgbotapi.ChatMemberConfig{
ChatID: chatRaw.TelegramID,
UserID: user.ID,
}
kickConfig := tgbotapi.KickChatMemberConfig{ kickConfig := tgbotapi.KickChatMemberConfig{
ChatMemberConfig: chatUserConfig, ChatMemberConfig: chatUserConfig,
UntilDate: 1893456000, UntilDate: 1893456000,
} }
_, err := c.Bot.KickChatMember(kickConfig) _, err := c.Bot.KickChatMember(kickConfig)
if err != nil { if err != nil {
c.Log.Error(err.Error()) c.Log.Error(err.Error())
} }
_, err = c.Bot.UnbanChatMember(chatUserConfig) _, err = c.Bot.UnbanChatMember(chatUserConfig)
if err != nil { if err != nil {
c.Log.Error(err.Error()) c.Log.Error(err.Error())
}
} }
suerName := "" suerName := ""
@ -240,9 +244,6 @@ func (s *Squader) kickUserFromSquadChat(user *tgbotapi.User, chatRaw *dbmapping.
suerName += " " + user.LastName suerName += " " + user.LastName
} }
} }
bastionChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64)
hqChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.HeadquartersID, 10, 64)
if chatRaw.TelegramID != bastionChatID { if chatRaw.TelegramID != bastionChatID {
// In Bastion notifications are public in default chat // In Bastion notifications are public in default chat
commanders, ok := s.getCommandersForSquadViaChat(chatRaw) commanders, ok := s.getCommandersForSquadViaChat(chatRaw)