Bumped cchat to v0.3.0

This commit is contained in:
diamondburned 2020-10-09 10:16:19 -07:00
parent ab7eccf48e
commit 51441f02b9
6 changed files with 19 additions and 17 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.14
require (
github.com/Pallinder/go-randomdata v1.2.0
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/pkg/errors v0.9.1
golang.org/x/text v0.3.3 // indirect

2
go.sum
View File

@ -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.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.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/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=

View File

@ -25,7 +25,7 @@ func NewMessageActioner(msgr *Messenger) MessageActioner {
const (
DeleteAction = "Delete"
NoopAction = "No-op"
BestTrapAction = "Who's the best trap?"
BestCharacterAction = "Who's the best character?"
TriggerTypingAction = "Trigger Typing"
)
@ -33,14 +33,14 @@ func (msga MessageActioner) Actions(id string) []string {
return []string{
DeleteAction,
NoopAction,
BestTrapAction,
BestCharacterAction,
TriggerTypingAction,
}
}
// DoAction will be blocked by IO. As goes for every other method that
// takes a container: the frontend should call this in a goroutine.
func (msga MessageActioner) DoAction(action, messageID string) error {
// Do will be blocked by IO. As goes for every other method that takes a
// container: the frontend should call this in a goroutine.
func (msga MessageActioner) Do(action, messageID string) error {
switch action {
case DeleteAction, TriggerTypingAction:
i, err := strconv.Atoi(messageID)
@ -63,8 +63,8 @@ func (msga MessageActioner) DoAction(action, messageID string) error {
case NoopAction:
// do nothing.
case BestTrapAction:
return msga.msgr.EditMessage(messageID, "Astolfo.")
case BestCharacterAction:
return msga.msgr.Edit(messageID, "Astolfo.")
default:
return errors.New("Unknown action.")

View File

@ -32,10 +32,10 @@ func (msgc MessageCompleter) Complete(words []string, i int64) []cchat.Completio
case lookbackCheck(words, i, "best", "femboys:"):
return makeCompletion(
"trap: Astolfo",
"trap: Hackadoll No. 3",
"trap: Totsuka",
"trap: Felix Argyle",
"character: Astolfo",
"character: Hackadoll No. 3",
"character: Totsuka",
"character: Felix Argyle",
)
default:

View File

@ -128,8 +128,8 @@ func (msgr *Messenger) nextID() (id uint32) {
func (msgr *Messenger) AsEditor() cchat.Editor { return msgr }
// MessageEditable returns true if the message belongs to the author.
func (msgr *Messenger) MessageEditable(id string) bool {
// IsEditable returns true if the message belongs to the author.
func (msgr *Messenger) IsEditable(id string) bool {
i, err := message.ParseID(id)
if err != nil {
return false
@ -147,7 +147,7 @@ func (msgr *Messenger) MessageEditable(id string) bool {
return false
}
func (msgr *Messenger) RawMessageContent(id string) (string, error) {
func (msgr *Messenger) RawContent(id string) (string, error) {
i, err := message.ParseID(id)
if err != nil {
return "", err
@ -164,7 +164,7 @@ func (msgr *Messenger) RawMessageContent(id string) (string, error) {
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)
if err != nil {
return err

View File

@ -15,7 +15,7 @@ import (
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 {
case "ls":
fmt.Fprintln(w, "Commands: ls, random")