Jump to content
McKay Development

Recommended Posts

Posted (edited)

The postGroupAnnouncement doesn't trigger sessionExpired if the session is expired because the err object never displays the "Not Logged In" error.

 

Because of the this issue mentioned above you can't post announcements or log back in from the postGroupAnnoucement.

 

Is there a way around this issue?

 

 

My code.

community.postGroupAnnouncement(config.steam_group_id, title, body, function(err)
	{

		console.log(err); // Displays null if the session is expired.

		if(err != null)
		{
			if(err.toString().indexOf("Not Logged In") > -1) // Never is triggered.
			{
				console.log("Saved Announcement");
				announcements.push({title: title, body: body});
			}
			else
			{
				console.log(err);
				response.status(500).send("An error has occured, check your console.");
			}
			
		}
		else
		{
			console.log("Posted Announcement Successfully!");
			response.status(200).send("Posted Announcement Successfully!");
		}
	});
Edited by Dyceman
Posted

I created a work around until I get a reply. If anyone else is running into this issue then use the below code.

community.getNotifications(function(err, notifications) // Used to check if the user is logged in.
	{
		if(err.toString().indexOf("HTTP error 401") > -1)
		{
			console.log("Saved Announcement");
			announcements.push({title: title, body: body});
			client.webLogOn();
		}
		else
		{
			community.postGroupAnnouncement(config.steam_group_id, title, body, function(err) // Doesn't check if the user is logged in...... -.-
			{


				if(err != null)
				{
					console.log(err);
					response.status(500).send("An error has occured, check your console.");
				}
				else
				{
					console.log("Posted Announcement Successfully!");
					response.status(200).send("Posted Announcement Successfully!");
				}
			});
		}
	});

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...