🏡 index : ~doyle/dave.git

author Jordan Doyle <jordan@doyle.la> 2019-05-06 19:37:19.0 +00:00:00
committer GitHub <noreply@github.com> 2019-05-06 19:37:19.0 +00:00:00
commit
0ea37854d146a077657b6a5b4aec05bd69e30c38 [patch]
tree
4d3af34b42d9a04e730be2299d5536ada5ecc5d8
parent
7291d9d39f2042cf655aca84ccaafe435baef189
download
0ea37854d146a077657b6a5b4aec05bd69e30c38.tar.gz

remove attributes from quotes



Diff

 dave/modules/quote.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/dave/modules/quote.py b/dave/modules/quote.py
index c1ab448..b93ab84 100644
--- a/dave/modules/quote.py
+++ b/dave/modules/quote.py
@@ -10,17 +10,16 @@ from twisted.words.protocols.irc import assembleFormattedText, attributes as A

random.seed(os.urandom(64))

@dave.module.help("Syntax: aq [quote] (-- attribute). Add a quote.")
@dave.module.command(["aq", "addquote"], "(.*?)(?: (?:--|—) ?(.+?))?$")
@dave.module.help("Syntax: aq [quote]. Add a quote.")
@dave.module.command(["aq", "addquote"], "(.*)$")
@dave.module.ratelimit(1, 2)
def add_quote(bot, args, sender, source):
    generated_uuid = str(uuid.uuid4())
    quote = Quote(id=generated_uuid, quote=args[0], attributed=args[1], added_by=sender)
    quote = Quote(id=generated_uuid, quote=args[0], attributed=None, added_by=sender)
    dave.config.session.add(quote)

    bot.reply(source, sender, assembleFormattedText(
        A.normal["Successfully added quote: ", A.bold[args[0]], " by ",
                 (args[1] or sender)]))
        A.normal["Successfully added quote: ", A.bold[args[0]]))

    bot.msg(sender, "You can remove this quote later using \"dave dq {}\"".format(
        generated_uuid))
@@ -64,7 +63,7 @@ def find_quote(bot, args, sender, source):

    for quote in quotes:
        bot.reply(source, sender, assembleFormattedText(A.normal[
            "<{}> ".format(quote.attributed.strip()) if quote.attributed else "", A.bold[quote.quote], " (added by {})".format(quote.added_by)
            "<{}> ".format(quote.attributed.strip()) if quote.attributed else "", A.bold[quote.quote]
        ]))

@dave.module.help("Syntax: dq [uuid]. Allow the quote owner to delete a quote.")