How do i need define the user? ReferenceError: user is not defined Steam user










2














when im starting my script, this error shows up:






/var/www/html/bot/driver.js:309
if(users[user.steamid])
^

ReferenceError: user is not defined
at Namespace.<anonymous> (/var/www/html/bot/driver.js:309:14)
at emitOne (events.js:116:13)
at Namespace.emit (events.js:211:7)
at Namespace.emit (/var/www/html/bot/node_modules/socket.io/lib/namespace.js:213:10)
at /var/www/html/bot/node_modules/socket.io/lib/namespace.js:181:14
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)





Can someone explain this to me? How do i need to define the steam user?
The part in the script where it crashes looks so:






io.sockets.on('connection', function(socket) 
var index = -1;
if(users[user.steamid])
index = users[user.steamid]['socket'].indexOf(socket.id);
if (index > -1)
users[user.steamid]['socket'].splice(index, 1);

if(users[user.steamid]) if(Object.keys(users[user.steamid]['socket']).length == 0) delete users[user.steamid];
);





Before in the console, it asks me for the Steam Guard Code, but then it immediately crashes to that error.










share|improve this question





















  • Is you 'user' variable defined? like var user = steamid: 'string' somewhere where this function can access this?
    – Shyam Babu
    Nov 4 at 8:44
















2














when im starting my script, this error shows up:






/var/www/html/bot/driver.js:309
if(users[user.steamid])
^

ReferenceError: user is not defined
at Namespace.<anonymous> (/var/www/html/bot/driver.js:309:14)
at emitOne (events.js:116:13)
at Namespace.emit (events.js:211:7)
at Namespace.emit (/var/www/html/bot/node_modules/socket.io/lib/namespace.js:213:10)
at /var/www/html/bot/node_modules/socket.io/lib/namespace.js:181:14
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)





Can someone explain this to me? How do i need to define the steam user?
The part in the script where it crashes looks so:






io.sockets.on('connection', function(socket) 
var index = -1;
if(users[user.steamid])
index = users[user.steamid]['socket'].indexOf(socket.id);
if (index > -1)
users[user.steamid]['socket'].splice(index, 1);

if(users[user.steamid]) if(Object.keys(users[user.steamid]['socket']).length == 0) delete users[user.steamid];
);





Before in the console, it asks me for the Steam Guard Code, but then it immediately crashes to that error.










share|improve this question





















  • Is you 'user' variable defined? like var user = steamid: 'string' somewhere where this function can access this?
    – Shyam Babu
    Nov 4 at 8:44














2












2








2


1





when im starting my script, this error shows up:






/var/www/html/bot/driver.js:309
if(users[user.steamid])
^

ReferenceError: user is not defined
at Namespace.<anonymous> (/var/www/html/bot/driver.js:309:14)
at emitOne (events.js:116:13)
at Namespace.emit (events.js:211:7)
at Namespace.emit (/var/www/html/bot/node_modules/socket.io/lib/namespace.js:213:10)
at /var/www/html/bot/node_modules/socket.io/lib/namespace.js:181:14
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)





Can someone explain this to me? How do i need to define the steam user?
The part in the script where it crashes looks so:






io.sockets.on('connection', function(socket) 
var index = -1;
if(users[user.steamid])
index = users[user.steamid]['socket'].indexOf(socket.id);
if (index > -1)
users[user.steamid]['socket'].splice(index, 1);

if(users[user.steamid]) if(Object.keys(users[user.steamid]['socket']).length == 0) delete users[user.steamid];
);





Before in the console, it asks me for the Steam Guard Code, but then it immediately crashes to that error.










share|improve this question













when im starting my script, this error shows up:






/var/www/html/bot/driver.js:309
if(users[user.steamid])
^

ReferenceError: user is not defined
at Namespace.<anonymous> (/var/www/html/bot/driver.js:309:14)
at emitOne (events.js:116:13)
at Namespace.emit (events.js:211:7)
at Namespace.emit (/var/www/html/bot/node_modules/socket.io/lib/namespace.js:213:10)
at /var/www/html/bot/node_modules/socket.io/lib/namespace.js:181:14
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)





Can someone explain this to me? How do i need to define the steam user?
The part in the script where it crashes looks so:






io.sockets.on('connection', function(socket) 
var index = -1;
if(users[user.steamid])
index = users[user.steamid]['socket'].indexOf(socket.id);
if (index > -1)
users[user.steamid]['socket'].splice(index, 1);

if(users[user.steamid]) if(Object.keys(users[user.steamid]['socket']).length == 0) delete users[user.steamid];
);





