diff --git a/sopel/modules/wikipedia.py b/sopel/modules/wikipedia.py index ff16a36ea7..213ab225d3 100644 --- a/sopel/modules/wikipedia.py +++ b/sopel/modules/wikipedia.py @@ -108,11 +108,6 @@ def get_result(self): class WikipediaSection(types.StaticSection): default_lang = types.ValidatedAttribute('default_lang', default='en') """The default language to find articles from (same as Wikipedia language subdomain).""" - lang_per_channel = types.ValidatedAttribute('lang_per_channel') - """List of ``#channel:langcode`` pairs to define Wikipedia language per channel. - - Deprecated: Will be removed in Sopel 8. Use ``.wpclang`` to manage per-channel language settings. - """ def setup(bot): @@ -143,12 +138,6 @@ def choose_lang(bot, trigger): if channel_lang: return channel_lang - if bot.config.wikipedia.lang_per_channel: - customlang = re.search('(' + trigger.sender + r'):(\w+)', - bot.config.wikipedia.lang_per_channel) - if customlang is not None: - return customlang.group(2) - return bot.config.wikipedia.default_lang @@ -317,12 +306,13 @@ def wplang(bot, trigger): bot.config.wikipedia.default_lang) ) ) - else: - bot.db.set_nick_value(trigger.nick, 'wikipedia_lang', trigger.group(3)) - bot.reply( - "Set your Wikipedia language to: {}" - .format(trigger.group(3)) - ) + return + + bot.db.set_nick_value(trigger.nick, 'wikipedia_lang', trigger.group(3)) + bot.reply( + "Set your Wikipedia language to: {}" + .format(trigger.group(3)) + ) @plugin.command('wpclang') @@ -333,6 +323,7 @@ def wpclang(bot, trigger): if not (trigger.admin or bot.channels[trigger.sender.lower()].privileges[trigger.nick.lower()] >= plugin.OP): bot.reply("You don't have permission to change this channel's Wikipedia language setting.") return plugin.NOLIMIT + if not trigger.group(3): bot.say( "{}'s current Wikipedia language is: {}" @@ -343,9 +334,10 @@ def wpclang(bot, trigger): bot.config.wikipedia.default_lang) ) ) - else: - bot.db.set_channel_value(trigger.sender, 'wikipedia_lang', trigger.group(3)) - bot.say( - "Set {}'s Wikipedia language to: {}" - .format(trigger.sender, trigger.group(3)) - ) + return + + bot.db.set_channel_value(trigger.sender, 'wikipedia_lang', trigger.group(3)) + bot.say( + "Set {}'s Wikipedia language to: {}" + .format(trigger.sender, trigger.group(3)) + )