From 1330cb67bc228cb1fbdcdf6e73af24f1640a3d24 Mon Sep 17 00:00:00 2001 From: Alphyron Date: Fri, 2 Apr 2021 10:52:44 +0200 Subject: [PATCH] :bug: Fix bug to message if bot or telegram left channel --- channels/leaveduserchecker.go | 14 +++++++++----- cli/commands/info.go | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/channels/leaveduserchecker.go b/channels/leaveduserchecker.go index 72e6629..6a6cb59 100644 --- a/channels/leaveduserchecker.go +++ b/channels/leaveduserchecker.go @@ -78,12 +78,16 @@ func checkGroupUser(group *models.Group, groupHelperService logic.GroupHelperSer if !member.HasLeft() { continue } - leaveMessage := group.UserLeaveMessage - leaveMessage = message.ReplaceMessage(leaveMessage, member.User) - msg := tgbotapi.NewMessage(group.GroupID, leaveMessage) - msg.ParseMode = "Markdown" - bot.Send(msg) + if !(member.User.IsBot || member.User.FirstName == "Telegram") { + leaveMessage := group.UserLeaveMessage + leaveMessage = message.ReplaceMessage(leaveMessage, member.User) + + msg := tgbotapi.NewMessage(group.GroupID, leaveMessage) + msg.ParseMode = "Markdown" + bot.Send(msg) + } + _, err = groupHelperService.UserLeaveGroup(user, group) if err != nil { log.Println(err) diff --git a/cli/commands/info.go b/cli/commands/info.go index 788e147..8b7fc5f 100644 --- a/cli/commands/info.go +++ b/cli/commands/info.go @@ -30,7 +30,7 @@ func (i infoCommand) ExecuteCommand(bot *tgbotapi.BotAPI, update *tgbotapi.Updat "General Information to this Bot\n" + "===============================\n" + "Developer: @Alphyron\n" + - "Version: 2.2.5\n" + + "Version: 2.2.6\n" + "Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" + "==============================="