Skip to content

Commit

Permalink
feat: adds Random Guid block, moves general purpose blocks to miscell…
Browse files Browse the repository at this point in the history
…aneous group

closes openbullet#840
  • Loading branch information
tcortega committed Jan 15, 2023
1 parent 1023c7d commit 4292e62
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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")]
Expand All @@ -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;
}
}
}

0 comments on commit 4292e62

Please sign in to comment.