🐛 Deleted accounts get a backup name

This commit is contained in:
Alphyron 2021-04-02 11:16:22 +02:00
parent 1330cb67bc
commit 7d555687f4
3 changed files with 29 additions and 20 deletions

View File

@ -80,6 +80,14 @@ func checkGroupUser(group *models.Group, groupHelperService logic.GroupHelperSer
}
if !(member.User.IsBot || member.User.FirstName == "Telegram") {
if member.User == nil || member.User.FirstName == "" {
member.User = &tgbotapi.User{
ID: -1,
FirstName: "Unknown",
IsBot: false,
}
}
leaveMessage := group.UserLeaveMessage
leaveMessage = message.ReplaceMessage(leaveMessage, member.User)

View File

@ -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.6\n" +
"Version: 2.2.7\n" +
"Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" +
"==============================="

View File

@ -5,6 +5,7 @@ import (
"git.dragon-labs.de/alphyron/group_helper/models"
"git.dragon-labs.de/alphyron/group_helper/telegram"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
"log"
)
type databaseRoutine struct {
@ -43,7 +44,7 @@ func (d databaseRoutine) Update(botAPI *tgbotapi.BotAPI, update *tgbotapi.Update
_, err := d.groupHelperService.UpdateGroup(group)
return err
}
/*
if update.Message.LeftChatMember != nil {
user, err := d.groupHelperService.GetUserByID(int64(update.Message.LeftChatMember.ID))
@ -65,7 +66,7 @@ func (d databaseRoutine) Update(botAPI *tgbotapi.BotAPI, update *tgbotapi.Update
_, err = d.groupHelperService.UpdateGroup(group)
return err
}
*/
user, err := d.groupHelperService.GetUserByID(int64(update.Message.From.ID))
if err != nil {