Before in the console, it asks me for the Steam Guard Code, but then it immediately crashes to that error.






/var/www/html/bot/driver.js:309
if(users[user.steamid])
^

ReferenceError: user is not defined
at Namespace.<anonymous> (/var/www/html/bot/driver.js:309:14)
at emitOne (events.js:116:13)
at Namespace.emit (events.js:211:7)
at Namespace.emit (/var/www/html/bot/node_modules/socket.io/lib/namespace.js:213:10)
at /var/www/html/bot/node_modules/socket.io/lib/namespace.js:181:14
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)





/var/www/html/bot/driver.js:309
if(users[user.steamid])
^

ReferenceError: user is not defined
at Namespace.<anonymous> (/var/www/html/bot/driver.js:309:14)
at emitOne (events.js:116:13)
at Namespace.emit (events.js:211:7)
at Namespace.emit (/var/www/html/bot/node_modules/socket.io/lib/namespace.js:213:10)
at /var/www/html/bot/node_modules/socket.io/lib/namespace.js:181:14
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)





io.sockets.on('connection', function(socket) 
var index = -1;
if(users[user.steamid])
index = users[user.steamid]['socket'].indexOf(socket.id);
if (index > -1)
users[user.steamid]['socket'].splice(index, 1);

if(users[user.steamid]) if(Object.keys(users[user.steamid]['socket']).length == 0) delete users[user.steamid];
);





io.sockets.on('connection', function(socket) 
var index = -1;
if(users[user.steamid])
index = users[user.steamid]['socket'].indexOf(socket.id);
if (index > -1)
users[user.steamid]['socket'].splice(index, 1);

if(users[user.steamid]) if(Object.keys(users[user.steamid]['socket']).length == 0) delete users[user.steamid];
);






javascript node.js nodes steam steam-web-api






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 4 at 3:42









Marc F

141




141











  • Is you 'user' variable defined? like var user = steamid: 'string' somewhere where this function can access this?
    – Shyam Babu
    Nov 4 at 8:44

















  • Is you 'user' variable defined? like var user = steamid: 'string' somewhere where this function can access this?
    – Shyam Babu
    Nov 4 at 8:44
















Is you 'user' variable defined? like var user = steamid: 'string' somewhere where this function can access this?
– Shyam Babu
Nov 4 at 8:44





Is you 'user' variable defined? like var user = steamid: 'string' somewhere where this function can access this?
– Shyam Babu
Nov 4 at 8:44













1 Answer
1






active

oldest

votes


















1














You need to actually tell the system what user is, it has no idea what it is because you haven't defined it anywhere and it doesn't have any reference or source from where it originated.



If you do something like:



const user = 'something';


It will at least be defined, but that's just about as useless as not defining it because you're obviously missing some logic from a library or something along those lines because user should be defined.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53137570%2fhow-do-i-need-define-the-user-referenceerror-user-is-not-defined-steam-user%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You need to actually tell the system what user is, it has no idea what it is because you haven't defined it anywhere and it doesn't have any reference or source from where it originated.



    If you do something like:



    const user = 'something';


    It will at least be defined, but that's just about as useless as not defining it because you're obviously missing some logic from a library or something along those lines because user should be defined.






    share|improve this answer



























      1














      You need to actually tell the system what user is, it has no idea what it is because you haven't defined it anywhere and it doesn't have any reference or source from where it originated.



      If you do something like:



      const user = 'something';


      It will at least be defined, but that's just about as useless as not defining it because you're obviously missing some logic from a library or something along those lines because user should be defined.






      share|improve this answer

























        1












        1








        1






        You need to actually tell the system what user is, it has no idea what it is because you haven't defined it anywhere and it doesn't have any reference or source from where it originated.



        If you do something like:



        const user = 'something';


        It will at least be defined, but that's just about as useless as not defining it because you're obviously missing some logic from a library or something along those lines because user should be defined.






        share|improve this answer














        You need to actually tell the system what user is, it has no idea what it is because you haven't defined it anywhere and it doesn't have any reference or source from where it originated.



        If you do something like:



        const user = 'something';


        It will at least be defined, but that's just about as useless as not defining it because you're obviously missing some logic from a library or something along those lines because user should be defined.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 16 at 19:37









        Zoe

        11k73675




        11k73675










        answered Nov 11 at 14:15









        PinkFluff

        488




        488



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53137570%2fhow-do-i-need-define-the-user-referenceerror-user-is-not-defined-steam-user%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Darth Vader #20

            How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

            Ondo