csgo-league / csgo-league-bot

League Discord bot
https://discord.gg/b5MhANU
GNU General Public License v3.0
14 stars 12 forks source link

Add a command to check the status of a current match by discord user id #7

Open B3none opened 4 years ago

B3none commented 4 years ago

It'll require an endpoint on the backend but I think it would be nice to add a command for this as people in the current queue might want to know how long they will be waiting for players in that match to join.

cameronshinn commented 4 years ago

In the API could this become an extension of in_match? Instead of having this function return a boolean, we can have it return the player's match if they are in one, otherwise return None. This way the return value can be treated like a boolean (and is functionally the same), but can also be used to get the match object.

EDIT: Oops I was thinking we had an in_match function, but the one I linked is is_linked. I realize we check if they are in a match from their profile object.

B3none commented 4 years ago

I could alter the existing inMatch response to return either false OR an object for the current the current map of their game if they’re in one. Would that help?

The only problem is that then the player response becomes quite bloated. I think it’d be easier to get a match by someone’s discord Id in a separate endpoint.

cameronshinn commented 4 years ago

Yeah I think having a separate endpoint would probably be best.

As a side note, in the player object we could replace inMatch with current_match which is either null or the match ID. More informative that way.

WardPearce commented 4 years ago

Could introduce a matches route what allows you to pull multiple matches based off your desired parameters, if no parameters given just return X amount of the latest matches.

This would allow you to find matches based off Discord IDs, Match IDs etc..

cameronshinn commented 4 years ago

Could introduce a matches route what allows you to pull multiple matches based off your desired parameters, if no parameters given just return X amount of the latest matches.

This would allow you to find matches based off Discord IDs, Match IDs etc..

Yeah this could be a good all-in-one solution. Get an active match by player ID, steam ID, match ID.

B3none commented 4 years ago

Okay, I'll implement and endpoint on the web and let you know when it's merged.

B3none commented 4 years ago

Could introduce a matches route what allows you to pull multiple matches based off your desired parameters, if no parameters given just return X amount of the latest matches.

This would allow you to find matches based off Discord IDs, Match IDs etc..

I would probably steer away from this because I don't want one jack of all trades style endpoint if I can help it. My only exception to this would be if we switched over to using a GraphQL API.