@@ -41,6 +41,7 @@ submethod BUILD (
4141 Str : $ password ,
4242 Str : D : $ host = ' localhost' ,
4343 : $ nick = [' P6Bot' ],
44+ : $ alias = [],
4445 Str : D : $ username = ' Perl6IRC' ,
4546 Str : D : $ userhost = ' localhost' ,
4647 Str : D : $ userreal = ' Perl6 IRC Client' ,
@@ -50,7 +51,7 @@ submethod BUILD (
5051 @ ! plugins = @$ plugins ;
5152 my % servers = % $ servers ;
5253
53- my % all-conf = : $ port , : $ password , : $ host , : $ nick ,
54+ my % all-conf = : $ port , : $ password , : $ host , : $ nick , : $ alias ,
5455 : $ username , : $ userhost , : $ userreal , : $ channels ;
5556
5657 % servers = ' _' => {} unless % servers ;
@@ -61,6 +62,7 @@ submethod BUILD (
6162 : $ label ,
6263 : channels( @ ($ conf <channels > // % all-conf <channels >) ),
6364 : nick[ | ($ conf <nick > // % all-conf <nick >) ],
65+ : alias[ | ($ conf <alias > // % all-conf <alias >) ],
6466 |% (
6567 <host password port username userhost userreal >
6668 . map : { $ _ => $ conf {$ _ } // % all-conf {$ _ } }
@@ -234,11 +236,16 @@ method !handle-event ($e) {
234236 my @ events = flat gather {
235237 given $ event-name {
236238 when ' irc-privmsg-channel' | ' irc-notice-channel' {
237- my $ nick = $ s . current-nick;
238- if $ e . text. subst-mutate: /^ $ nick <[,:] > \s* / , ' ' {
239+ my $ nick = $ s . current-nick;
240+ my @ aliases = $ s . alias;
241+ if $ e . text. subst-mutate:
242+ /^ [ $ nick | @ aliases ] <[ ,: ] > \s * /, ' '
243+ {
239244 take ' irc-addressed' , (' irc-to-me' if $ s . is-connected);
240245 }
241- elsif $ e . text ~~ / << $ nick >> / and $ s . is-connected {
246+ elsif $ e . text ~~ / << [ $ nick | @ aliases ] >> /
247+ and $ s . is-connected
248+ {
242249 take ' irc-mentioned' ;
243250 }
244251 take $ event-name , $ event-name eq ' irc-privmsg-channel'
0 commit comments