Skip to content

Commit

Permalink
Update work queues.
Browse files Browse the repository at this point in the history
Add deprecation notice for RbxDiscordUsersClient.
  • Loading branch information
nikita-petko authored and GitHub Enterprise committed Oct 27, 2022
1 parent f824e8c commit b7e0e2a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Shared/MFDLabs.GridTasks/WorkQueues/RenderingWorkQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ private static void ProcessItem(SocketTaskRequest item)

if (contentArray.Length == 0)
{
#if FEATURE_RBXDISCORDUSERS_CLIENT
isAuthorCheck = true;

var nullableUserId = message.Author.GetRobloxId();
Expand All @@ -238,6 +239,10 @@ private static void ProcessItem(SocketTaskRequest item)
}

userId = nullableUserId.Value;
#else
message.Reply("Calling the render command like this is deprecated until further notice. Please see https://github.com/mfdlabs/grid-bot-support/discussions/13.");
return;
#endif
}

string username = null;
Expand All @@ -249,6 +254,7 @@ private static void ProcessItem(SocketTaskRequest item)

if (message.MentionedUsers.Count > 0)
{
#if FEATURE_RBXDISCORDUSERS_CLIENT
var user = message.MentionedUsers.ElementAt(0);
// we have mentioned a user.
var nullableUserId = user.GetRobloxId();
Expand All @@ -265,6 +271,10 @@ private static void ProcessItem(SocketTaskRequest item)
}

userId = nullableUserId.Value;
#else
message.Reply("Calling the render command like this is deprecated until further notice. Please see https://github.com/mfdlabs/grid-bot-support/discussions/13.");
return;
#endif
}
else
{
Expand Down Expand Up @@ -346,13 +356,13 @@ private static void ProcessItem(SocketTaskRequest item)
}

Logger.Singleton.Info(
"Trying to render the character for the user '{0}' with the place '{1}', " +
"and the dimensions of {2}x{3}",
userId,
global::MFDLabs.Grid.Bot.Properties.Settings.Default.RenderPlaceID,
global::MFDLabs.Grid.Bot.Properties.Settings.Default.RenderSizeX,
global::MFDLabs.Grid.Bot.Properties.Settings.Default.RenderSizeY
);
"Trying to render the character for the user '{0}' with the place '{1}', " +
"and the dimensions of {2}x{3}",
userId,
global::MFDLabs.Grid.Bot.Properties.Settings.Default.RenderPlaceID,
global::MFDLabs.Grid.Bot.Properties.Settings.Default.RenderSizeX,
global::MFDLabs.Grid.Bot.Properties.Settings.Default.RenderSizeY
);

// get a stream and temp filename
var (stream, fileName) = GridServerCommandUtility.RenderUser(
Expand Down
15 changes: 15 additions & 0 deletions Shared/MFDLabs.GridTasks/WorkQueues/RenderingWorkQueueV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using MFDLabs.Reflection.Extensions;
using MFDLabs.ErrorHandling.Extensions;
using MFDLabs.Grid.Bot.PerformanceMonitors;
using System.ServiceModel.Channels;

namespace MFDLabs.Grid.Bot.WorkQueues
{
Expand Down Expand Up @@ -231,6 +232,8 @@ ref bool failure

case "discord_user":

#if FEATURE_RBXDISCORDUSERS_CLIENT

var userRef = (IUser)subCommand.GetOptionValue("user");
if (userRef == null)
{
Expand Down Expand Up @@ -259,8 +262,15 @@ ref bool failure

break;

#else
item.RespondEphemeralPing("Calling the render command like this is deprecated until further notice. Please see https://github.com/mfdlabs/grid-bot-support/discussions/13.");
break;
#endif

case "self":

#if FEATURE_RBXDISCORDUSERS_CLIENT

var nullableUserIdFromAuthor = item.User.GetRobloxId();

if (!nullableUserIdFromAuthor.HasValue)
Expand All @@ -277,6 +287,11 @@ ref bool failure
userId = nullableUserIdFromAuthor.Value;

break;

#else
item.RespondEphemeralPing("Calling the render command like this is deprecated until further notice. Please see https://github.com/mfdlabs/grid-bot-support/discussions/13.");
break;
#endif
}

return userId;
Expand Down

0 comments on commit b7e0e2a

Please sign in to comment.