if match.command('assign'):
store_id = int(match.args()[1])
item_id = int(match.args()[2])
- result = Data().assign_store(store_id, item_id)
- return [result]
+ Data().assign_store(store_id, item_id)
+
+ # Now print the list for the assigned store
+ items = Data().get_shopping_list(store_id)
+ results = ['Shopping List']
+ for item in items:
+ results.append(str(item))
+ return results
if match.command('buy'):
item_id = ' '.join(match.args()[1:])
if match.command('clear'):
store_id = ' '.join(match.args()[1:])
Data().clear_list(store_id)
+ self.last_store_id = None
return ['Success']
if match.command('clear-all'):
if match.command('list'):
store_id = ' '.join(match.args()[1:])
+ if len(store_id) == 0:
+ store_id = None
+
items = Data().get_shopping_list(store_id)
+ results = ['Shopping List']
for item in items:
results.append(str(item))
return results
await bot.api.send_text_message(
room.room_id, str(line))
except Exception as ex:
- return ['You have:', ' no tea']
+ for line in ['You have:', ' no tea']:
+ await bot.api.send_text_message(
+ room.room_id, str(line))
+