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

Commit 35d8433

Browse files
committed
Merge remote-tracking branch 'StefanSchmelz/sample/irc-connect-to-channel' into sample/irc
2 parents 70314dd + 7a6a2a8 commit 35d8433

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

samples/irc/extension/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { NodeCG } from "nodecg/types/server";
2+
import { requireService } from "nodecg-io-core/extension/serviceClientWrapper";
3+
import { IRCServiceClient } from "nodecg-io-irc/extension";
4+
5+
module.exports = function (nodecg: NodeCG) {
6+
nodecg.log.info("Sample bundle for <the-service-name> started");
7+
8+
const service = requireService<IRCServiceClient>(nodecg, "irc");
9+
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.
13+
14+
chat.addListener("message", (from, to, message) => {
15+
console.log(from + " => " + to + ": " + message);
16+
});
17+
18+
chat.addListener("error", function (message) {
19+
console.log("error: ", message);
20+
});
21+
});
22+
23+
service?.onUnavailable(() => nodecg.log.info("IRCclient has been unset."));
24+
};

samples/irc/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "irc",
3+
"version": "0.1.0",
4+
"nodecg": {
5+
"compatibleRange": "^1.1.1",
6+
"bundleDependencies": {
7+
"nodecg-io-irc": "0.1.0"
8+
}
9+
},
10+
"scripts": {
11+
"build": "tsc -b",
12+
"watch": "tsc -b -w",
13+
"clean": "tsc -b --clean"
14+
},
15+
"license": "MIT",
16+
"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"
22+
}
23+
}

samples/irc/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../tsconfig.common.json"
3+
}

0 commit comments

Comments
 (0)