Blame
Date:
Tue Dec 21 08:11:28 2021 UTC
Message:
Added README to install dependencies
01
2021-12-17
jrmu
================================================================================
02
2021-12-17
jrmu
03
2021-12-17
jrmu
Creating a Logging Bot
04
2021-12-17
jrmu
05
2021-12-17
jrmu
In our fourth lesson, we'll create an IRC bot that logs a channel.
06
2021-12-17
jrmu
07
2021-12-17
jrmu
Copy the code for logbot.pl to your home folder:
08
2021-12-17
jrmu
09
2021-12-17
jrmu
$ cp logbot.pl ~/logbot.pl
10
2021-12-17
jrmu
11
2021-12-17
jrmu
Next, open up logbot.pl using a text editor and make a few changes.
12
2021-12-17
jrmu
13
2021-12-17
jrmu
1. Edit the server in line 32. Replace irc.example.com with the server's
14
2021-12-17
jrmu
real address. NOTE: Only IPv4 is supported.
15
2021-12-17
jrmu
2. Edit line 35 to replace nickname with the nickname you want for the bot.
16
2021-12-17
jrmu
WARNING: The nickname must not already be taken, or else the bot will
17
2021-12-17
jrmu
fail to connect.
18
2021-12-17
jrmu
3. Edit line 36 to replace username with the username you want for the bot.
19
2021-12-17
jrmu
The username is what appears in a /whois on IRC; it can be different
20
2021-12-17
jrmu
from the nickname.
21
2021-12-17
jrmu
22
2021-12-17
jrmu
Next, you'll want to make the perl script executable:
23
2021-12-17
jrmu
24
2021-12-17
jrmu
$ chmod u+x ~/logbot.pl
25
2021-12-17
jrmu
26
2021-12-17
jrmu
Then run the script:
27
2021-12-17
jrmu
28
2021-12-17
jrmu
$ perl ~/logbot.pl
29
2021-12-17
jrmu
30
2021-12-17
jrmu
On IRC, /join #perl104
31
2021-12-17
jrmu
32
2021-12-17
jrmu
Chat
33
2021-12-17
jrmu
34
2021-12-17
jrmu
================================================================================
35
2021-12-17
jrmu
36
2021-12-17
jrmu
Understanding LogBot
37
2021-12-17
jrmu
38
2021-12-17
jrmu
Next, take a look at the file called ~/comments to see an explanation of
39
2021-12-17
jrmu
key lines in the program.
40
2021-12-17
jrmu
41
2021-12-17
jrmu
================================================================================
IRCNow