mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 13:57:54 +00:00
feat(bot): basic webhook username templating
This commit is contained in:
parent
87196e3297
commit
4248b7bc32
16 changed files with 78 additions and 14 deletions
|
|
@ -86,4 +86,10 @@ public static class StringUtils
|
|||
|
||||
return output;
|
||||
}
|
||||
|
||||
// Lightweight formatting that intentionally is very basic to not have silly things like in-template for loops like other templating engines seem to have
|
||||
// Currently doesn't handle escapes which might cause problems
|
||||
public static string SafeFormat(string template, (string pattern, string arg)[] args) =>
|
||||
args
|
||||
.Aggregate(template, (acc, x) => acc.Replace(x.pattern, x.arg));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue