Quotes in sqlite 2
This commit is contained in:
parent
c17df31655
commit
ad90fefd5e
@ -15,7 +15,7 @@ class Quotes(DatabasePlugin):
|
|||||||
'irc3.plugins.command',
|
'irc3.plugins.command',
|
||||||
]
|
]
|
||||||
|
|
||||||
REGEX = re.compile(r'<?[~&@%+]?([a-zA-Z0-9_\-^`|\\\[\]{}]+)>?')
|
NICK_REGEX = re.compile(r'<?[~&@%+]?([a-zA-Z0-9_\-^`|\\\[\]{}]+)>?')
|
||||||
|
|
||||||
# noinspection PyUnusedLocal
|
# noinspection PyUnusedLocal
|
||||||
@command(options_first=True)
|
@command(options_first=True)
|
||||||
@ -28,11 +28,10 @@ class Quotes(DatabasePlugin):
|
|||||||
cmd = args.get('<cmd>')
|
cmd = args.get('<cmd>')
|
||||||
nick = args['<nick>']
|
nick = args['<nick>']
|
||||||
item = args.get('<quote>')
|
item = args.get('<quote>')
|
||||||
print(cmd, nick, item)
|
|
||||||
if cmd and item:
|
if cmd and item:
|
||||||
if self.guard.has_permission(mask, 'admin'):
|
if self.guard.has_permission(mask, 'admin'):
|
||||||
if cmd == 'add':
|
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) '
|
self.cur.execute('insert into quotes (nick, item) '
|
||||||
'values (?, ?)', [nick, ' '.join(item)])
|
'values (?, ?)', [nick, ' '.join(item)])
|
||||||
if cmd == 'del':
|
if cmd == 'del':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user