本文整理匯總了Golang中github.com/justinkim/yullibot/irc.Message.SenderNick方法的典型用法代碼示例。如果您正苦於以下問題:Golang Message.SenderNick方法的具體用法?Golang Message.SenderNick怎麽用?Golang Message.SenderNick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/justinkim/yullibot/irc.Message
的用法示例。
在下文中一共展示了Message.SenderNick方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DoInit
func (avalon *AvalonCommand) DoInit(bot *models.Bot, msg *irc.Message) {
if msg.IsDirectMessage() {
bot.Connection.RespondTo(msg, noDMCommandString)
return
}
if avalon.game != nil {
bot.Connection.RespondTo(msg, gameInProgressString)
return
}
avalon.channel = msg.Channel()
avalon.lobbyLeader = msg.SenderNick()
avalon.game = cmodels.NewAvalonGame()
avalon.game.AddPlayer(avalon.lobbyLeader)
bot.Connection.RespondTo(msg, newGameString)
}
示例2: IssuedByLobbyLeaderInGameChannel
func (avalon *AvalonCommand) IssuedByLobbyLeaderInGameChannel(msg *irc.Message) error {
if msg.IsDirectMessage() {
return errors.New(noDMCommandString)
}
if avalon.game == nil {
return errors.New(noActiveGameString)
}
if avalon.lobbyLeader != msg.SenderNick() {
return errors.New(onlyLobbyLeaderCanDoThatString)
}
if avalon.channel != msg.Channel() {
resp := fmt.Sprintf(correctChannelFormatString, avalon.channel)
return errors.New(resp)
}
return nil
}
示例3: DoJoin
func (avalon *AvalonCommand) DoJoin(bot *models.Bot, msg *irc.Message) {
if msg.IsDirectMessage() {
bot.Connection.RespondTo(msg, noDMCommandString)
return
}
if avalon.game == nil {
bot.Connection.RespondTo(msg, noActiveGameString)
return
}
if avalon.game.GamePhase != cmodels.PhaseWaitingForPlayers {
bot.Connection.RespondTo(msg, lobbyClosedString)
return
}
if avalon.channel == msg.Channel() {
err := avalon.game.AddPlayer(msg.SenderNick())
if err != nil {
if err == cmodels.ErrPlayerExists {
bot.Connection.RespondTo(msg, alreadyJoinedString)
} else if err == cmodels.ErrTooManyPlayers {
bot.Connection.RespondTo(msg, tooManyPlayersString)
}
return
}
bot.Connection.RespondTo(msg, playerAddedString)
joinProgress := fmt.Sprintf(joinProgressFormatString, avalon.game.NumPlayers())
bot.Connection.Say(msg.Channel(), joinProgress)
if avalon.game.CanStartConfig() {
resp := fmt.Sprintf(readyToConfigFormatString, avalon.lobbyLeader)
bot.Connection.Say(msg.Channel(), resp)
}
}
}