dgw / sopel-duel

Clone of a mIRC script that lets users duel each other
1 stars 1 forks source link

Detect kicking ability more intelligently than channel access #44

Open dgw opened 7 years ago

dgw commented 7 years ago

With the ability of some networks to let channel owners grant kicking privileges without giving channel access (e.g. +r in Rizon's FLAGS access system), detecting whether the bot can kick simply by checking its channel access level is naïve and limiting.

The most likely way to make it smarter is to try kicking and then catch the 482 numeric ERR_CHANOPRIVSNEEDED if the bot is not allowed to use KICK, then optionally cache that status for that channel.

Not actually sure of the best way to do this sort of try/catch structure that depends on the response from the IRCd. Sopel isn't really designed to alter its behavior while handling one event based on an event that comes in afterward…

dgw commented 7 years ago

Note to future self: Share implementation with dgw/sopel-BombBot#34 if you can make this happen.