mirror of
https://github.com/diamondburned/cchat-mock.git
synced 2025-01-29 21:27:22 +00:00
Updated cchat impl to v0.0.35
This commit is contained in:
parent
b286a03011
commit
3155c1b6d6
19
channel.go
19
channel.go
|
@ -150,6 +150,25 @@ func (ch *Channel) JoinServer(ctx context.Context, ct cchat.MessagesContainer) (
|
|||
return stop, nil
|
||||
}
|
||||
|
||||
// MessageEditable returns true if the message belongs to the author.
|
||||
func (ch *Channel) MessageEditable(id string) bool {
|
||||
i, err := parseID(id)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
ch.messageMutex.Lock()
|
||||
defer ch.messageMutex.Unlock()
|
||||
|
||||
m, ok := ch.messages[i]
|
||||
if ok {
|
||||
// Editable if same author.
|
||||
return m.author.Content == ch.username.Content
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (ch *Channel) RawMessageContent(id string) (string, error) {
|
||||
i, err := parseID(id)
|
||||
if err != nil {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,6 +4,6 @@ go 1.14
|
|||
|
||||
require (
|
||||
github.com/Pallinder/go-randomdata v1.2.0
|
||||
github.com/diamondburned/cchat v0.0.34
|
||||
github.com/diamondburned/cchat v0.0.35
|
||||
github.com/pkg/errors v0.9.1
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -56,6 +56,8 @@ github.com/diamondburned/cchat v0.0.28 h1:+1VnltW0rl8/NZTUP+x89jVhi3YTTR+e6iLprZ
|
|||
github.com/diamondburned/cchat v0.0.28/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU=
|
||||
github.com/diamondburned/cchat v0.0.34 h1:BGiVxMRA9dmW3rLilIldBvjVan7eTTpaWCCfX9IKBYU=
|
||||
github.com/diamondburned/cchat v0.0.34/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU=
|
||||
github.com/diamondburned/cchat v0.0.35 h1:WiMGl8BQJgbP9E4xRxgLGlqUsHpTcJgDKDt8/6a7lBk=
|
||||
github.com/diamondburned/cchat v0.0.35/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
|
|
Loading…
Reference in a new issue