Code Monkey home page Code Monkey logo

Comments (16)

sentanos avatar sentanos commented on July 20, 2024

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024

Alright, now the only error I am getting is;

Unhandled rejection TypeError: Cannot read property 'id' of undefined
    at /root/node_modules/roblox-js/lib/event/onMessage.js:19:33
    at tryCatcher (/root/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/root/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/root/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/root/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/root/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/root/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/root/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

Ok you are still doing a couple things wrong, read up on EventEmitters when you have a chance because you are not using them correctly. Something like this would work:

var rbx = require('roblox-js');

function handle (err) {
  console.error(err.stack);
}

rbx.login('*****','*****')
.then(function () {
  var onMessage = rbx.onMessage();
  onMessage.on('data', function (message) {
    rbx.message(message.sender.userId, 'Dear user', 'Test')
    .then(function () {
      console.log('Worked')
    }).catch(handle);
  });
  onMessage.on('error', handle);
}).catch(handle);

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024

I still get the same error...

var onMessage = rbx.onMessage();
onMessage.on('data', function (message) {
	const body = 'Thank you for your message,\nhowever this account is an automation and is not managed by a person.\n\nIf your message is important feel free to message TheeDeer.\n\nRegards,\nInfius Integration';
	rbx.message(message.sender.name,'Dear user',body)
	 .then(function () {
		console.log('Worked')
	}).catch(handle);
});
onMessage.on('error', handle);

ERROR:

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|bot      | TypeError: Cannot read property 'id' of undefined
0|bot      |     at /root/node_modules/roblox-js/lib/event/onMessage.js:19:33
0|bot      |     at tryCatcher (/root/node_modules/bluebird/js/release/util.js:16:23)
0|bot      |     at Promise._settlePromiseFromHandler (/root/node_modules/bluebird/js/release/promise.js:512:31)
0|bot      |     at Promise._settlePromise (/root/node_modules/bluebird/js/release/promise.js:569:18)
0|bot      |     at Promise._settlePromise0 (/root/node_modules/bluebird/js/release/promise.js:614:10)
0|bot      |     at Promise._settlePromises (/root/node_modules/bluebird/js/release/promise.js:693:18)
0|bot      |     at Async._drainQueue (/root/node_modules/bluebird/js/release/async.js:133:16)
0|bot      |     at Async._drainQueues (/root/node_modules/bluebird/js/release/async.js:143:10)
0|bot      |     at Immediate.Async.drainQueues (/root/node_modules/bluebird/js/release/async.js:17:14)
0|bot      |     at runCallback (timers.js:800:20)
0|bot      |     at tryOnImmediate (timers.js:762:5)
0|bot      |     at processImmediate [as _immediateCallback] (timers.js:733:5)
0|bot      | (node:28641) DeprecationWarning: TextChannel#sendMessage: use TextChannel#send instead
0|bot      | (node:28641) DeprecationWarning: EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead

Not trying to be spoonfed here but I cant find my way around this error, onShout() works perfectly fine for me...

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

First of all you are not logging in, make sure to log in and put onMessage in a .then exactly as I showed in my reply. Secondly you send messages based on ID, not name. If you actually read the reply I posted it shows that you have to use message.sender.userId to send the message.

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024

I am logging in, I just did not put it in my snippit. and the error is not coming from the message.sender.name because If I comment that part out I still get the error. It's coming from rbx.onMessage as the error states.

No need to get hostile... Just trying to get some help here.

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024
var rbx = require('roblox-js');

function handle (err) {
  console.error(err.stack);
}

rbx.login('***','***')
.then(function () {
  var onMessage = rbx.onMessage();
  onMessage.on('data', function (message) {
    console.log(message);
  });
  onMessage.on('error', handle);
}).catch(handle);

still throws the error:

Unhandled rejection TypeError: Cannot read property 'id' of undefined
    at /root/node_modules/roblox-js/lib/event/onMessage.js:19:33
    at tryCatcher (/root/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/root/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/root/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/root/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/root/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/root/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/root/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

Add these (to the login .then function) and give me the output:

rbx.getCurrentUser().then(console.log);
rbx.getMessages().then(console.log);

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024
Start: 0; End: 1
Unhandled rejection TypeError: Cannot read property 'id' of undefined
    at /root/node_modules/roblox-js/lib/event/onMessage.js:19:33
    at tryCatcher (/root/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/root/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/root/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/root/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/root/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/root/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/root/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)

{ UserID: 223426449,
  UserName: 'INF_BOT',
  RobuxBalance: 500,
  TicketsBalance: 0,
  ThumbnailUrl: 'http://t3.rbxcdn.com/ba696ca9354dc107b762e8bab75b69c7',
  IsAnyBuildersClubMember: false }
1
Start: 1; End: 1
{ messages:
   [ { sender: [Object],
       subject: 'yeet',
       body: 'sfsdf ',
       created: 2017-06-20T00:58:00.000Z,
       updated: 2017-06-20T08:33:00.000Z,
       read: true,
       parent: [Object],
       id: 1931327446 } ],
  totalPages: 1,
  total: 1 }

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024

Oh and here is the code I ran the above with;

var rbx = require('roblox-js');

function handle (err) {
  console.error(err.stack);
}

rbx.login('INF_Bot','***')
.then(function () {
rbx.getCurrentUser().then(console.log);
rbx.getMessages().then(console.log);
  var onMessage = rbx.onMessage();
  onMessage.on('data', function (message) {
    console.log(message);
  });
  onMessage.on('error', handle);
}).catch(handle);

@sentanos

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024

Added 12 messages to the bot account, still gives me the same error :/

Start: 0; End: 1
Unhandled rejection TypeError: Cannot read property 'id' of undefined
    at /root/node_modules/roblox-js/lib/event/onMessage.js:19:33
    at tryCatcher (/root/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/root/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/root/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/root/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/root/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/root/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/root/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)

{ UserID: 223426449,
  UserName: 'INF_BOT',
  RobuxBalance: 500,
  TicketsBalance: 0,
  ThumbnailUrl: 'http://t3.rbxcdn.com/ba696ca9354dc107b762e8bab75b69c7',
  IsAnyBuildersClubMember: false }
1
Start: 1; End: 1
{ messages:
   [ { sender: [Object],
       subject: 'asdsdsdsad',
       body: 'ddadsadsadsadsadsadsad',
       created: 2017-06-20T23:50:00.000Z,
       updated: 2017-06-20T23:50:00.000Z,
       read: false,
       parent: [Object],
       id: 1935834009 },
     { sender: [Object],
       subject: 'adfsdfasdf',
       body: 'asdfasdfasdfasdfsadfasdfasdf',
       created: 2017-06-20T23:49:00.000Z,
       updated: 2017-06-20T23:49:00.000Z,
       read: false,
       parent: [Object],
       id: 1935830933 },
     { sender: [Object],
       subject: 'dlfjn',
       body: 'ffaffdff',
       created: 2017-06-20T23:49:00.000Z,
       updated: 2017-06-20T23:49:00.000Z,
       read: false,
       parent: [Object],
       id: 1935829642 },
     { sender: [Object],
       subject: 'yeet',
       body: 'sfsdf ',
       created: 2017-06-20T00:58:00.000Z,
       updated: 2017-06-20T08:33:00.000Z,
       read: true,
       parent: [Object],
       id: 1931327446 },
     { sender: [Object],
       subject: 'dasd',
       body: 'adasd',
       created: 2017-06-19T23:39:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1931002542 },
     { sender: [Object],
       subject: 'af',
       body: 'afasfs xcvfds as',
       created: 2017-06-19T18:16:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1929655669 },
     { sender: [Object],
       subject: 'adas',
       body: 'asdas',
       created: 2017-06-19T18:14:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1929647437 },
     { sender: [Object],
       subject: 'Republic of Mali Invitation',
       body: 'You're being invited to join the Republic of Mali, a communist nation in Central Africa which is currently being revived. We're in need of people to join the army, police, and government and would love to have you. If you're interested here's a link: https://www.roblox.com/My/Groups.aspx?gid=2684355',
       created: 2017-03-02T05:21:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1585108118 },
     { sender: [Object],
       subject: 'Russian Federation, over 16,000 members!',
       body: 'Do you wish to join a large and active Russia with a dedicated government? Well, if so, the Russian Federation is for you! The Russian Federation has over 16,000 members! Growing fast too! We have an active capitol as well as a military base. You can become a part of the police, the army, an intelligence agency, and more! You can also run for government offices! We are currently looking for hard working, dedicated people who can be effective in the government, or even military! Just send the President a message! Why don't you come and just at least try us out? You will not regret it! Remember, you do not need to be Russian to join!',
       created: 2017-03-01T15:08:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1583649353 },
     { sender: [Object],
       subject: 'Donation',
       body: 'I need 10 robux for itaf uniform 2/11/17',
       created: 2017-02-11T19:48:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1541399321 },
     { sender: [Object],
       subject: 'RE: ITA | Immigration Notice',
       body: 'y&#39;all hold too many grudges. ya boi already quit roblox, just trynna say hi<br /><br /><br />------------------------------<br />On 1/25/2017 at 5:50 PM, INF_BOT wrote:<br />Dear BatmanNX,<br /><br />You have been ranked at the rank &quot;Federal Prison&quot; due to your stance within the blacklist. If you would like to appeal this blacklist please message me or reply back to this message and it will be automatically forwarded to an immigration developer. <br /><br />- Italian Immigration Bot<br />  -Infius Integration',
       created: 2017-01-27T21:50:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1506862477 },
     { sender: [Object],
       subject: 'RE: Welcome to Italy!',
       body: 'OH MY GOD<br /><br /><br />------------------------------<br />On 1/26/2017 at 11:46 PM, INF_BOT wrote:<br />Hello,<br />The developers of the Italian Republic would like to invite you to our new city, Rome!<br />▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬<br />This new and improved city will be released within the coming days, and when it is we would like to invite you to join us. The city includes a lot of improved things from when it was last around.<br />Such as;<br />- Improved cars,<br />- Improved Guns<br />- A new city layout<br />- New and improved UI<br />- and much more<br />▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬<br />When the city is launched you can join us here;<br />The City of Rome: https://www.roblox.com/games/580747431/City-of-Rome-Italy<br />▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬<br />Thank you,<br />  Italian Developers<br /><br /><br />- Powered by Infius Integration',
       created: 2017-01-27T05:48:00.000Z,
       updated: 2017-06-20T23:51:00.000Z,
       read: true,
       parent: [Object],
       id: 1505684675 } ],
  totalPages: 1,
  total: 12 }

from roblox-js.

ICostaEx avatar ICostaEx commented on July 20, 2024

Even tried it on my main account with a total of 608 messages still got the same error.

It's coming from /root/node_modules/roblox-js/lib/event/onMessage.js:19:33

Line 19 is latest = initial.messages[0].id; - https://github.com/sentanos/roblox-js/blob/master/lib/event/onMessage.js

It does not seem to be an account issue, it seems to be an issue coming from the Lib itself. @sentanos

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

I cannot reproduce the issue. Please contact me on discord or skype when you have the chance so I can coordinate this with you more easily.
(Discord: Froast#5132; Skype: joshua.lanese)

from roblox-js.

sentanos avatar sentanos commented on July 20, 2024

Confirmed and will be fixed in the next release. Currently the dev branch contains a working fix.

from roblox-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.