Remove random method, just return a random item when no arguments are given.

This commit is contained in:
Pedro de Oliveira 2020-02-06 21:39:32 +00:00
parent d65870d5db
commit 440b048e2a
1 changed files with 9 additions and 12 deletions

View File

@ -140,10 +140,17 @@ class Inquisicao(callbacks.Plugin):
return json.loads(response.content.decode('utf-8'))
def find(self, irc, msg, args, text, position):
"""<text> [position]
"""[text] [position]
Returns the matched proccess with <text>, at [position].
Or a random one if no arguments are given.
"""
if not text:
data = self.__do_request('degredo', {})
irc.reply(self.__format_message(data, False), prefixNick=False)
return
data = self.__do_request('adcautelam',
{
'key': text,
@ -155,17 +162,7 @@ class Inquisicao(callbacks.Plugin):
return
irc.reply(self.__format_message(data, True), prefixNick=False)
find = wrap(find, ['anything', optional('int', default=0)])
def random(self, irc, msg, args):
"""takes no arguments
Returns a random proccess.
"""
data = self.__do_request('degredo', {})
irc.reply(self.__format_message(data, False), prefixNick=False)
random = wrap(random)
find = wrap(find, [optional('anything'), optional('int', default=0)])
Class = Inquisicao