~tyil/raku-local-musashi

e5b6e5017d2e68beff2834d9dee908862d45b550 — Patrick Spek a month ago 2eceb29
Add small plugin to completely ignore certain users
1 files changed, 30 insertions(+), 0 deletions(-)

M lib/Local/Musashi.pm6
M lib/Local/Musashi.pm6 => lib/Local/Musashi.pm6 +30 -0
@@ 82,6 82,36 @@ unit sub MAIN (

	# Prepare plugins
	my @plugins = (
		# Ignore certain users.
		class {
			also is IRC::Client::Plugin;

			method bulli (
				Str() $usermask,
			) {
				for $*CONFIG.get('irc.ignore', []).List -> $bully {
					next unless $usermask ~~ glob($bully);

					.notice("$bully is ignored") with $*LOG;

					return Nil;
				}

				$.NEXT;
			}

			multi method irc-addressed ($event)       { self.bulli($event.usermask) }
			multi method irc-to-me ($event)           { self.bulli($event.usermask) }
			multi method irc-mentioned ($event)       { self.bulli($event.usermask) }
			multi method irc-privmsg-channel ($event) { self.bulli($event.usermask) }
			multi method irc-privmsg-me ($event)      { self.bulli($event.usermask) }
			multi method irc-privmsg ($event)         { self.bulli($event.usermask) }
			multi method irc-all ($event)             { self.bulli($event.usermask) }
			multi method irc-notice-channel ($event)  { self.bulli($event.usermask) }
			multi method irc-notice-me ($event)       { self.bulli($event.usermask) }
			multi method irc-notice ($event)          { self.bulli($event.usermask) }
		},

		IRC::Client::Plugin::NickServ.new(config => $*CONFIG),
		IRC::Client::Plugin::DiceRolls.new(config => $*CONFIG),
		IRC::Client::Plugin::Reminders.new(config => $*CONFIG),