kunt

golang IRC bot
git clone git://git.2f30.org/kunt
Log | Files | Refs | LICENSE

commit 114b6d66c20d5e8c7fabf922905611982dee4494
parent 2549ca60ec8b9555fac1ad506b6aa7fda6feead8
Author: sin <sin@2f30.org>
Date:   Mon, 29 Apr 2013 12:32:53 +0100

games: Stylistic changes

Diffstat:
Msrc/games/games.go | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/games/games.go b/src/games/games.go @@ -39,7 +39,7 @@ func newHangmanState(ic *irc.IrcContext, gc *chan irc.IrcMessage, sc *chan hgsta //for printf style functions, a short status of the game state func (s *hangmanState) String() string { - return fmt.Sprintf(">>[%s]<< lives: %d tried :[%s]", s.foundnow, s.lives, s.tried) + return fmt.Sprintf(">>[%s]<< lives: %d - tried: [%s]", s.foundnow, s.lives, s.tried) } //First hangman state. Awaits on the game chan for 2 special irc messages to set the nickname @@ -63,14 +63,14 @@ func hangmanInit(cs *hangmanState) { //Second hangman state. It waits on a private query for the goal and then emits the next state (hangmanMainLoop) //to the state channel func hangmanWaitGoal(cs *hangmanState) { - cs.ictx.SendPrivmsg(cs.channame, "hangman is waiting for goal.When ready use hangman <letter|possibleword>") + cs.ictx.SendPrivmsg(cs.channame, "Hangman is waiting for goal. When ready use hangman <letter|possibleword>") for msg := range *cs.gchan { msg.Params[1] = strings.TrimSpace(msg.Params[1]) if msg.Params[0] == cs.botname { if strings.HasPrefix(msg.Params[1], ":setgoal ") { cs.goal = msg.Params[1][9:] who := msg.Prefix[:strings.Index(msg.Prefix, "!")] - cs.ictx.SendPrivmsg(who, "goal is now set to :"+cs.goal) + cs.ictx.SendPrivmsg(who, "Goal is now set to: "+cs.goal) runes := make([]rune, len(cs.goal)) for i := 0; i < len(runes); i++ { runes[i] = '_' @@ -79,11 +79,11 @@ func hangmanWaitGoal(cs *hangmanState) { break } else { who := msg.Prefix[:strings.Index(msg.Prefix, "!")] - cs.ictx.SendPrivmsg(who, "Now we are playing hangman. use setgoal <WORD>") + cs.ictx.SendPrivmsg(who, "Now we are playing hangman. Use setgoal <WORD>") } } else { if strings.HasPrefix(msg.Params[1], ":hangman ") { - cs.ictx.SendPrivmsg(msg.Params[0], "still waiting for goal") + cs.ictx.SendPrivmsg(msg.Params[0], "Still waiting for goal...") } } } @@ -102,7 +102,7 @@ func hangmanMainLoop(cs *hangmanState) { msg.Params[1] = strings.TrimSpace(msg.Params[1]) if msg.Params[0] != cs.botname { if cs.lives < 1 { - cs.ictx.SendPrivmsg(msg.Params[0], "You are hanged! goal was ->"+cs.goal) + cs.ictx.SendPrivmsg(msg.Params[0], "You are hanged! Goal was ->"+cs.goal) *cs.statchan <- hangmanEnd } if strings.HasPrefix(msg.Params[1], ":hangman ") { @@ -166,7 +166,7 @@ func cmdHangman(a *irc.IrcContext, gc *chan irc.IrcMessage) { for { select { case <-timeout: - a.SendPrivmsg(hc.channame, "Time is up! goal was -> "+hc.goal) + a.SendPrivmsg(hc.channame, "Time is up! Goal was -> "+hc.goal) a.DelIntercept(gc) close(stchan) return