pokerthproto.protocol module

The PokerTH protocol consisting of messages and replies with respect to the current state in the communication.

class pokerthproto.protocol.ClientProtocol[source]

Bases: pokerthproto.protocol.PokerTHProtocol

afterHandShowCardsReceived(msg)[source]
allInShowCardsReceived(msg)[source]
announceReceived(msg)[source]
chatReceived(msg)[source]
dealFlopCardsReceived(msg)[source]
dealRiverCardReceived(msg)[source]
dealTurnCardReceived(msg)[source]
endOfGameReceived(msg)[source]
endOfHandHideCardsReceived(msg)[source]
endOfHandShowCardsReceived(msg)[source]
gameListNewReceived(msg)[source]
gameListPlayerJoinedReceived(msg)[source]
gameListPlayerLeftReceived(msg)[source]
gameListUpdateReceived(msg)[source]
gamePlayerJoinedReceived(msg)[source]
gamePlayerLeftReceived(msg)[source]
gameStartInitialReceived(msg)[source]
handStartReceived(msg)[source]
handleChat(chatType, text, lobbyInfo, gameInfo=None, playerInfo=None)[source]

Handle the behavior of our client when a chat message was received.

Overwrite this method.

Parameters:
  • chatType – “Lobby”, “Game”, “Bot”, “Broadcast” or “Private”
  • text – text of the message
  • lobbyInfo – lobby information (Lobby)
  • gameInfo – optional game information (Game)
  • playerInfo – optional player information (Player)
handleEndOfGame(gameInfo, winner)[source]

Handle the end of a game

The end of a game brings you back to the lobby

Parameters:
  • gameInfo – game information (Game)
  • winner – winner of the game (Player)
handleEndOfHand(gameInfo)[source]

Handle the end of a hand

Parameters:gameInfo – game information (Game)
handleInsideLobby(lobbyInfo)[source]

Handle the behavior of our client in the lobby.

Overwrite this method.

Parameters:lobbyInfo – information about the lobby (Lobby)
handleMyTurn(gameInfo)[source]

Decide what action to take when it is our turn.

Parameters:gameInfo – game information (Game)
handleOthersTurn(playerInfo, gameInfo)[source]

Handle the start of another player’s turn.

Parameters:
  • playerInfo – player information (Player)
  • gameInfo – game information (Game)
initAckReceived(msg)[source]
joinGameAckReceived(msg)[source]
playerInfoReplyReceived(msg)[source]
playerListReceived(msg)[source]
playersActionDoneReceived(msg)[source]
playersTurnReceived(msg)[source]
sendChatRequest(text, gameId=None, playerId=None)[source]

Send a chat message.

Parameters:
  • text – your message
  • gameId – optional game id
  • playerId – optional player id
sendJoinExistingGame(gameId, autoLeave=False)[source]
sendJoinNewGame(gameInfo, password=None, autoLeave=False)[source]
sendMyAction(action, bet, relative=True)[source]

Send my action during a poker game.

Parameters:
  • action – action of Action
  • bet – bet with respect to the action
  • relative – boolean if the bet is relative to the highest set bet
sendStartEvent(gameId, startEventType=None, fillWithBots=False)[source]
showMyCardsRequestReceived(msg)[source]
startEventReceived(msg)[source]
state = 0
yourActionRejected(msg)[source]
class pokerthproto.protocol.ClientProtocolFactory(nickName)[source]

Bases: twisted.internet.protocol.ClientFactory

clientConnectionFailed(connector, reason)[source]
clientConnectionLost(connector, reason)[source]
protocol

alias of ClientProtocol

class pokerthproto.protocol.PokerTHProtocol[source]

Bases: twisted.internet.protocol.Protocol

adminBanPlayerAckReceived(msg)
adminBanPlayerReceived(msg)
adminRemoveGameAckReceived(msg)
adminRemoveGameReceived(msg)
afterHandShowCardsReceived(msg)
allInShowCardsReceived(msg)
announceReceived(msg)
askKickDeniedReceived(msg)
askKickPlayerReceived(msg)
authClientResponseReceived(msg)
authServerChallengeReceived(msg)
authServerVerificationReceived(msg)
avatarDataReceived(msg)
avatarEndReceived(msg)
avatarHeaderReceived(msg)
avatarRequestReceived(msg)
chatReceived(msg)
chatRejectReceived(msg)
chatRequestReceived(msg)
connectionLost(reason)[source]
connectionMade()[source]
dataReceived(data)[source]
dealFlopCardsReceived(msg)
dealRiverCardReceived(msg)
dealTurnCardReceived(msg)
dialogReceived(msg)
endKickPetitionReceived(msg)
endOfGameReceived(msg)
endOfHandHideCardsReceived(msg)
endOfHandShowCardsReceived(msg)
errorReceived(msg)
gameAdminChangedReceived(msg)
gameListAdminChangedReceived(msg)
gameListNewReceived(msg)
gameListPlayerJoinedReceived(msg)
gameListPlayerLeftReceived(msg)
gameListSpectatorJoinedReceived(msg)
gameListSpectatorLeftReceived(msg)
gameListUpdateReceived(msg)
gamePlayerJoinedReceived(msg)
gamePlayerLeftReceived(msg)
gameSpectatorJoinedReceived(msg)
gameSpectatorLeftReceived(msg)
gameStartInitialReceived(msg)
gameStartRejoinReceived(msg)
handStartReceived(msg)
initAckReceived(msg)
initReceived(msg)
inviteNotifyReceived(msg)
invitePlayerToGameReceived(msg)
joinExistingGameReceived(msg)
joinGameAckReceived(msg)
joinGameFailedReceived(msg)
joinNewGameReceived(msg)
kickPetitionUpdateReceived(msg)
kickPlayerRequestReceived(msg)
leaveGameRequestReceived(msg)
myActionRequestReceived(msg)
playerIdChangedReceived(msg)
playerInfoReplyReceived(msg)
playerInfoRequestReceived(msg)
playerListReceived(msg)
playersActionDoneReceived(msg)
playersTurnReceived(msg)
rejectGameInvitationReceived(msg)
rejectInvNotifyReceived(msg)
rejoinExistingGameReceived(msg)
removedFromGameReceived(msg)
reportAvatarAckReceived(msg)
reportAvatarReceived(msg)
reportGameAckReceived(msg)
reportGameReceived(msg)
resetTimeoutReceived(msg)
showMyCardsRequestReceived(msg)
startEventAckReceived(msg)
startEventReceived(msg)
startKickPetitionReceived(msg)
statisticsReceived(msg)
subscriptionRequestReceived(msg)
timeoutWarningReceived(msg)
unhandledMessageReceived(msg)[source]
unknownAvatarReceived(msg)
voteKickReplyReceived(msg)
voteKickRequestReceived(msg)
yourActionRejectedReceived(msg)
class pokerthproto.protocol.States[source]

Bases: object

Enum of all client states

GAME_JOINED = 2
GAME_STARTED = 3
INIT = 0
LOBBY = 1
pokerthproto.protocol.enum2str(enumType, enum)[source]

Translates a pokerth_pb2 enum type to a string.

Parameters:
  • enumType – enum type class
  • enum – the enum element of the type
Returns:

identifier string of enum