本文整理汇总了TypeScript中slate-irc.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript slate-irc.default方法的具体用法?TypeScript slate-irc.default怎么用?TypeScript slate-irc.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类slate-irc
的用法示例。
在下文中一共展示了slate-irc.default方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: connect
function connect() {
if (socket != null) return;
statusChatTab.addInfo(`Connecting to ${ircNetwork.host}:${ircNetwork.port}...`);
for (const name in channelChatTabs) channelChatTabs[name].addInfo("Connecting...");
for (const name in privateChatTabs) privateChatTabs[name].addInfo("Connecting...");
socket = tls.connect({ host: ircNetwork.host, port: ircNetwork.port, rejectUnauthorized: false }) as any as net.Socket;
socket.on("error", onSocketError);
irc = SlateIRC(socket);
irc.on("welcome", onWelcome);
irc.on("motd", onMOTD);
irc.on("join", onJoin);
irc.on("part", onPart);
irc.on("nick", onNick);
irc.on("away", onAway);
irc.on("quit", onQuit);
irc.on("data", onData);
irc.on("message", onMessage);
irc.on("notice", onNotice);
irc.on("disconnect", onDisconnect);
irc.nick(settings.nickname);
irc.user(settings.nickname, settings.nickname);
}
示例2: SlateIRC
/// <reference path="slate-irc.d.ts" />
import * as net from "net";
import * as SlateIRC from "slate-irc";
let socket: net.Socket;
const client = SlateIRC(socket);
client.on("welcome", (name) => {
console.log(client.me);
});
client.on("motd", (event) => {
console.log(event.motd);
});
client.on("join", (event) => {
console.log(`${event.nick} has joined ${event.channel}`);
});
client.on("part", (event) => {
console.log(`${event.nick} has parted ${event.channels.join(", ")}`);
});
client.on("nick", (event) => {
console.log(`${event.nick} is now known as ${event.new}`);
});
client.on("quit", (event) => {
console.log(`${event.nick} has quit (${event.message}).`);
});