fix: optimized urlban logic
This commit is contained in:
parent
a2cb955ed8
commit
c1190d6317
@ -235,9 +235,11 @@ class MumbleBot:
|
|||||||
constants.strings('user_ban'))
|
constants.strings('user_ban'))
|
||||||
return
|
return
|
||||||
|
|
||||||
if parameter:
|
if not self.is_admin(user) and parameter:
|
||||||
|
input_url = util.get_url_from_input(parameter.lower())
|
||||||
|
if input_url:
|
||||||
for i in var.db.items("url_ban"):
|
for i in var.db.items("url_ban"):
|
||||||
if util.get_url_from_input(parameter.lower()) == i[0]:
|
if input_url == i[0]:
|
||||||
self.mumble.users[text.actor].send_text_message(
|
self.mumble.users[text.actor].send_text_message(
|
||||||
constants.strings('url_ban'))
|
constants.strings('url_ban'))
|
||||||
return
|
return
|
||||||
|
1
util.py
1
util.py
@ -294,6 +294,7 @@ class Dir(object):
|
|||||||
# Parse the html from the message to get the URL
|
# Parse the html from the message to get the URL
|
||||||
|
|
||||||
def get_url_from_input(string):
|
def get_url_from_input(string):
|
||||||
|
string = string.strip()
|
||||||
if string.startswith('http'):
|
if string.startswith('http'):
|
||||||
return string
|
return string
|
||||||
p = re.compile('href="(.+?)"', re.IGNORECASE)
|
p = re.compile('href="(.+?)"', re.IGNORECASE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user