2019-04-19 18:48:37 +00:00
|
|
|
using System;
|
2019-05-07 22:06:27 +00:00
|
|
|
|
2019-04-19 18:48:37 +00:00
|
|
|
|
|
|
|
namespace PluralKit
|
|
|
|
{
|
2019-04-21 13:33:22 +00:00
|
|
|
public static class Utils
|
2019-04-19 18:48:37 +00:00
|
|
|
{
|
|
|
|
public static string GenerateHid()
|
|
|
|
{
|
|
|
|
var rnd = new Random();
|
|
|
|
var charset = "abcdefghijklmnopqrstuvwxyz";
|
|
|
|
string hid = "";
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
hid += charset[rnd.Next(charset.Length)];
|
|
|
|
}
|
|
|
|
return hid;
|
|
|
|
}
|
|
|
|
|
2019-04-21 13:33:22 +00:00
|
|
|
public static string Truncate(this string str, int maxLength, string ellipsis = "...") {
|
|
|
|
if (str.Length < maxLength) return str;
|
|
|
|
return str.Substring(0, maxLength - ellipsis.Length) + ellipsis;
|
2019-04-19 18:48:37 +00:00
|
|
|
}
|
2019-04-26 15:14:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static class Emojis {
|
|
|
|
public static readonly string Warn = "\u26A0";
|
|
|
|
public static readonly string Success = "\u2705";
|
|
|
|
public static readonly string Error = "\u274C";
|
2019-04-27 14:30:34 +00:00
|
|
|
public static readonly string Note = "\u2757";
|
2019-04-19 18:48:37 +00:00
|
|
|
}
|
|
|
|
}
|