aboutsummaryrefslogtreecommitdiff
path: root/modules/quotes.py
diff options
context:
space:
mode:
authorGravatar dngfx2018-08-31 10:51:47 +0100
committerGravatar dngfx2018-08-31 10:51:47 +0100
commit90ce92dc39395444862edfc7946ef7a1195f2464 (patch)
tree6832c146a15879df292d265083bfe5795cbdfa69 /modules/quotes.py
parentReformat (diff)
Revert "Reformat"
This reverts commit abed9cf
Diffstat (limited to 'modules/quotes.py')
-rw-r--r--modules/quotes.py39
1 files changed, 16 insertions, 23 deletions
diff --git a/modules/quotes.py b/modules/quotes.py
index 1b5049bb..d09bba58 100644
--- a/modules/quotes.py
+++ b/modules/quotes.py
@@ -1,29 +1,24 @@
import random, time
-
class Module(object):
def __init__(self, bot):
self.bot = bot
bot.events.on("received").on("command").on("quoteadd",
- "qadd").hook(self.quote_add,
- min_args=1,
- help="Added a quote to a category",
- usage="<category> = <quote>")
+ "qadd").hook(self.quote_add, min_args=1,
+ help="Added a quote to a category",
+ usage="<category> = <quote>")
bot.events.on("received").on("command").on("quoteget",
- "qget").hook(self.quote_get,
- min_args=1,
- help="Find a quote within a category",
- usage="<category> = <search>")
+ "qget").hook(self.quote_get, min_args=1,
+ help="Find a quote within a category",
+ usage="<category> = <search>")
bot.events.on("received").on("command").on("quotedel",
- "qdel").hook(self.quote_del,
- min_args=1,
- help="Delete a quote from a category",
- usage="<category> = <quote>")
+ "qdel").hook(self.quote_del, min_args=1,
+ help="Delete a quote from a category",
+ usage="<category> = <quote>")
bot.events.on("received").on("command").on("quote",
- "q").hook(self.quote,
- min_args=1,
- help="Get a random quote from a category",
- usage="<category>")
+ "q").hook(self.quote, min_args=1,
+ help="Get a random quote from a category",
+ usage="<category>")
def category_and_quote(self, s):
if "=" in s:
@@ -52,14 +47,12 @@ class Module(object):
found.append(quote)
if found:
event["stdout"].write("%d quote%s found: %s" % (len(found),
- "s" if len(
- found) > 1 else "",
- found[0]))
+ "s" if len(found) > 1 else "", found[0]))
else:
event["stderr"].write("No quotes found")
else:
event["stderr"].write("Please provide a category and a "
- "part of a quote to find")
+ "part of a quote to find")
def quote_del(self, event):
category, remove_quote = self.category_and_quote(event["args"])
@@ -79,13 +72,13 @@ class Module(object):
event["stderr"].write("Quote not found")
else:
event["stderr"].write("Please provide a category and a quote "
- "to remove")
+ "to remove")
def quote(self, event):
category = event["args"].strip().lower()
quotes = event["server"].get_setting("quotes-%s" % category, [])
if quotes:
- index = random.randint(0, len(quotes) - 1)
+ index = random.randint(0, len(quotes)-1)
nickname, time_added, quote = quotes[index]
event["stdout"].write("%s: %s" % (category, quote))
else: