refs #125 Use userSocket in misskey example
This commit is contained in:
parent
6e258fdd73
commit
008ee015fc
|
@ -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)
|
||||
})
|
||||
|
|
|
@ -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':
|
||||
|
|
Loading…
Reference in a new issue