Skip to content

Instantly share code, notes, and snippets.

@westor7
Last active October 13, 2021 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westor7/dd685acf25ed8135cd071957bb324001 to your computer and use it in GitHub Desktop.
Save westor7/dd685acf25ed8135cd071957bb324001 to your computer and use it in GitHub Desktop.
KiwiIRC on invite alert for Stanley
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