Skip to content

Commit

Permalink
Merge PR #2143 from sopel-irc/wikipedia-warn-old-lang [skip ci]
Browse files Browse the repository at this point in the history
wikipedia: log a warning if `lang_per_channel` is used for a channel
  • Loading branch information
dgw authored Jul 5, 2021
2 parents f232c38 + 246b731 commit 1c544f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sopel/modules/wikipedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
import re

from requests import get
Expand All @@ -21,6 +22,7 @@
except ImportError:
from HTMLParser import HTMLParser

LOGGER = logging.getLogger(__name__)
REDIRECT = re.compile(r'^REDIRECT (.*)')
PLUGIN_OUTPUT_PREFIX = '[wikipedia] '

Expand Down Expand Up @@ -127,6 +129,11 @@ def choose_lang(bot, trigger):
customlang = re.search('(' + trigger.sender + r'):(\w+)',
bot.config.wikipedia.lang_per_channel)
if customlang is not None:
LOGGER.warning(
'Language for %s loaded from the deprecated config setting, '
'wikipedia.lang_per_channel',
trigger.sender,
)
return customlang.group(2)

return bot.config.wikipedia.default_lang
Expand Down

0 comments on commit 1c544f5

Please sign in to comment.