Added new functions into Functions.cs and added help command for slash Commands.

This commit is contained in:
2023-06-26 14:51:15 +03:00
parent 3ab96e2d0d
commit f1dda5da3c
7 changed files with 102 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Discord;
namespace PluginManager.Others;
@@ -100,4 +101,26 @@ public static class Functions
text.Close();
return (obj ?? default)!;
}
public static T SelectRandomValueOf<T> ()
{
var enums = Enum.GetValues(typeof(T));
var random = new Random();
return (T)enums.GetValue(random.Next(enums.Length));
}
public static T RandomValue<T>(this T[] values)
{
Random random = new();
return values[random.Next(values.Length)];
}
public static Discord.Color RandomColor
{
get
{
Random random = new Random();
return new Discord.Color(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
}
}
}