forked from an/flokati
modules/nickserv.go: removed, modules/quiz.go: sorted ranklist
This commit is contained in:
parent
44e5a1cfe4
commit
5d2392bc5e
3
Makefile
3
Makefile
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
|
@ -99,9 +99,24 @@ func quizRun() {
|
|||
}
|
||||
|
||||
func quizPrintRanklist(ranklist map[string]int) {
|
||||
if len(ranklist) == 0 {
|
||||
return
|
||||
}
|
||||
SayCh <- fmt.Sprintf("%s\nAktueller Punktestand:", "*")
|
||||
for {
|
||||
maxk := ""
|
||||
maxv := -1
|
||||
if len(ranklist) == 0 {
|
||||
break
|
||||
}
|
||||
for k, v := range ranklist {
|
||||
SayCh <- fmt.Sprintf("%s\n%s: %d", "*", k, v)
|
||||
if v > maxv {
|
||||
maxv = v
|
||||
maxk = k
|
||||
}
|
||||
}
|
||||
delete(ranklist, maxk)
|
||||
SayCh <- fmt.Sprintf("%s\n%s: %d", "*", maxk, maxv)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue