From 4292e625e9019ecb969fbf456ac79388fb3f6022 Mon Sep 17 00:00:00 2001 From: tcortega Date: Sun, 15 Jan 2023 03:11:00 -0300 Subject: [PATCH] feat: adds Random Guid block, moves general purpose blocks to miscellaneous group closes #840 --- .../Functions/{ => Miscellanous}/Methods.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) rename RuriLib/Blocks/Functions/{ => Miscellanous}/Methods.cs (51%) diff --git a/RuriLib/Blocks/Functions/Methods.cs b/RuriLib/Blocks/Functions/Miscellanous/Methods.cs similarity index 51% rename from RuriLib/Blocks/Functions/Methods.cs rename to RuriLib/Blocks/Functions/Miscellanous/Methods.cs index d36a0ccf4..ee5dc5ff6 100644 --- a/RuriLib/Blocks/Functions/Methods.cs +++ b/RuriLib/Blocks/Functions/Miscellanous/Methods.cs @@ -1,10 +1,11 @@ using RuriLib.Attributes; using RuriLib.Models.Bots; using RuriLib.Providers.UserAgents; +using System; -namespace RuriLib.Blocks.Functions +namespace RuriLib.Blocks.Functions.Miscellanous { - [BlockCategory("Functions", "General purpose functions", "#9acd32")] + [BlockCategory("Miscellanous", "General purpose functions", "#9acd32")] public static class Methods { [Block("Generates a random User Agent using the builtin provider or a custom list")] @@ -26,5 +27,18 @@ public static string RandomUserAgent(BotData data, UAPlatform platform = UAPlatf data.Logger.Log(ua); return ua; } + + [Block("Generates a random GUID using the builtin provider", + extraInfo = "Full list of formats here: https://learn.microsoft.com/en-us/dotnet/api/system.guid.tostring under the 'Remarks' section")] + public static string RandomGuid(BotData data, string format = "D") + { + data.Logger.LogHeader(); + data.Logger.Log("Getting random GUID from the builtin provider"); + + var guid = Guid.NewGuid().ToString(format); + data.Logger.Log(guid); + + return guid; + } } }