Skip to content

Instantly share code, notes, and snippets.

@ItsOnlyBinary
Created September 3, 2018 13:14
Show Gist options
  • Save ItsOnlyBinary/6bfb47f5506eade49cf270eced7a46c2 to your computer and use it in GitHub Desktop.
Save ItsOnlyBinary/6bfb47f5506eade49cf270eced7a46c2 to your computer and use it in GitHub Desktop.
kiwi.plugin('relay_tidy', function(kiwi, log) {
// Add the bot nicks here in lowercase
var relayNicks = ['relaybot'];
var relayedRegex = /^(\S+\/<(\S+)>)/;
kiwi.on('message.new', function(event) {
if (relayNicks.indexOf(event.nick.toLowerCase()) === -1) {
return;
}
var matches = relayedRegex.exec(event.message);
if (matches.length === 3) {
event.message = event.message.replace(relayedRegex, '');
event.nick = matches[2];
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment