Skip to content

Commit

Permalink
fix: SQLite can not delete dialogue
Browse files Browse the repository at this point in the history
  • Loading branch information
RicheyJang committed Feb 25, 2022
1 parent 7c44ad9 commit 52e3539
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ require (
github.com/wcharczuk/go-chart/v2 v2.1.0
github.com/wdvxdr1123/ZeroBot v1.4.1
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
gorm.io/driver/mysql v1.2.0
gorm.io/driver/postgres v1.2.2
gorm.io/driver/sqlite v1.2.6
gorm.io/gorm v1.22.3
gorm.io/driver/mysql v1.3.2
gorm.io/driver/postgres v1.3.1
gorm.io/driver/sqlite v1.3.1
gorm.io/gorm v1.23.1
)

require (
Expand All @@ -40,15 +40,15 @@ require (
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.0 // indirect
github.com/jackc/pgconn v1.10.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.8.1 // indirect
github.com/jackc/pgx/v4 v4.13.0 // indirect
github.com/jackc/pgtype v1.9.1 // indirect
github.com/jackc/pgx/v4 v4.14.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect
github.com/jinzhu/now v1.1.4 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/lestrrat-go/strftime v1.0.5 // indirect
Expand Down
7 changes: 2 additions & 5 deletions plugins/chat/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ func SetDialogue(groupID int64, question string, answer message.Message) error {

// DeleteDialogue 根据问题删除一个问答
func DeleteDialogue(groupID int64, question string) error {
groupD := GroupChatDialogue{
GroupID: groupID,
Question: question,
}
return proxy.GetDB().Delete(&groupD).Error
return proxy.GetDB().
Where("group_id = ? AND question = ?", groupID, question).Delete(&GroupChatDialogue{}).Error
}

// GetDialogue 根据群号和问题获取answer消息
Expand Down

0 comments on commit 52e3539

Please sign in to comment.