Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Random GUID function block and move General Purpose functions to Miscelaneous group #847

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}