summaryrefslogtreecommitdiff
path: root/lib/IRC/Client/Plugin/NickServ.pm6
blob: d7f2f1eea549e0fbf4cd0a52c8aa0067ab5a57d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/env false

use v6.c;

use Config;
use IRC::Client;

#| The IRC::Client::Plugin to deal with NickServ interaction.
class IRC::Client::Plugin::NickServ does IRC::Client::Plugin
{
	has Config $.config;

	#| Identify with NickServ. This is done on IRC code 376 (end of MOTD),
	#| since this is what most servers accept as the earliest time to start
	#| interacting with the server.
	method irc-n376($e)
	{
		# Extract the config parameters
		my Str $nick = $!config<nickserv><nickname>
			// $!config<bot><nickname>;
		my Str $pass = $!config<nickserv><password>;

		# Send the identify command
		$e.irc.send-cmd: "NS identify $nick $pass";
	}
}

# vim: ft=perl6 noet