4815162342lost / steam_gifts_bot

bot for http://www.steamgifts.com/
GNU General Public License v3.0
32 stars 6 forks source link

Small bug and ideas #5

Closed TheGoblinHero closed 7 years ago

TheGoblinHero commented 7 years ago
  1. Update the "version" file on the github to 1.2.9. Now version check wrongly says that the new version is available.
  2. Random giveaways are good idea, but only if you have a lot of spare coins. If you do not have a lot of coins - it's better to save them for possible new wishlist/searchlist games. I've made a small fix for it:
  if int(get_coins(get_requests(cookie, "coins_check")))>250:
      print("Working with random giveaways...")

Maybe it's worth adding an extra settings (min coins to enter random giveaways) for this?

  1. On win "win.sh" script is started. Awesome thing, I use it to send me the mail. The problem is it depends on "need_beep" and "platform.system()=="Linux"" (I'm on FreeBSD). Again, I've made a small fix:

def do_beep(reason): if reason=="won": os.system("./win.sh") return if not need_beep: return 0

Not sure if this modification is good for everyone, but still it's a thing to consider.

4815162342lost commented 7 years ago

1) Current version 1.2.9 has been updated yesterday and i think 1.2.9 is not stable now and i need more time to test it. I do not want to hurry (i do not want that users with 1.2.8 update to 1.2.9 now). It's will be fix when i tested 1.2.9

2) Great idea, thanks

3) Thanks, but windows users can't run sh scripts. I do not work with FreeBSD, but i will investigate your suggestion.

Have a nice day!

TheGoblinHero commented 7 years ago

Another bug in 1.2.9 (need conversion to str()?):

Game: Teddy Floppy Ear - Mountain Adventure. Coins: 287 https://www.steamgifts.com/giveaway/DV0gK/teddy-floppy-ear-the-race Traceback (most recent call last): File "./sg.py", line 410, in requests_result=get_requests(cookie, func_list[chose]) File "./sg.py", line 124, in get_requests get_game_links(r) File "./sg.py", line 147, in get_game_links if enter_geaway(geaway_link): File "./sg.py", line 231, in enter_geaway debug_messages("Giveaway was ended. Bot has late to enter giveaway: ", geaway_link) TypeError: debug_messages() takes 1 positional argument but 2 were given

About 3. Yes, I forgot about windows users. On FBSD platform.system returns "FreeBSD". You can use it to allow sh scripts to run too.

4815162342lost commented 7 years ago

Thanks a lot for bug report.

4815162342lost commented 7 years ago

1) I need more time for testing 2) Done. Please, update settings.txt elif req_type=="someone" and int(get_coins(get_requests(cookie, "coins_check")))>int(threshold): Options threshold has been added.

3) Done. if datetime.datetime.now().time().hour>9 and datetime.datetime.now().time().hour<22 and (platform.system()=="Linux" or platform.system()=="FreeBSD"):

But some changes may be unstable. I need 1 or 2 weeks for tests. Please, update your sg.py file

And i need to update wiki too. Thank you for understanding

Best regards, 4815162342lost.

TheGoblinHero commented 7 years ago

I need 1 or 2 weeks for tests.

Sure, thx for integrating my ideas. I'm running the script 24/7 so I'll help you with the testing. If I find a bug/problem - I'll post it here.

One more thing - I'm not satisfied with your realization of 3. "Beep" does not work on FBSD and I don't like limiting the external script launch by night time. I propose to change the code this way: http://pastebin.com/M3AbkZiE

P.S. bug found:

Search giveaways contains SimCity Search giveaways contains Legends of Persia Traceback (most recent call last): File "./sg.py", line 412, in requests_result=get_requests(cookie, func_list[chose]) File "./sg.py", line 133, in get_requests return r UnboundLocalError: local variable 'r' referenced before assignment

I've seen it before in the old version of the script. Can be fixed adding "r=None" at the beginning of the get_requests function.

4815162342lost commented 7 years ago

You want to hear beep only if you won, right? And anytime (at 3:00 am, 06:00 am, 03:00 pm, 06:00 pm and etc.) will be OK for you? And you do not want hear beep if giveaways contains bad words and etc?

TheGoblinHero commented 7 years ago

Yes, you're right. Because win.sh is not a beep sound for me, but mail send script.

4815162342lost commented 7 years ago

Could you please provide me with your mail send code?

I want to add mail-send function in my script too. If it possible for you, of course. It is very good idea.

TheGoblinHero commented 7 years ago

Sure. One liner:

echo SteamGifts Win | mail -s "SG Win!" root

Works on FreeBSD, also will work on Linux. The problem is - your computer must be properly configured (mail server or forwarder). For example, on my server all mail for the root user are forwarded to my gmail account. P.S. You can write an email instead of "root", but again, properly configured system is needed.

4815162342lost commented 7 years ago

Added "silent_mode_at_night" on the settings.txt Please, turn off silent_mode_at_night and you will get e-mail for 24 hours a day. silent_mode_at_night=0

Bug fixes, i think, but do not sure.

Could you please update script and test again?

TheGoblinHero commented 7 years ago

Updated, testing now... BTW platform comparison is not needed in this string:

if (datetime.datetime.now().time().hour<9 or datetime.datetime.now().time().hour>22) and silent_mode_at_night and (platform.system()=="Linux" or platform.system()=="FreeBSD"): debug_messages("Not beep, because too late") return 0

4815162342lost commented 7 years ago

Yes, true, thanks. It is will be fix.

TheGoblinHero commented 7 years ago

3 days of running the latest script - no problems. Everything including emails works as expected.

4815162342lost commented 7 years ago

Thanks you!

Could you please close the issue?

TheGoblinHero commented 7 years ago

FYI: 2 weeks of flawless work of the script.

4815162342lost commented 7 years ago

Thanks for your feedback! Glad to hear it.

Have a nice day!