Quotes in sqlite 2

This commit is contained in:
mrhanky 2017-05-16 08:58:12 +02:00
parent c17df31655
commit ad90fefd5e
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -15,7 +15,7 @@ class Quotes(DatabasePlugin):
'irc3.plugins.command',
]
REGEX = re.compile(r'<?[~&@%+]?([a-zA-Z0-9_\-^`|\\\[\]{}]+)>?')
NICK_REGEX = re.compile(r'<?[~&@%+]?([a-zA-Z0-9_\-^`|\\\[\]{}]+)>?')
# noinspection PyUnusedLocal
@command(options_first=True)
@ -28,11 +28,10 @@ class Quotes(DatabasePlugin):
cmd = args.get('<cmd>')
nick = args['<nick>']
item = args.get('<quote>')
print(cmd, nick, item)
if cmd and item:
if self.guard.has_permission(mask, 'admin'):
if cmd == 'add':
nick = self.REGEX.match(nick).group(1)
nick = self.NICK_REGEX.match(nick).group(1)
self.cur.execute('insert into quotes (nick, item) '
'values (?, ?)', [nick, ' '.join(item)])
if cmd == 'del':