all repos — paprika @ e568d23f7e187249da9d1f243b788c24c6afe0fa

go rewrite of taigabot

Unify usage text, gofmt
Anirudh Oppiliappan x@icyphox.sh
Sun, 26 Dec 2021 22:21:10 +0530
commit

e568d23f7e187249da9d1f243b788c24c6afe0fa

parent

6db4885ec5acb77b0a73fe306c42874b18e2bed3

5 files changed, 9 insertions(+), 11 deletions(-)

jump to
M config/helpers.goconfig/helpers.go

@@ -11,12 +11,12 @@

func SplitChannelList(channels []string) string { lineSize := 0 first := true - + var ret strings.Builder // Splits configured list of channels into a safe set of commands for _, channel := range channels { - if lineSize + len(channel) > 510 { + if lineSize+len(channel) > 510 { lineSize = 0 first = true ret.WriteByte('\r')

@@ -63,7 +63,7 @@ }

} func usage() { - println("usage: paprika [init] [-c config]\n") + println("Usage: paprika [init] [-c config]\n") println(" init Initialize configuration for the bot.") println(" -c config Use config given on the command line.\n") os.Exit(1)
M contrib/new-plugin.gocontrib/new-plugin.go

@@ -1,6 +1,6 @@

package main -// usage: go run new-plugin.go <name> +// Usage: go run new-plugin.go <name> import ( "fmt"
M plugins/decide.goplugins/decide.go

@@ -44,7 +44,7 @@ terms = append(terms, currTerm.String())

} if len(terms) < 1 { - return "usage: .decide proposition 1 [ or proposition 2 [ or proposition n ... ] ]", nil + return "Usage: .decide proposition 1 [ or proposition 2 [ or proposition n ... ] ]", nil } else if len(terms) < 2 { return []string{"Yes.", "No."}[rand.Intn(2)], nil } else {
M plugins/lastfm.goplugins/lastfm.go

@@ -35,7 +35,7 @@ return "Database error", err

} return "Successfully set Last.fm username", nil } else { - return "usage: .lfm <username>", nil + return "Usage: .lfm <username>", nil } case ".np": user, err := lastfm.GetUser(m.Prefix.Name)
M plugins/youtube.goplugins/youtube.go

@@ -24,12 +24,11 @@

func (Youtube) Execute(m *irc.Message) (string, error) { parsed := strings.SplitN(m.Trailing(), " ", 2) if len(parsed) == 1 && parsed[0] == ".yt" { - return "usage: .yt QUERY", nil + return "Usage: .yt QUERY", nil } else if parsed[0] != ".yt" { return "", NoReply // ??? } - return YoutubeSearch(parsed[1]) }

@@ -59,7 +58,7 @@ if err != nil {

return "", err } - search := youtube.NewSearchService(service).List([]string{}); + search := youtube.NewSearchService(service).List([]string{}) search = search.Q(query) res, err := search.Do() if err != nil {

@@ -105,7 +104,7 @@ return "", err

} vidservice := youtube.NewVideosService(service) - vcall := vidservice.List([]string{"snippet","statistics","contentDetails"}); + vcall := vidservice.List([]string{"snippet", "statistics", "contentDetails"}) vcall = vcall.Id(vid) vres, err := vcall.Do() if err != nil {

@@ -135,7 +134,6 @@ published = humanize.Time(publishedParsed)

} else { published = snippet.Snippet.PublishedAt[:10] } - return fmt.Sprintf( "\x02%s\x02 %s - \x0303↑ %s\x03 \x0304↓ ?\x03 - \x02%s\x02 views - \x02%s\x02 %s",