Jump to content
McKay Development

Error while uploadAvatar


Recommended Posts

"use strict";

const SteamUser = require("steam-user");
const SteamTotp = require("steam-totp");
const SteamID = require('steamid')
const Steamcommunity = require("steamcommunity");

const community = new Steamcommunity();
const client = new SteamUser();

client.logOn(just say i logged);

client.on('loggedOn', ()=>{
	console.log('logged');
	client.setPersona(SteamUser.EPersonaState.Online);
  	client.gamesPlayed(440);
});

function isOwner(steamid){
 	return config.owner.includes(steamid)
};

function Command(string){
	if (string.startsWith('!')){
    	const command = string.toLowerCase().split(' ')[0].substr(1);
      	return command;
    } else {
      	return null;
    }
}

client.on('friendMessage', (steamid, message)=>{
  	message = message.trim();
  	const SteamID = steamid.getSteamID64();
	const command = Command(message);
  	if (command == 'avatar' && isOwner(SteamID)){
    	const avatarURL = message.substr(message.toLowerCase().indexOf('avatar') + 7);
      	if (avatarURL == ''){
          	client.chatMessage(SteamID, 'No URL');
        }
      	
      	community.uploadAvatar(avatarURL, function(err){
        	if (err){
            	client.chatMessage(SteamID, err);
            } else {
            	client.chatMessage(SteamID, 'Avatar Changed');
            }
        })
    }
})

why bot always saying

Error: not logged in

how can i fix it?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...