🐛 Fix bug to message if bot or telegram left channel

This commit is contained in:
Alphyron 2021-04-02 10:52:44 +02:00
parent a0494b72b1
commit 1330cb67bc
2 changed files with 10 additions and 6 deletions

View File

@ -78,12 +78,16 @@ func checkGroupUser(group *models.Group, groupHelperService logic.GroupHelperSer
if !member.HasLeft() { if !member.HasLeft() {
continue continue
} }
if !(member.User.IsBot || member.User.FirstName == "Telegram") {
leaveMessage := group.UserLeaveMessage leaveMessage := group.UserLeaveMessage
leaveMessage = message.ReplaceMessage(leaveMessage, member.User) leaveMessage = message.ReplaceMessage(leaveMessage, member.User)
msg := tgbotapi.NewMessage(group.GroupID, leaveMessage) msg := tgbotapi.NewMessage(group.GroupID, leaveMessage)
msg.ParseMode = "Markdown" msg.ParseMode = "Markdown"
bot.Send(msg) bot.Send(msg)
}
_, err = groupHelperService.UserLeaveGroup(user, group) _, err = groupHelperService.UserLeaveGroup(user, group)
if err != nil { if err != nil {
log.Println(err) log.Println(err)

View File

@ -30,7 +30,7 @@ func (i infoCommand) ExecuteCommand(bot *tgbotapi.BotAPI, update *tgbotapi.Updat
"General Information to this Bot\n" + "General Information to this Bot\n" +
"===============================\n" + "===============================\n" +
"Developer: @Alphyron\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" + "Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" +
"===============================" "==============================="