Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Improve /match usability #29

Open
TimJentzsch opened this issue Nov 12, 2017 · 3 comments
Open

Improve /match usability #29

TimJentzsch opened this issue Nov 12, 2017 · 3 comments

Comments

@TimJentzsch
Copy link
Contributor

  1. Currently, when writing /match, without any match ID, the bot doesn't respond at all.
    It should do one of these things instead:
    1.a) Notify the user that he has to use the following format: /match ID, or
    1.b) Ask the user for a match ID and process it directly.
  2. The K/D/A should be formatted with tabs or similar to align it for easier readablity.

Screenshot of the current output:

Current Output

@zachkont
Copy link
Owner

The first point is a good idea.

About the second point, some research should be done in order to check what kind of support python has for that. Unfortunately, it's not as simple as using tabs. It could be done manually, by having a fixed max width and forcing that but I'd rather avoid it. Open to suggestions

@BenHargreaves
Copy link
Contributor

BenHargreaves commented Oct 29, 2018

Taking a look at this one at the moment, and it looks like the formatting may not be possible. The Bot seems to override the amount of whitespace when messaging a user, regardless of what text you send it.

I started by finding the length of the longest 'localized_name' of all heroes in the list returned by the dota API (only when main.py is run, not every time this info is needed), and then creating a string using The string.ljust() method to create a 'padded' string with length of the longest heroes name (currently KOTL), plus a tab character. The KDA info would be appended to the end of this string for every hero, and would be consistently spaced.

That is... until we pass the formatted string to the bot (via either bot.send_message or bot.reply_to). Using print statements right up until the bot is called to action showed correct formatting in the terminal, including the full "Winner / Radiant / Dire " string. Once the Bot took the string though, the spacing was suddenly inconsistent on the other end (as a user talking to the bot). Tried with different parse methods too (HTML instead of Markdown), but still no dice.

I've thrown in a PR for the first part anyway (/match with no ID handling). PR #59

@zachkont
Copy link
Owner

Thanks for resolving the first part.

I remember the bot ignoring whitespace in messages and I think I'm fine with using underscores or whatever looks fine. However there are at least 2 more things to consider with this issue:

  1. It's not only the hero name but the number of KDA that should probably be aligned, for example having 10/10/10 and 2/2/2 should probably show all 2's below the zeros. This can easily be done as 02/02/02 which is fairly easier and we can safely assume that 2 digits are enough. Preformatted text for a monospace font will be useful for this as well.

  2. Text bubble width is not fixed and it may not be enough for the entire hero name to display. There are various workaround to this, for example limiting hero name to something that makes sense and using ellipses for the overflowing characters, but I'm not sure which is the best approach

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

No branches or pull requests

3 participants