sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
948 stars 403 forks source link

Auto OP when certain users join #1491

Closed NickBouwhuis closed 5 years ago

NickBouwhuis commented 5 years ago

Hi there!

I want to write a module that will give certain users OP rights when they rejoin our channel. How would I go about writing a module that does that?

The trigger 'JOIN' only does something when the bot itself joins a channel, but not when someone else does.

The bot just needs to do '/op [nick]' in the channel when someone joins.

dgw commented 5 years ago

The trigger 'JOIN' only does something when the bot itself joins a channel, but not when someone else does.

It most certainly does trip on any join, not just Sopel's. Otherwise Sopel's core would be broken:

https://github.com/sopel-irc/sopel/blob/af308621198f4e825063efbe472f8ec42d53e5d4/sopel/coretasks.py#L365-L389

As for actually implementing this, others have made such things in the past. One example: https://github.com/johnlage/BombBot/blob/407e7f4e0e132d75480cff59ff179607cb87b0d6/auto-op.py

It was made for Willie, but the equivalent module for Sopel would be basically identical except for a few changed imports.