You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am @SevenworksGD's main account. I keep getting an error about it reading the property "id" of undefined on line 24.
Can you help me as soon as possible? Thanks.
require('isomorphic-fetch');constGD=require("gd.js")constgd=newGD();constwait=time=>newPromise(resolve=>setTimeout(resolve,time));asyncfunctionmessagesUpTo(user,messageId){if(messageId==null)returnuser.getMessages(10);for(leti=10;;i*=2){letfetchedMessages=awaituser.getMessages(i);constindex=fetchedMessages.findIndex(msg=>msg.id==messageId);if(index!=-1)returnfetchedMessages.slice(0,index);}}asyncfunctionmessageBot(){constme=awaitgd.users.login({username: "...",password: "...."});letlastMessageId=null;while(true){constmessages=awaitmessagesUpTo(me,lastMessageId);lastMessageId=messages[0].id;for(constmessageofmessages){if(message.subject=='Hello'){awaituser.sendMessage(message.from.accountID,'Hello','How are you');}}awaitwait(15*1000);}}messageBot();
The text was updated successfully, but these errors were encountered:
I get (node:1184) UnhandledPromiseRejectionWarning: ReferenceError: user is not defined when I have messages and (node:4472) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined when I have no messages.
Hello, I am @SevenworksGD's main account. I keep getting an error about it reading the property "id" of undefined on line 24.
Can you help me as soon as possible? Thanks.
The text was updated successfully, but these errors were encountered: