Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 934bbe2

Browse files
committed
Add irc sample
1 parent 35d8433 commit 934bbe2

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

samples/irc/extension/index.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import { NodeCG } from "nodecg/types/server";
2-
import { requireService } from "nodecg-io-core/extension/serviceClientWrapper";
3-
import { IRCServiceClient } from "nodecg-io-irc/extension";
2+
import { requireService } from "nodecg-io-core";
3+
import { IRCServiceClient } from "nodecg-io-irc";
44

55
module.exports = function (nodecg: NodeCG) {
6-
nodecg.log.info("Sample bundle for <the-service-name> started");
6+
nodecg.log.info("Sample bundle for irc started.");
77

88
const service = requireService<IRCServiceClient>(nodecg, "irc");
99
service?.onAvailable((client) => {
10-
nodecg.log.info("IRCclient has been updated.");
11-
const chat = client.getNativeClient();
12-
chat.join("#skate702"); // Change this channel, if you want to connet to a different channel.
10+
nodecg.log.info("IRC client has been updated.");
11+
client.join("#skate702"); // Change this channel, if you want to connect to a different channel.
1312

14-
chat.addListener("message", (from, to, message) => {
15-
console.log(from + " => " + to + ": " + message);
13+
client.addListener("message", (from, to, message) => {
14+
nodecg.log.info(from + " => " + to + ": " + message);
1615
});
1716

18-
chat.addListener("error", function (message) {
19-
console.log("error: ", message);
17+
client.addListener("error", function (message) {
18+
nodecg.log.info("error: ", message);
2019
});
2120
});
2221

23-
service?.onUnavailable(() => nodecg.log.info("IRCclient has been unset."));
22+
service?.onUnavailable(() => nodecg.log.info("IRC client has been unset."));
2423
};

samples/irc/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "irc",
33
"version": "0.1.0",
4+
"private": true,
45
"nodecg": {
56
"compatibleRange": "^1.1.1",
67
"bundleDependencies": {
7-
"nodecg-io-irc": "0.1.0"
8+
"nodecg-io-irc": "^0.1.0"
89
}
910
},
1011
"scripts": {
@@ -14,10 +15,10 @@
1415
},
1516
"license": "MIT",
1617
"dependencies": {
17-
"nodecg-io-irc": "0.1.0",
18-
"nodecg-io-core": "0.1.0",
19-
"@types/node": "^14.6.4",
20-
"nodecg": "^1.6.1",
21-
"typescript": "^4.0.2"
18+
"@types/node": "^14.14.13",
19+
"nodecg": "^1.7.4",
20+
"nodecg-io-core": "^0.1.0",
21+
"nodecg-io-irc": "^0.1.0",
22+
"typescript": "^4.1.3"
2223
}
2324
}

0 commit comments

Comments
 (0)