Skip to content

Commit

Permalink
indent fails and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
noqqe committed Mar 27, 2017
1 parent 3666bb0 commit 492edfc
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions plugins/urls.py
Expand Up @@ -2,49 +2,51 @@

class Urls(Plugin):

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

def on_msg(self, bot, user_nick, host, channel, message):
ms = message.lower()
def on_msg(self, bot, user_nick, host, channel, message):
ms = message.lower()

if bot.httpregex.search(ms) is None:
return False
if bot.httpregex.search(ms) is None:
return False

# extract list of arrays from message
urls = bot.geturlsfrommsg(message)
# extract list of arrays from message
urls = bot.geturlsfrommsg(message)

# loop through all items
for url in urls:
# loop through all items
for url in urls:

# fetch html <title> element
title = bot.sanitize(bot.geturltitle(url))
# fetch html <title> element
title = bot.sanitize(bot.geturltitle(url))

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

# Set proper wikititle
if title == "":
title = url
# Set proper wikititle
if title == "":
wikititle = url
else:
wikititle = title

# call bot and paste to wiki
bot.get_plugin("MediaWiki").wikiupdate(wikititle, url)
# call bot and paste to wiki
bot.get_plugin("MediaWiki").wikiupdate(wikititle, url)

# If empty title, dont paste to irc
if title == "":
continue
# If empty title, dont paste to irc
if title == "":
continue

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

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

# send title to
else:
bot.send_message(channel, "Title: {title}".format(title=title), user_nick)
# send title to
else:
bot.send_message(channel, "Title: {title}".format(title=title), user_nick)



0 comments on commit 492edfc

Please sign in to comment.