modules/nickserv.go: removed, modules/quiz.go: sorted ranklist

This commit is contained in:
Andreas Neue 2017-01-21 18:20:57 +01:00
parent 44e5a1cfe4
commit 5d2392bc5e
3 changed files with 20 additions and 22 deletions

View File

@ -9,6 +9,9 @@ build: genversion genbuilddate test
build-win: test genversion
GOOS=windows GOARCH=amd64 go build -v -o flokatirc.exe flokatirc
docker: build
./dockerbuild.sh
genversion:
./genversion.sh

View File

@ -1,20 +0,0 @@
// vi:ts=4:sts=4:sw=4:noet:tw=72
package modules
import (
"fmt"
"time"
)
func init() {
RunFuncs["nickserv"] = nickservRun
}
func nickservRun() {
pass := ModParams["nickserv-pass"]
email := ModParams["nickserv-email"]
time.Sleep(10 * time.Second)
SayCh <- fmt.Sprintf("%s\n%s %s %s", "N", "REGISTER", pass, email)
SayCh <- fmt.Sprintf("%s\n%s %s", "N", "IDENTIFY", pass)
}

View File

@ -99,9 +99,24 @@ func quizRun() {
}
func quizPrintRanklist(ranklist map[string]int) {
if len(ranklist) == 0 {
return
}
SayCh <- fmt.Sprintf("%s\nAktueller Punktestand:", "*")
for k, v := range ranklist {
SayCh <- fmt.Sprintf("%s\n%s: %d", "*", k, v)
for {
maxk := ""
maxv := -1
if len(ranklist) == 0 {
break
}
for k, v := range ranklist {
if v > maxv {
maxv = v
maxk = k
}
}
delete(ranklist, maxk)
SayCh <- fmt.Sprintf("%s\n%s: %d", "*", maxk, maxv)
}
}