Mercurial > irccd
comparison examples/sample-plugin.js @ 1009:637a98de3910
misc: add more examples
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 17 Feb 2021 19:45:00 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1008:201ddc487807 | 1009:637a98de3910 |
---|---|
1 /* | |
2 * This is a sample plugin in Javascript API. | |
3 */ | |
4 | |
5 /* | |
6 * This is the plugin identifier, every variable are optional. | |
7 */ | |
8 info = { | |
9 author: "David Demelier <markand@malikania.fr>", | |
10 license: "ISC", | |
11 summary: "Crazy module for asking a medium", | |
12 version: "@IRCCD_VERSION@" | |
13 }; | |
14 | |
15 /* | |
16 * Called when the user invoke the plugin using its identifier and the server | |
17 * prefix. | |
18 * | |
19 * Example: !example foo bar baz | |
20 */ | |
21 function onCommand(server, origin, channel, message) | |
22 { | |
23 } | |
24 | |
25 /* | |
26 * Called when a server successfully connect and identifies to a IRC server. | |
27 */ | |
28 function onConnect(server) | |
29 { | |
30 } | |
31 | |
32 /* | |
33 * Called when a server disconnection is detected. | |
34 */ | |
35 function onDisconnect(server) | |
36 { | |
37 } | |
38 | |
39 /* | |
40 * Called when someone invites the bot on a channel. | |
41 */ | |
42 function onInvite(server, origin, channel) | |
43 { | |
44 } | |
45 | |
46 /* | |
47 * Called when someones join a channel (the bot included). | |
48 */ | |
49 function onJoin(server, origin, channel) | |
50 { | |
51 } | |
52 | |
53 /* | |
54 * Called when a someone was kicked from a channel. | |
55 */ | |
56 function onKick(server, origin, channel, reason) | |
57 { | |
58 } | |
59 | |
60 /* | |
61 * Called when a plugin is being loaded. Never happens from IRC. | |
62 */ | |
63 function onLoad() | |
64 { | |
65 } | |
66 | |
67 /* | |
68 * Called when a special CTCP ACTION (/me) is received. | |
69 */ | |
70 function onMe(server, origin, channel, message) | |
71 { | |
72 } | |
73 | |
74 /* | |
75 * Called when a message has been received. | |
76 */ | |
77 function onMessage(server, origin, channel, message) | |
78 { | |
79 } | |
80 | |
81 /* | |
82 * Called when a user/channel mode change. The channel can be the bot nickname. | |
83 * The args is a list of string containing mode arguments. | |
84 */ | |
85 function onMode(server, origin, channel, args) | |
86 { | |
87 } | |
88 | |
89 /* | |
90 * Called when a list of names have been received. | |
91 * | |
92 * Note: in contrast to the IRC names listing, the names are not prefixed with | |
93 * their optional channel mode (e.g. @+ etc). | |
94 * | |
95 * Tip: using this event is no longer necessary starting from irccd 4, the bot | |
96 * keeps track of users of every channel it is present and can be accessed | |
97 * through the method Irccd.Server.prototype.info. | |
98 */ | |
99 function onNames(server, channel, names) | |
100 { | |
101 } | |
102 | |
103 /* | |
104 * Called when a nickname change. | |
105 */ | |
106 function onNick(server, origin, nickname) | |
107 { | |
108 } | |
109 | |
110 /* | |
111 * Called when a notice is received. The channel can be the bot nickname as | |
112 * well. | |
113 */ | |
114 function onNotice(server, origin, channel, notice) | |
115 { | |
116 } | |
117 | |
118 /* | |
119 * Called when someone leaves a channel. | |
120 */ | |
121 function onPart(server, origin, channel, reason) | |
122 { | |
123 } | |
124 | |
125 /* | |
126 * Called when the user request a plugin reload. Never happens from IRC. | |
127 */ | |
128 function onReload() | |
129 { | |
130 } | |
131 | |
132 /* | |
133 * Called when a topic change. | |
134 */ | |
135 function onTopic(server, origin, channel, topic) | |
136 { | |
137 } | |
138 | |
139 /* | |
140 * Called when the plugin is about to be removed. Never happens from IRC. | |
141 */ | |
142 function onUnload() | |
143 { | |
144 } | |
145 | |
146 /* | |
147 * Called when a whois information has been received. This function is usually | |
148 * never called unless the plugin explicitly calls Irccd.Server.prototype.whois | |
149 * beforehand. | |
150 */ | |
151 function onWhois(server, info) | |
152 { | |
153 } |