本文整理匯總了TypeScript中@slack/client.RtmClient.on方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript RtmClient.on方法的具體用法?TypeScript RtmClient.on怎麽用?TypeScript RtmClient.on使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@slack/client.RtmClient
的用法示例。
在下文中一共展示了RtmClient.on方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Date
text: message.text,
user: rtm.dataStore.getUserById(message.user),
timestamp: new Date(parseFloat(message.ts) * 1000),
mentions,
channel:
rtm.dataStore.getChannelById(message.channel) ||
rtm.dataStore.getGroupById(message.channel) ||
rtm.dataStore.getDMById(message.channel),
id: uuid.v1()
})
}
rtm.on(RTM_EVENTS.DISCONNECT, (err : any) => {
console.log('disconnected', err);
console.log('reconnecting in 3 seconds...');
setTimeout(() => {
console.log('reconnecting...');
rtm.start();
}, 3000);
})
class MyEmitter extends EventEmitter {};
const myEmitter = new MyEmitter();
rtm.on(RTM_EVENTS.MESSAGE, (message : any) => {
if(message.type != 'message' || message.subtype) {
return;
}
const cleaned = slackClean(message);
if(cleaned.channel === undefined) {
console.log('channel undefined')