🚑 Remove recursive db loading and fix a small bug ith the broadcast command
This commit is contained in:
parent
474744f928
commit
fdb6eccb40
@ -52,7 +52,7 @@ func (b broadcastCommand) ExecuteCommand(bot *tgbotapi.BotAPI, update *tgbotapi.
|
||||
return false, err
|
||||
}
|
||||
|
||||
msg := tgbotapi.NewMessage(currentGroup.GroupID, strings.Join(parts[2:], ""))
|
||||
msg := tgbotapi.NewMessage(currentGroup.GroupID, strings.Join(parts[2:], " "))
|
||||
_, err := bot.Send(msg)
|
||||
return err == nil, err
|
||||
}
|
||||
|
@ -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.2\n" +
|
||||
"Version: 2.2.4\n" +
|
||||
"Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" +
|
||||
"==============================="
|
||||
|
||||
|
@ -94,7 +94,7 @@ func (g groupHelperRepository) GetGroupByID(id int64) (*models.Group, error) {
|
||||
defaultGroup.FillDefaultValues()
|
||||
defaultGroup.GroupID = id
|
||||
|
||||
err := g.Conn.Set("gorm:auto_preload", true).Where("group_id = ?", id).First(&group)
|
||||
err := g.Conn.Preload("ControlledGroups").Where("group_id = ?", id).First(&group)
|
||||
|
||||
if err.RecordNotFound() {
|
||||
return g.CreateGroup(defaultGroup)
|
||||
@ -214,7 +214,7 @@ func (g groupHelperRepository) GetGroupByDBID(id uint64) (*models.Group, error)
|
||||
defaultGroup.FillDefaultValues()
|
||||
defaultGroup.ID = id
|
||||
|
||||
err := g.Conn.Set("gorm:auto_preload", true).Where("id = ?", id).First(&group)
|
||||
err := g.Conn.Preload("ControlledGroups").Where("id = ?", id).First(&group)
|
||||
|
||||
if err.RecordNotFound() {
|
||||
return g.CreateGroup(defaultGroup)
|
||||
|
Loading…
Reference in New Issue
Block a user