Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result of lobby match #90

Open
amirhossein-mlkz opened this issue Sep 14, 2022 · 3 comments
Open

result of lobby match #90

amirhossein-mlkz opened this issue Sep 14, 2022 · 3 comments

Comments

@amirhossein-mlkz
Copy link

Hello. how can I get the match result and end match event when I lunch the current lobby into a game?

@MirkevychV
Copy link

MirkevychV commented Dec 6, 2022

` self.dota.on('lobby_changed', self.lobby_change_handler)

    self.state_handler_dispatch = dict([
        (LobbyState.RUN, None),
        (LobbyState.POSTGAME, self.post_game_handler),
    ])

def post_game_handler(self, message=None):
    match message.match_outcome:
        case 2:  
            winner = Light
        case 3:  
            winner = Dark`

@Philaeux
Copy link
Contributor

Philaeux commented Mar 3, 2023

As previously stated, the even to subscribe to is dota2.features.Lobby.EVENT_LOBBY_CHANGED, so subscribe a function to listen to change on it.

dota.on(dota2.features.Lobby.EVENT_LOBBY_CHANGED, game_update)

def game_update(self, message):
   # Here message.state can be 
   # 0: in lobby
   # 1: in-game (loading)
   # 2: in game
   # 3: post-game
   # if 3, message.match_outcome == 2 if radiant win, or 3 if dire win

ISSUE STATUS: CLOSED
ISSUE TAG: HOWTO

@DiDHack
Copy link

DiDHack commented May 27, 2024

Does somebody know how to get score of match? Printing of whole message object shows not all attributes. I have know about match_outcome from this thread only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants