What is the feature or improvement?
Right now, the docs don't really cover channel modes well; the tests demonstrate modes but there's little documentation that directs users TO the tests, or documents what the options for the channel modes are clearly (the javadocs mention it but don't do so very clearly IMO.)
The code I use for a bot that de-ops on being opped looks like this right now - it bases the detection on nick and not hostmask, which is probably going to have to change at some point.
As a secondary point, it might be nice to have helper objects for the channel mode changes, as the tests have helper functions that instantiate local classes.
@Handler
fun onModeChange(event: ChannelModeEvent) {
class LocalChannelMode(
val c: Char,
val cl: Client,
val t: ChannelMode.Type
) : ChannelMode {
override fun getType(): ChannelMode.Type = t
override fun getChar(): Char = c
override fun getClient(): Client = cl
}
// we need to determine if this is a +o on the bot
with(event) {
val mode = event
.statusList
.getByMode('o')
.firstOrNull { status ->
status.mode.client.nick == event.client.nick
&& status.action == ModeStatus.Action.ADD
}
if (mode != null) {
val command = ChannelModeCommand(client, event.channel.name)
command.add(
ModeStatus.Action.REMOVE,
LocalChannelMode(
'o',
client,
ChannelMode.Type.B_PARAMETER_ALWAYS
),
client.nick
)
command.execute()
}
// should contain mode events applying to THIS NICK ONLY
val modeEvent = ModeEvent(
channel.name,
convertActorToBotUser(actor),
source.message
)
bot.handleModeEvent(modeEvent)
}
}
What is the feature or improvement? Right now, the docs don't really cover channel modes well; the tests demonstrate modes but there's little documentation that directs users TO the tests, or documents what the options for the channel modes are clearly (the javadocs mention it but don't do so very clearly IMO.)
The code I use for a bot that de-ops on being opped looks like this right now - it bases the detection on nick and not hostmask, which is probably going to have to change at some point.
As a secondary point, it might be nice to have helper objects for the channel mode changes, as the tests have helper functions that instantiate local classes.