diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-06-10 17:37:05 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-06-10 17:37:05 +0200 |
| commit | 3d22d616283fd4d09943174fc4ce005a24242d46 (patch) | |
| tree | a3cb5bc7b65bc0f33f3b767060b4c40d16436efa | |
| parent | d75f70a88b897b76403bdb66e0c4747b57a209ab (diff) | |
| download | geldschieberbot-3d22d616283fd4d09943174fc4ce005a24242d46.tar.gz geldschieberbot-3d22d616283fd4d09943174fc4ce005a24242d46.zip | |
improve cars error and usage
| -rw-r--r-- | geldschieberbot.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/geldschieberbot.py b/geldschieberbot.py index 306fe5a..26ee8e1 100644 --- a/geldschieberbot.py +++ b/geldschieberbot.py @@ -149,9 +149,12 @@ gib amount recipient - give money to recipient zieh amount donor - get money from donor nimm amount donor - get money from donor +transfer amount source destination - transfer amount of your balance with source to destination + cars [cmd] - interact with the available cars cars [list | ls] - list available cars and their service charge -cars <add | new> <car-name> <service-charge> - add new car +cars add car-name service-charge - add new car +cars new car-name service-charge - add new car tanken amount [person] [car] [info] - calculate fuel costs, service charge and add them to the person's and car's balance respectively @@ -328,7 +331,7 @@ def cars(sender, args, msg): ret_msg += header_fmt.format(car, available_cars[car]) ret_msg += create_summary(car) else: - ret_msg += "Error {} is no available car\n".format(car) + return None, '"{}" is no available car\n'.format(car) return ret_msg, None # add car @@ -338,10 +341,10 @@ def cars(sender, args, msg): car = args[2] if car in available_cars: - return None, '{} already registered'.format(car) + return None, '"{}" already registered'.format(car) if car in balance: - return None, 'A user named {} already exists. Please use a different name for this car'.format(car) + return None, 'A user named "{}" already exists. Please use a different name for this car'.format(car) try: service_charge = to_cent(args[3]) @@ -360,7 +363,7 @@ def cars(sender, args, msg): balance[m][car] = 0 nb[m] = 0 balance[car] = nb - return "added {} as an available car".format(car), None + return 'added "{}" as an available car'.format(car), None else: return None, 'cmd not in form "{} [cmd]"'.format(args[0]) |
