fix(irc): append invite command on add (#297)

This commit is contained in:
Ludvig Lundgren 2022-06-11 02:05:31 +02:00 committed by GitHub
parent ffada19506
commit df7a51d479
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View file

@ -560,3 +560,26 @@ func (r *IrcRepo) UpdateChannel(channel *domain.IrcChannel) error {
return err
}
func (r *IrcRepo) UpdateInviteCommand(networkID int64, invite string) error {
// update record
channelQueryBuilder := r.db.squirrel.
Update("irc_network").
Set("invite_command", invite).
Where("id = ?", networkID)
query, args, err := channelQueryBuilder.ToSql()
if err != nil {
r.log.Error().Stack().Err(err).Msg("irc.UpdateInviteCommand: error building query")
return err
}
_, err = r.db.handler.Exec(query, args...)
if err != nil {
r.log.Error().Stack().Err(err).Msg("irc.UpdateInviteCommand: error executing query")
return err
}
return err
}