#!/usr/bin/env rakudo use v6.d; use Config::TOML; use lib $?FILE.IO.sibling('lib').Str; use lib $?FILE.IO.parent(2).child('Red/lib').Str; use Boha::TrackOps; use Boha::Karma; use IRC::Client; use Red:api<2>; my $config = from-toml( file => (%*ENV // $?FILE.IO.sibling('boha.toml').Str) ); my $*RED-DEBUG=True; red-defaults :boha['SQLite', :default]; # if-not-exists? schema(Boha::KarmaEvent).create; Boha::KarmaEvent.new-karma('dakkar',$_) for (1,-1,1,1); Boha::KarmaEvent.new-karma('boha',$_) for (-1,-1,-1,-1); say Boha::KarmaEvent.current-karma(); =finish class Boha1 does IRC::Client::Plugin { has Boha::TrackOps $.ops handles ; # irc-addressed for in-channel messages # irc-privmsg-me for direct messages method irc-addressed($e) { my @words = $e.text.split(/\s+/); if @words[0] eq 'op' { my $nick = @words[1]; if self.is-op($e.server,$e.channel,$nick) { return "$nick is op"; } else { return "$nick is a normal user"; } } else { return "I don't know understand '$e.text'"; } } } my Boha::TrackOps $ops .= new; my Boha1 $boha .= new(:$ops); .run with IRC::Client.new( |($config), channels => $config.map(*.), :debug, :plugins( $ops, $boha, ), );