refs #125 Use userSocket in misskey example

This commit is contained in:
AkiraFukushima 2020-03-12 20:48:43 +09:00
parent 6e258fdd73
commit 008ee015fc
2 changed files with 3 additions and 6 deletions

View file

@ -13,7 +13,7 @@ const access_token: string = process.env.MISSKEY_ACCESS_TOKEN
const client = generator('misskey', BASE_URL, access_token)
const stream: WebSocketInterface = client.directSocket()
const stream: WebSocketInterface = client.userSocket()
const logger = log4js.getLogger()
logger.level = 'debug'
@ -33,10 +33,6 @@ stream.on('notification', (notification: Entity.Notification) => {
logger.debug(notification)
})
stream.on('conversation', (con: Entity.Conversation) => {
logger.debug(con)
})
stream.on('error', (err: Error) => {
console.error(err)
})

View file

@ -278,12 +278,13 @@ export class Parser extends EventEmitter {
case 'notification':
this.emit('notification', body.body as MisskeyAPI.Entity.Notification)
break
case 'mention':
case 'mention': {
const note = body.body as MisskeyAPI.Entity.Note
if (note.visibility === 'specified') {
this.emit('conversation', note)
}
break
}
case 'renote':
case 'followed':
case 'receiveFollowRequest':