From 85a037aefc915f86273660cbeb475fb02fde363a Mon Sep 17 00:00:00 2001 From: Adam Piontek Date: Sat, 25 Aug 2018 17:51:00 -0400 Subject: [PATCH] Give direct_to_user confirmation that breeds list reloaded, if reloadbreeds called by user, and not if called by listbreeds --- doggo.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doggo.py b/doggo.py index 89a7abf..569fc8d 100644 --- a/doggo.py +++ b/doggo.py @@ -37,12 +37,13 @@ class Doggo(BotPlugin): return resp.json()['message'] - @botcmd + @botcmd(split_args_with=' ') def listbreeds(self, msg, args): """ List available breeds for use in the random image retriever """ if not self.breeds: + args.append('calledbyfunction') self.reloadbreeds(msg, args) if not self.breeds: return 'Unable to load breeds list' @@ -53,8 +54,7 @@ class Doggo(BotPlugin): for breed in sorted(self.breeds.keys()): self.send(direct_to_user, breed) - - @botcmd(admin_only=True) + @botcmd(admin_only=True,split_args_with=' ') def reloadbreeds(self, msg, args): """ Reloads the list of breeds currently available @@ -74,3 +74,8 @@ class Doggo(BotPlugin): for breed in data: self.breeds[breed] = [] + + if 'calledbyfunction' not in args: + # Tell user command was successful + direct_to_user = self.build_identifier(str(msg.frm)) + self.send(direct_to_user, "Breed list successfully loaded")