From 3d22d616283fd4d09943174fc4ce005a24242d46 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 10 Jun 2019 17:37:05 +0200 Subject: improve cars error and usage --- geldschieberbot.py | 13 ++++++++----- 1 file 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 +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]) -- cgit v1.2.3