Bumped cchat to v0.3.0
This commit is contained in:
parent
ab7eccf48e
commit
51441f02b9
2
go.mod
2
go.mod
|
@ -5,7 +5,7 @@ go 1.14
|
||||||
require (
|
require (
|
||||||
github.com/Pallinder/go-randomdata v1.2.0
|
github.com/Pallinder/go-randomdata v1.2.0
|
||||||
github.com/diamondburned/aqs v0.0.0-20200704043812-99b676ee44eb
|
github.com/diamondburned/aqs v0.0.0-20200704043812-99b676ee44eb
|
||||||
github.com/diamondburned/cchat v0.2.12
|
github.com/diamondburned/cchat v0.3.0
|
||||||
github.com/lucasb-eyer/go-colorful v1.0.3
|
github.com/lucasb-eyer/go-colorful v1.0.3
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
golang.org/x/text v0.3.3 // indirect
|
golang.org/x/text v0.3.3 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -7,6 +7,8 @@ github.com/diamondburned/cchat v0.2.11 h1:w4c/6t02htGtVj6yIjznecOGMlkcj0TmmLy+K4
|
||||||
github.com/diamondburned/cchat v0.2.11/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
|
github.com/diamondburned/cchat v0.2.11/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
|
||||||
github.com/diamondburned/cchat v0.2.12 h1:R4wrBdhELMfhv2Kn3xL/H3ci8UcLXzFRPq1IrY4+js4=
|
github.com/diamondburned/cchat v0.2.12 h1:R4wrBdhELMfhv2Kn3xL/H3ci8UcLXzFRPq1IrY4+js4=
|
||||||
github.com/diamondburned/cchat v0.2.12/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
|
github.com/diamondburned/cchat v0.2.12/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
|
||||||
|
github.com/diamondburned/cchat v0.3.0 h1:xC8Y+/nwsVhc4a7i7R+4n0JczOnFSA2Gmj6Bz/pZ5zo=
|
||||||
|
github.com/diamondburned/cchat v0.3.0/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
|
||||||
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
|
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
|
||||||
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
||||||
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
|
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
|
||||||
|
|
|
@ -25,7 +25,7 @@ func NewMessageActioner(msgr *Messenger) MessageActioner {
|
||||||
const (
|
const (
|
||||||
DeleteAction = "Delete"
|
DeleteAction = "Delete"
|
||||||
NoopAction = "No-op"
|
NoopAction = "No-op"
|
||||||
BestTrapAction = "Who's the best trap?"
|
BestCharacterAction = "Who's the best character?"
|
||||||
TriggerTypingAction = "Trigger Typing"
|
TriggerTypingAction = "Trigger Typing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ func (msga MessageActioner) Actions(id string) []string {
|
||||||
return []string{
|
return []string{
|
||||||
DeleteAction,
|
DeleteAction,
|
||||||
NoopAction,
|
NoopAction,
|
||||||
BestTrapAction,
|
BestCharacterAction,
|
||||||
TriggerTypingAction,
|
TriggerTypingAction,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DoAction will be blocked by IO. As goes for every other method that
|
// Do will be blocked by IO. As goes for every other method that takes a
|
||||||
// takes a container: the frontend should call this in a goroutine.
|
// container: the frontend should call this in a goroutine.
|
||||||
func (msga MessageActioner) DoAction(action, messageID string) error {
|
func (msga MessageActioner) Do(action, messageID string) error {
|
||||||
switch action {
|
switch action {
|
||||||
case DeleteAction, TriggerTypingAction:
|
case DeleteAction, TriggerTypingAction:
|
||||||
i, err := strconv.Atoi(messageID)
|
i, err := strconv.Atoi(messageID)
|
||||||
|
@ -63,8 +63,8 @@ func (msga MessageActioner) DoAction(action, messageID string) error {
|
||||||
case NoopAction:
|
case NoopAction:
|
||||||
// do nothing.
|
// do nothing.
|
||||||
|
|
||||||
case BestTrapAction:
|
case BestCharacterAction:
|
||||||
return msga.msgr.EditMessage(messageID, "Astolfo.")
|
return msga.msgr.Edit(messageID, "Astolfo.")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return errors.New("Unknown action.")
|
return errors.New("Unknown action.")
|
||||||
|
|
|
@ -32,10 +32,10 @@ func (msgc MessageCompleter) Complete(words []string, i int64) []cchat.Completio
|
||||||
|
|
||||||
case lookbackCheck(words, i, "best", "femboys:"):
|
case lookbackCheck(words, i, "best", "femboys:"):
|
||||||
return makeCompletion(
|
return makeCompletion(
|
||||||
"trap: Astolfo",
|
"character: Astolfo",
|
||||||
"trap: Hackadoll No. 3",
|
"character: Hackadoll No. 3",
|
||||||
"trap: Totsuka",
|
"character: Totsuka",
|
||||||
"trap: Felix Argyle",
|
"character: Felix Argyle",
|
||||||
)
|
)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -128,8 +128,8 @@ func (msgr *Messenger) nextID() (id uint32) {
|
||||||
|
|
||||||
func (msgr *Messenger) AsEditor() cchat.Editor { return msgr }
|
func (msgr *Messenger) AsEditor() cchat.Editor { return msgr }
|
||||||
|
|
||||||
// MessageEditable returns true if the message belongs to the author.
|
// IsEditable returns true if the message belongs to the author.
|
||||||
func (msgr *Messenger) MessageEditable(id string) bool {
|
func (msgr *Messenger) IsEditable(id string) bool {
|
||||||
i, err := message.ParseID(id)
|
i, err := message.ParseID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
|
@ -147,7 +147,7 @@ func (msgr *Messenger) MessageEditable(id string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (msgr *Messenger) RawMessageContent(id string) (string, error) {
|
func (msgr *Messenger) RawContent(id string) (string, error) {
|
||||||
i, err := message.ParseID(id)
|
i, err := message.ParseID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -164,7 +164,7 @@ func (msgr *Messenger) RawMessageContent(id string) (string, error) {
|
||||||
return "", errors.New("Message not found")
|
return "", errors.New("Message not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (msgr *Messenger) EditMessage(id, content string) error {
|
func (msgr *Messenger) Edit(id, content string) error {
|
||||||
i, err := message.ParseID(id)
|
i, err := message.ParseID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
type Commander struct{}
|
type Commander struct{}
|
||||||
|
|
||||||
func (c *Commander) RunCommand(cmds []string, w io.Writer) error {
|
func (c *Commander) Run(cmds []string, w io.Writer) error {
|
||||||
switch cmd := arg(cmds, 0); cmd {
|
switch cmd := arg(cmds, 0); cmd {
|
||||||
case "ls":
|
case "ls":
|
||||||
fmt.Fprintln(w, "Commands: ls, random")
|
fmt.Fprintln(w, "Commands: ls, random")
|
||||||
|
|
Loading…
Reference in New Issue