Last active
October 13, 2021 15:38
-
-
Save westor7/dd685acf25ed8135cd071957bb324001 to your computer and use it in GitHub Desktop.
KiwiIRC on invite alert for Stanley
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kiwi.plugin('invite_alert', function(kiwi, log) { | |
kiwi.on('irc.invite', (event, network) => { | |
if (document.visibilityState === "visible") { | |
var network = kiwi.state.getActiveNetwork(); | |
var nick = event.nick | |
var chan = event.channel | |
//var mychans = kiwi.state.getActiveNetwork().buffers.filter((b) => b.isChannel()).map((b) => b.name); | |
var ask = confirm('Hey! ' + nick + ' invites you to join on ' + chan + ' channel\n\nDo you wanna join??'); | |
if (!ask) { return; } | |
kiwi.state.getOrAddBufferByName(network.id, chan); | |
kiwi.state.setActiveBuffer(network.id, chan); | |
network.ircClient.join(chan); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment