FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-irc/example/bot.js at master · martynsmith/node-irc · GitHub
martynsmith
/
node-irc
Public
Notifications
You must be signed in to change notification settings
Fork
416
Star
1.3k
Code
Issues
78
Pull requests
47
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node-irc
/
example
/
bot.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
49 lines (43 loc) · 1.64 KB
Breadcrumbs
node-irc
/
example
/
bot.js
Copy path
File metadata and controls
executable file
·
49 lines (43 loc) · 1.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
var
irc
=
require
(
'../'
)
;
var
bot
=
new
irc
.
Client
(
'irc.dollyfish.net.nz'
,
'nodebot'
,
{
debug
:
true
,
channels
:
[
'#test'
,
'#othertest'
]
}
)
;
bot
.
addListener
(
'error'
,
function
(
message
)
{
console
.
error
(
'ERROR: %s: %s'
,
message
.
command
,
message
.
args
.
join
(
' '
)
)
;
}
)
;
bot
.
addListener
(
'message#blah'
,
function
(
from
,
message
)
{
console
.
log
(
'<%s> %s'
,
from
,
message
)
;
}
)
;
bot
.
addListener
(
'message'
,
function
(
from
,
to
,
message
)
{
console
.
log
(
'%s => %s: %s'
,
from
,
to
,
message
)
;
if
(
to
.
match
(
/
^
[
#
&
]
/
)
)
{
// channel message
if
(
message
.
match
(
/
h
e
l
l
o
/
i
)
)
{
bot
.
say
(
to
,
'Hello there '
+
from
)
;
}
if
(
message
.
match
(
/
d
a
n
c
e
/
)
)
{
setTimeout
(
function
(
)
{
bot
.
say
(
to
,
'\u0001ACTION dances: :D\\-<\u0001'
)
;
}
,
1000
)
;
setTimeout
(
function
(
)
{
bot
.
say
(
to
,
'\u0001ACTION dances: :D|-<\u0001'
)
;
}
,
2000
)
;
setTimeout
(
function
(
)
{
bot
.
say
(
to
,
'\u0001ACTION dances: :D/-<\u0001'
)
;
}
,
3000
)
;
setTimeout
(
function
(
)
{
bot
.
say
(
to
,
'\u0001ACTION dances: :D|-<\u0001'
)
;
}
,
4000
)
;
}
}
else
{
// private message
console
.
log
(
'private message'
)
;
}
}
)
;
bot
.
addListener
(
'pm'
,
function
(
nick
,
message
)
{
console
.
log
(
'Got private message from %s: %s'
,
nick
,
message
)
;
}
)
;
bot
.
addListener
(
'join'
,
function
(
channel
,
who
)
{
console
.
log
(
'%s has joined %s'
,
who
,
channel
)
;
}
)
;
bot
.
addListener
(
'part'
,
function
(
channel
,
who
,
reason
)
{
console
.
log
(
'%s has left %s: %s'
,
who
,
channel
,
reason
)
;
}
)
;
bot
.
addListener
(
'kick'
,
function
(
channel
,
who
,
by
,
reason
)
{
console
.
log
(
'%s was kicked from %s by %s: %s'
,
who
,
channel
,
by
,
reason
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL