mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
add user pfp small image thingy
This commit is contained in:
parent
4acab1737e
commit
62ccc1d229
@ -190,7 +190,11 @@ namespace Bloxstrap.Integrations
|
||||
}
|
||||
|
||||
string icon = "roblox";
|
||||
string smallimagetext = "Roblox";
|
||||
string smallimage = "roblox";
|
||||
|
||||
long placeId = _activityWatcher.ActivityPlaceId;
|
||||
string userId = _activityWatcher.ActivityUserId;
|
||||
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Setting presence for Place ID {placeId}");
|
||||
|
||||
@ -231,6 +235,34 @@ namespace Bloxstrap.Integrations
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Got Universe thumbnail as {icon}");
|
||||
}
|
||||
|
||||
//right now this is configured in a way so that it will only show your avatar and username if you have chosen to allow people to join you from their profile.
|
||||
if (!App.Settings.Prop.HideRPCButtons)
|
||||
{
|
||||
var userPfpResponse = await Http.GetJson<ApiArrayResponse<ThumbnailResponse>>($"https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds={userId}&size=180x180&format=Png&isCircular=false"); //we can remove '-headshot' from the url if we want a full avatar picture
|
||||
if (userPfpResponse is null || !userPfpResponse.Data.Any())
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "Could not get user thumbnail info!");
|
||||
}
|
||||
else
|
||||
{
|
||||
smallimage = userPfpResponse.Data.ToArray()[0].ImageUrl;
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Got user thumbnail as {smallimage}");
|
||||
}
|
||||
|
||||
var userInfoResponse = await Http.GetJson<ApiArrayResponse<UserInfoResponse>>($"https://users.roblox.com/v1/users/{userId}");
|
||||
if (userInfoResponse is null || !userInfoResponse.Data.Any())
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "Could not get user info!");
|
||||
}
|
||||
else
|
||||
{
|
||||
smallimagetext = userInfoResponse.Data.ToArray()[0].DisplayName + " (@{userInfoResponse.Data.ToArray()[0].Username})"; //example: john doe (@johndoe)
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Got user info as {smallimagetext}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<Button> buttons = new();
|
||||
|
||||
if (!App.Settings.Prop.HideRPCButtons && _activityWatcher.ActivityServerType == ServerType.Public)
|
||||
@ -274,8 +306,8 @@ namespace Bloxstrap.Integrations
|
||||
{
|
||||
LargeImageKey = icon,
|
||||
LargeImageText = universeDetails.Name,
|
||||
SmallImageKey = "roblox",
|
||||
SmallImageText = "Roblox"
|
||||
SmallImageKey = smallimage,
|
||||
SmallImageText = smallimagetext
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user