Skip to content

Commit

Permalink
Merge pull request #1380 from dgw/title-cmd-error
Browse files Browse the repository at this point in the history
url: Say something on .title command failure
  • Loading branch information
dgw authored Dec 15, 2018
2 parents 9b43958 + 5868cc6 commit dc7fdfb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sopel/modules/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ def title_command(bot, trigger):
message += ' ( %s )' % tinyurl
bot.reply(message)

# Nice to have different failure messages for one-and-only requested URL
# failed vs. one-of-many failed.
if len(urls) == 1 and not results:
bot.reply('Sorry, fetching that title failed. Make sure the site is working.')
elif len(urls) > len(results):
bot.reply('I couldn\'t get all of the titles, but I fetched what I could!')


@rule(r'(?u).*(https?://\S+).*')
def title_auto(bot, trigger):
Expand Down

0 comments on commit dc7fdfb

Please sign in to comment.