🐛 Deleted accounts get a backup name
This commit is contained in:
parent
1330cb67bc
commit
7d555687f4
@ -80,6 +80,14 @@ func checkGroupUser(group *models.Group, groupHelperService logic.GroupHelperSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !(member.User.IsBot || member.User.FirstName == "Telegram") {
|
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 := group.UserLeaveMessage
|
||||||
leaveMessage = message.ReplaceMessage(leaveMessage, member.User)
|
leaveMessage = message.ReplaceMessage(leaveMessage, member.User)
|
||||||
|
|
||||||
|
@ -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.6\n" +
|
"Version: 2.2.7\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" +
|
||||||
"==============================="
|
"==============================="
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"git.dragon-labs.de/alphyron/group_helper/models"
|
"git.dragon-labs.de/alphyron/group_helper/models"
|
||||||
"git.dragon-labs.de/alphyron/group_helper/telegram"
|
"git.dragon-labs.de/alphyron/group_helper/telegram"
|
||||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type databaseRoutine struct {
|
type databaseRoutine struct {
|
||||||
@ -43,29 +44,29 @@ func (d databaseRoutine) Update(botAPI *tgbotapi.BotAPI, update *tgbotapi.Update
|
|||||||
_, err := d.groupHelperService.UpdateGroup(group)
|
_, err := d.groupHelperService.UpdateGroup(group)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if update.Message.LeftChatMember != nil {
|
|
||||||
user, err := d.groupHelperService.GetUserByID(int64(update.Message.LeftChatMember.ID))
|
|
||||||
|
|
||||||
if err != nil {
|
if update.Message.LeftChatMember != nil {
|
||||||
return err
|
user, err := d.groupHelperService.GetUserByID(int64(update.Message.LeftChatMember.ID))
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
if err != nil {
|
||||||
success, err := d.groupHelperService.UserLeaveGroup(user, group)
|
|
||||||
log.Println(success)
|
|
||||||
log.Println(err)
|
|
||||||
|
|
||||||
}()
|
|
||||||
config := tgbotapi.ChatConfig{
|
|
||||||
ChatID: update.Message.Chat.ID,
|
|
||||||
}
|
|
||||||
size, _ := botAPI.GetChatMembersCount(config)
|
|
||||||
group.Size = size - 1
|
|
||||||
_, err = d.groupHelperService.UpdateGroup(group)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
go func() {
|
||||||
|
success, err := d.groupHelperService.UserLeaveGroup(user, group)
|
||||||
|
log.Println(success)
|
||||||
|
log.Println(err)
|
||||||
|
|
||||||
|
}()
|
||||||
|
config := tgbotapi.ChatConfig{
|
||||||
|
ChatID: update.Message.Chat.ID,
|
||||||
|
}
|
||||||
|
size, _ := botAPI.GetChatMembersCount(config)
|
||||||
|
group.Size = size - 1
|
||||||
|
_, err = d.groupHelperService.UpdateGroup(group)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
user, err := d.groupHelperService.GetUserByID(int64(update.Message.From.ID))
|
user, err := d.groupHelperService.GetUserByID(int64(update.Message.From.ID))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user