I'm making a python script for a twitch bot which basically acts as a slot machine. Disclaimer- I'm totally new to python, so please don't kill me.
At the start of the script, I have this code to check if the correct command was typed, check if the first argument is an integer, and check if the user has enough points. The idea is to let them choose an amount to gamble, so the cost line will be changed once i get it working.
if data.IsChatMessage():
if (data.GetParam(0).lower() == settings["command"]
and isinstance((int(data.GetParam(1).lower())), int)
and settings["costs"] <= Parent.GetPoints(data.User)):
The input from the chat is always in a string form, even if it's only a number. I'm able to convert that to an int with int(), but if there's nothing or if there's something there other than numbers it crashes the script entirely. How can I keep the script from crashing and instead alert the user they need to input an integer? Thanks!