1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-mock.git synced 2024-12-02 18:02:57 +00:00

bumped to cchat v0.3.11

This commit is contained in:
diamondburned 2020-10-27 13:42:48 -07:00
parent 6d6056f11a
commit 4f6dfbfc24
3 changed files with 28 additions and 6 deletions

2
go.mod
View file

@ -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.3.8 github.com/diamondburned/cchat v0.3.11
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

4
go.sum
View file

@ -17,6 +17,10 @@ github.com/diamondburned/cchat v0.3.6 h1:at9bnxlABa3TGscra/cRq/ASsmJh6GCdQ0vnCD9
github.com/diamondburned/cchat v0.3.6/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI= github.com/diamondburned/cchat v0.3.6/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
github.com/diamondburned/cchat v0.3.8 h1:vgFe8giVfwsAO+WpTYsTDIXvRUN48osVPNu0pZNvPEk= github.com/diamondburned/cchat v0.3.8 h1:vgFe8giVfwsAO+WpTYsTDIXvRUN48osVPNu0pZNvPEk=
github.com/diamondburned/cchat v0.3.8/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI= github.com/diamondburned/cchat v0.3.8/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
github.com/diamondburned/cchat v0.3.9 h1:qsYUz68aBApoMz7zo1snrIz3U/ljPJ+YyRhZcpQvzbw=
github.com/diamondburned/cchat v0.3.9/go.mod h1:IlMtF+XIvAJh0GL/2yFdf0/34w+Hdy5A1GgvSwAXtQI=
github.com/diamondburned/cchat v0.3.11 h1:C1f9Tp7Kz3t+T1SlepL1RS7b/kACAKWAIZXAgJEpCHg=
github.com/diamondburned/cchat v0.3.11/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=

View file

@ -4,6 +4,7 @@ import (
"github.com/diamondburned/cchat" "github.com/diamondburned/cchat"
"github.com/diamondburned/cchat-mock/internal/internet" "github.com/diamondburned/cchat-mock/internal/internet"
"github.com/diamondburned/cchat-mock/internal/session" "github.com/diamondburned/cchat-mock/internal/session"
"github.com/diamondburned/cchat/text"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -11,6 +12,14 @@ type Authenticator struct{}
var _ cchat.Authenticator = (*Authenticator)(nil) var _ cchat.Authenticator = (*Authenticator)(nil)
func (Authenticator) Name() text.Rich {
return text.Plain("Slow Authentication")
}
func (Authenticator) Description() text.Rich {
return text.Plain("")
}
func (Authenticator) AuthenticateForm() []cchat.AuthenticateEntry { func (Authenticator) AuthenticateForm() []cchat.AuthenticateEntry {
return []cchat.AuthenticateEntry{ return []cchat.AuthenticateEntry{
{ {
@ -27,19 +36,28 @@ func (Authenticator) AuthenticateForm() []cchat.AuthenticateEntry {
} }
} }
func (Authenticator) Authenticate(form []string) (cchat.Session, error) { func (Authenticator) Authenticate(form []string) (cchat.Session, cchat.AuthenticateError) {
// SLOW IO TIME. // SLOW IO TIME.
if err := internet.SimulateAustralian(); err != nil { err := internet.SimulateAustralian()
return nil, errors.Wrap(err, "Authentication failed") if err == nil {
return session.New(form[0], ""), nil
} }
return session.New(form[0], ""), nil return nil, cchat.WrapAuthenticateError(errors.Wrap(err, "Authentication failed"))
} }
type FastAuthenticator struct{} type FastAuthenticator struct{}
var _ cchat.Authenticator = (*FastAuthenticator)(nil) var _ cchat.Authenticator = (*FastAuthenticator)(nil)
func (FastAuthenticator) Name() text.Rich {
return text.Plain("Fast Authenticator")
}
func (FastAuthenticator) Description() text.Rich {
return text.Plain("Internet fails and slow-downs disabled.")
}
func (FastAuthenticator) AuthenticateForm() []cchat.AuthenticateEntry { func (FastAuthenticator) AuthenticateForm() []cchat.AuthenticateEntry {
return []cchat.AuthenticateEntry{ return []cchat.AuthenticateEntry{
{ {
@ -48,6 +66,6 @@ func (FastAuthenticator) AuthenticateForm() []cchat.AuthenticateEntry {
} }
} }
func (FastAuthenticator) Authenticate(form []string) (cchat.Session, error) { func (FastAuthenticator) Authenticate(form []string) (cchat.Session, cchat.AuthenticateError) {
return session.New(form[0], ""), nil return session.New(form[0], ""), nil
} }