本文整理汇总了TypeScript中slate-irc类的典型用法代码示例。如果您正苦于以下问题:TypeScript slate-irc类的具体用法?TypeScript slate-irc怎么用?TypeScript slate-irc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了slate-irc类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: 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}).`);
});
开发者ID:0815fox,项目名称:DefinitelyTyped,代码行数:31,代码来源:slate-irc-tests.ts
示例2: 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);
}
开发者ID:AgileJoshua,项目名称:superpowers-app,代码行数:26,代码来源:index.ts
注:本文中的slate-irc类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论