Skip to content

Commit 492edfc

Browse files
committedMar 27, 2017
indent fails and fixes
1 parent 3666bb0 commit 492edfc

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed
 

‎plugins/urls.py

+33-31
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,51 @@
22

33
class Urls(Plugin):
44

5-
def help_text(self, bot):
6-
return (bot.translate("url_help") + "\n" + bot.translate("url_help2"))
5+
def help_text(self, bot):
6+
return (bot.translate("url_help") + "\n" + bot.translate("url_help2"))
77

8-
def on_msg(self, bot, user_nick, host, channel, message):
9-
ms = message.lower()
8+
def on_msg(self, bot, user_nick, host, channel, message):
9+
ms = message.lower()
1010

11-
if bot.httpregex.search(ms) is None:
12-
return False
11+
if bot.httpregex.search(ms) is None:
12+
return False
1313

14-
# extract list of arrays from message
15-
urls = bot.geturlsfrommsg(message)
14+
# extract list of arrays from message
15+
urls = bot.geturlsfrommsg(message)
1616

17-
# loop through all items
18-
for url in urls:
17+
# loop through all items
18+
for url in urls:
1919

20-
# fetch html <title> element
21-
title = bot.sanitize(bot.geturltitle(url))
20+
# fetch html <title> element
21+
title = bot.sanitize(bot.geturltitle(url))
2222

23-
# Check if link can be added to wiki
24-
if not ms.startswith('!private') and not ms.startswith('!pr') and not ms.startswith('!nsfw'):
23+
# Check if link can be added to wiki
24+
if not ms.startswith('!private') and not ms.startswith('!pr') and not ms.startswith('!nsfw'):
2525

26-
# Set proper wikititle
27-
if title == "":
28-
title = url
26+
# Set proper wikititle
27+
if title == "":
28+
wikititle = url
29+
else:
30+
wikititle = title
2931

30-
# call bot and paste to wiki
31-
bot.get_plugin("MediaWiki").wikiupdate(wikititle, url)
32+
# call bot and paste to wiki
33+
bot.get_plugin("MediaWiki").wikiupdate(wikititle, url)
3234

33-
# If empty title, dont paste to irc
34-
if title == "":
35-
continue
35+
# If empty title, dont paste to irc
36+
if title == "":
37+
continue
3638

37-
# check if private link
38-
if ms.startswith('!private') or ms.startswith('!pr'):
39-
bot.send_message(channel, "[private] " + "Title: {title}".format(title=title), user_nick)
39+
# check if private link
40+
if ms.startswith('!private') or ms.startswith('!pr'):
41+
bot.send_message(channel, "[private] " + "Title: {title}".format(title=title), user_nick)
4042

41-
# check if link was marked as nsfw from sender
42-
elif ms.startswith('!nsfw'):
43-
bot.send_message(channel, "[nsfw] " + "Title: {title}".format(title=title), user_nick)
43+
# check if link was marked as nsfw from sender
44+
elif ms.startswith('!nsfw'):
45+
bot.send_message(channel, "[nsfw] " + "Title: {title}".format(title=title), user_nick)
4446

45-
# send title to
46-
else:
47-
bot.send_message(channel, "Title: {title}".format(title=title), user_nick)
47+
# send title to
48+
else:
49+
bot.send_message(channel, "Title: {title}".format(title=title), user_nick)
4850

4951

5052

0 commit comments

Comments
 (0)
Please sign in to comment.