diff options
author | Patrick Spek <p.spek@tyil.nl> | 2019-09-24 16:27:58 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2019-09-24 16:27:58 +0200 |
commit | 6f7166deb918f2e8710158b4995045c4c7e5f663 (patch) | |
tree | c1cd0e4d69cec4c820c1f7c1069d0e9620198bb5 | |
parent | 8e0ebc0e191ba85a2b6f21d39256e51af3a9dcca (diff) | |
download | IRC::Client::Plugin::NickServ-6f7166deb918f2e8710158b4995045c4c7e5f663.tar.gz IRC::Client::Plugin::NickServ-6f7166deb918f2e8710158b4995045c4c7e5f663.tar.bz2 |
Claim preferred nick through GHOST command
-rw-r--r-- | lib/IRC/Client/Plugin/NickServ.pm6 | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/IRC/Client/Plugin/NickServ.pm6 b/lib/IRC/Client/Plugin/NickServ.pm6 index d7f2f1e..70f3875 100644 --- a/lib/IRC/Client/Plugin/NickServ.pm6 +++ b/lib/IRC/Client/Plugin/NickServ.pm6 @@ -16,12 +16,23 @@ class IRC::Client::Plugin::NickServ does IRC::Client::Plugin method irc-n376($e) { # Extract the config parameters - my Str $nick = $!config<nickserv><nickname> - // $!config<bot><nickname>; + my Str $user = $!config<nickserv><nickname> // $!config<bot><nickname>; my Str $pass = $!config<nickserv><password>; + # Nothing to do if we don't have a username and a password + return unless $user && $pass; + # Send the identify command - $e.irc.send-cmd: "NS identify $nick $pass"; + $e.irc.send-cmd: "NS identify $user $pass"; + + # If we're using our preferred nick, we're done + return unless $e.irc.current-nick eq $e.irc.nick.first; + + # Ghost our nick + $e.irc.send-cmd: "NS GHOST {$e.irc.nick.first}"; + + # Use our nick + $e.irc.send-cmd: "NICK {$e.irc.nick.first}"; } } |