broidHQ / integrations

Connect your App to Multiple Messaging Channels with the W3C Open standard.
https://www.broid.ai
GNU Affero General Public License v3.0
745 stars 83 forks source link

telegram integration fileinfo bug #140

Open jwickens opened 7 years ago

jwickens commented 7 years ago

When trying out the telegram integration with the following code

const { telegramOpts } = require('./config')
const BroidTelegram = require('@broid/telegram')

const telegram = new BroidTelegram(telegramOpts)

telegram.connect()
  .subscribe({
    next: data => console.log(`connected: ${JSON.stringify(data)}`),
    error: err => console.error(`Something went wrong: ${err.message}`),
    complete: () => console.log('complete connected')
  })

telegram.listen()
  .subscribe({
    next: data => console.log(`Received message: ${JSON.stringify(data)}`),
    error: err => console.error(`Something went wrong: ${err.message}`),
    complete: () => console.log('message stream complete')
  })

( Note it took me a while to get here -- some better getting started docs mentioning the listen would be greatly helpful for beginners)

Then on sending a message with telegram i immediately get an error

{
    "pid": 20568,
    "hostname": "Jonathans-MacBook-Pro.local",
    "name": "fileInfo",
    "level": 50,
    "time": 1494410031413,
    "msg": "ENOENT: no such file or directory, open 'boo'",
    "type": "Error",
    "stack": "Error: ENOENT: no such file or directory, open 'boo'
      at Object.fs.openSync (fs.js:584:18)
      at Function.module.exports.sync (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/read-chunk/index.js:32:16)
      at Promise.resolve.then (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/@broid/utils/lib/index.js:34:35)
      at tryCatcher (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/promise.js:512:31)
      at Promise._settlePromise (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/promise.js:569:18)
      at Promise._settlePromiseCtx (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/promise.js:606:10)
      at Async._drainQueue (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/async.js:138:12)
      at Async._drainQueues (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/async.js:143:10)
      at Immediate.Async.drainQueues (/Users/jonathanwickens/dev/h-broid-conversation/node_modules/bluebird/js/release/async.js:17:14)
      at runCallback (timers.js:672:20)
      at tryOnImmediate (timers.js:645:5)
      at processImmediate [as _immediateCallback] (timers.js:617:5)",
    "errno": -2,
    "code": "ENOENT",
    "syscall": "open",
    "path": "boo",
    "v": 1
}
Received message: {
    "@context": "https://www.w3.org/ns/activitystreams",
    "generator": {
        "id": "593b3328-38c0-4816-b162-6faf0e9c42c1",
        "name": "telegram",
        "type": "Service"
    },
    "published": 1494410031,
    "type": "Create",
    "actor": {
        "id": "282883177",
        "name": "Jonathan Wickens",
        "type": "Person"
    },
    "target": {
        "id": "282883177",
        "name": "Jonathan Wickens",
        "type": "Person"
    },
    "object": {
        "content": "boo",
        "id": "50",
        "type": "Note"
    }
}
killix commented 7 years ago

"msg": "ENOENT: no such file or directory, open ', this message look it's something on you code side and not in the integration. Can you give me your complete gist to look?

m90 commented 7 years ago

I'm 99% sure this is the same as: https://github.com/broidHQ/integrations/pull/131

jwickens commented 7 years ago

Hi @killix here's the gist https://gist.github.com/jwickens/f7d91a4160c43d5115a0bff73fb220b2