Give direct_to_user confirmation that breeds list reloaded, if reloadbreeds called by user, and not if called by listbreeds
This commit is contained in:
parent
5b866c4a2a
commit
85a037aefc
1 changed files with 8 additions and 3 deletions
11
doggo.py
11
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")
|
||||
|
|
Loading…
Reference in a new issue