Tkd-Alex/Twitch-Channel-Points-Miner-v2

Command line colors for easy distinction

Yishaqel opened this issue ยท 8 comments

After a few days using this program, I have realized that it is not easy to distinguish some things and I thought it would be easier if some parts were colored.

For example, in the bets several messages are shown but it is not easy to read the streamer who you are betting on.

I imagine something similar to this but with colors:

Start betting for EventPrediction: Please star this repo owned by streamer-username (xxx points)
+12 โ†’ streamer-username (xxx points) - Reason: WATCH.

The bold text would be in random color, the same for the percentages in the bets.

Thanks for your work!

I think it would be easier to distinguish when you have a lot of text on the screen and also to know what you have gained from the previous prediction. I don't understand programming so I don't know if it can be easily implemented.

The coloured terminal was my first idea to integrate in the logging module, but I switched to emoji.
Personally, I don't have any issue to distinguish the message because I have the emoji. I can work on terminal colour, but I'm scared that we can have a problem on Windows and then working for nothing ๐Ÿ˜ž

I have previously used command line programs that worked with colors and so I thought it could be implemented but still it is not something that is urgent or essential. Thanks for taking it into account anyway!

Check if you are able to run https://github.com/tartley/colorama on your machine.
You can create a new file called color-test.py, the following code should be enough

from colorama import init
init()

from colorama import Fore, Back, Style
print(Fore.RED + 'some red text')
print(Back.GREEN + 'and with a green background')
print(Style.DIM + 'and in dim text')
print(Style.RESET_ALL)
print('back to normal now')

Remember also to do pip install colorama

They seem to work on Windows 10, with cmd and windows terminal.

cmd_2021-02-03 14 57 57 765_FU7qK5p3H6

For example, in the bets several messages are shown but it is not easy to read the streamer who you are betting on.

I totally agree with that part. The betting logs are a lot and you don't really know if the bet has been placed (last log is Going to place the bet for EventPrediction: xxx but no bet placed or something of the kind).

Also I kinda agree with the colors a bit, the terminal colors seems to be more widely working on different terminals. Like cmd for example, it supports the colors but not the emojis. Windows terminal supports both but isn't really the default in Windows for now.

Though I kinda agree with @Tkd-Alex though more, the emojis already give an easy way to see what lines correspond to what kind of event. They are already somewhat colored by themselves (but need to have them enabled and can be a problem on windows for example).

Using colors may be hard (IMO) to find enough colors that are readable. Having a background to the text seems ugly, and the font color itself will also depend on what is the background of the terminal. Some likes it black, some gray, some kinda transparent... So what renders well on one side, may not on the other.

I guess this is kinda a tradeoff between implementing colors in the code or having users using a not too old terminal so that it supports emojis.


Though as readability is mentioned here, I have one point with the emojis that is rather hard to read: the online/offline (๐Ÿฅณ / ๐Ÿ˜ž ). The faces are quite small and if not up close not that distinguishable. Something like โœ”๏ธ / โŒ seems more readable.

Just to add a bit about the prediction logs, while working on #46 I added a log line into prediction-made to see the points that are placed:

03/02 15:02:10 - ๏ฟฝ  -3580 โ†’ iskall85 (35.8k points) - Reason: PREDICTION.

And I have to say that this is quite convenient to have the info directly under the eye instead of searching in the 4ish lines when the bet is being placed. Though I guess that #41 can help towards that by having technical stuff as a debug log and the actual bet sent as an info log summarizing the thing.

For me colorama is working correctly.

Most of the logs are only for DEBUG, I've added for tested and never deleted or moved on DEBUG instead INFO.
About the prediction's logs. If #41 will be successful we definitely remove the Browser class and all the related logs:

04/02/21 14:35:22 - INFO - [start_bet]: ๐Ÿ”ง  Starting betting for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!) owned by Streamer(username=username, channel_id=0000, channel_points=1.3k)

04/02/21 14:35:33 - INFO - [__open_coins_menu]: ๐Ÿ”ง  Opening coins menu for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!)
04/02/21 14:35:35 - INFO - [__click_on_bet]: ๐Ÿ”ง  Clicking on the bet for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!)
04/02/21 14:35:37 - INFO - [__enable_custom_bet_value]: ๐Ÿ”ง  Enable input of custom value for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!)

04/02/21 14:35:39 - INFO - [on_message]: โฐ  Place the bet after: 18.21s for: EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!)

04/02/21 14:35:57 - INFO - [place_bet]: ๐Ÿ”ง  Going to complete bet for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!) owned by Streamer(username=username, channel_id=0000, channel_points=1.3k)
04/02/21 14:35:58 - INFO - [place_bet]: ๐Ÿ”ง  Decision: Yes (BLUE), Points: 7k, Users: 22 (46.81%), Odds: 4.07 (24.57%)
04/02/21 14:35:58 - INFO - [place_bet]: ๐Ÿ”ง  Going to write: 65 channel points on input A
04/02/21 14:36:00 - INFO - [place_bet]: ๐Ÿ”ง  Going to place the bet for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!)

Will be only:

04/02/21 14:35:39 - INFO - [on_message]: โฐ  Place the bet after: 18.21s for: EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!)
04/02/21 14:35:57 - INFO - [place_bet]: ๐Ÿ€  Going to complete bet for EventPrediction(event_id=xxxx-yyyy-zzzz, title=Please leave a star on this repo!) owned by Streamer(username=username, channel_id=0000, channel_points=1.3k)
04/02/21 14:35:58 - INFO - [place_bet]: ๐Ÿ€  Place 2345 channel points on Yes (BLUE), Points: 7k, Users: 22 (46.81%), Odds: 4.07 (24.57%)

Of course, we can also add a single-line when the bet was confirmed by Twitch ws.


In queue:

Something like โœ”๏ธ / โŒ seems more readable.