Escape markdown in proxy tags on member card (#118)
* Fix a typo * Escape markdown in proxy tags on member card * Whoops hhh Added API documentation for POST to member endpoint
This commit is contained in:
parent
3f6a260fac
commit
9f2faeea5a
@ -85,7 +85,7 @@ namespace PluralKit.Bot {
|
||||
if (member.Birthday != null) eb.AddField("Birthdate", member.BirthdayString, true);
|
||||
if (member.Pronouns != null) eb.AddField("Pronouns", member.Pronouns, true);
|
||||
if (messageCount > 0) eb.AddField("Message Count", messageCount, true);
|
||||
if (member.HasProxyTags) eb.AddField("Proxy Tags", $"{member.Prefix}text{member.Suffix}", true);
|
||||
if (member.HasProxyTags) eb.AddField("Proxy Tags", $"{member.Prefix.EscapeMarkdown()}text{member.Suffix.EscapeMarkdown()}", true);
|
||||
if (member.Color != null) eb.AddField("Color", $"#{member.Color}", true);
|
||||
if (member.Description != null) eb.AddField("Description", member.Description, false);
|
||||
|
||||
|
@ -86,6 +86,13 @@ namespace PluralKit.Bot
|
||||
public static string SanitizeEveryone(this string input) =>
|
||||
Regex.Replace(input, "@(everyone|here)", "@\u200B$1");
|
||||
|
||||
public static string EscapeMarkdown(this string input)
|
||||
{
|
||||
Regex pattern = new Regex(@"[*_~>`(||)\\]", RegexOptions.Multiline);
|
||||
if (input != null) return pattern.Replace(input, @"\$&");
|
||||
else return input;
|
||||
}
|
||||
|
||||
public static async Task<ChannelPermissions> PermissionsIn(this IChannel channel)
|
||||
{
|
||||
switch (channel)
|
||||
|
@ -11,7 +11,7 @@ Words in \<angle brackets> are *required parameters*. Words in [square brackets]
|
||||
## System commands
|
||||
- `pk;system [id]` - Shows information about a system.
|
||||
- `pk;system new [name]` - Creates a new system registered to your account.
|
||||
- `pk;system rename [new name]` - Changes the description of your system.
|
||||
- `pk;system rename [new name]` - Changes the name of your system.
|
||||
- `pk;system description [description]` - Changes the description of your system.
|
||||
- `pk;system avatar [avatar url]` - Changes the avatar of your system.
|
||||
- `pk;system tag [tag]` - Changes the system tag of your system.
|
||||
|
@ -252,6 +252,43 @@ Queries a member's information by its 5-character member ID. If the member does
|
||||
}
|
||||
```
|
||||
|
||||
### POST /m
|
||||
**Requires authentication.**
|
||||
|
||||
Creates a new member with the information given. Missing fields (except for name) will be set to `null`. Will return the new member object. Member must (obviously) belong to your own system.
|
||||
|
||||
#### Example request
|
||||
POST https://api.pluralkit.me/v1/m
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Craig Peterson",
|
||||
"color": null,
|
||||
"avatar_url": "https://path/to/new/image.png",
|
||||
"birthday": "1997-07-14",
|
||||
"pronouns": "they/them",
|
||||
"description": "I am Craig, cooler example user extraordinaire.",
|
||||
"prefix": "["
|
||||
}
|
||||
```
|
||||
(note the absence of a `suffix` field, which is set to null in the response)
|
||||
|
||||
#### Example response
|
||||
```json
|
||||
{
|
||||
"id": "qwert",
|
||||
"name": "Craig Peterson",
|
||||
"color": null,
|
||||
"avatar_url": "https://path/to/new/image.png",
|
||||
"birthday": "1997-07-14",
|
||||
"pronouns": "they/them",
|
||||
"description": "I am Craig, cooler example user extraordinaire.",
|
||||
"prefix": "[",
|
||||
"suffix": null,
|
||||
"created": "2019-01-01T15:00:00.654321Z"
|
||||
}
|
||||
```
|
||||
|
||||
### PATCH /m/\<id>
|
||||
**Requires authentication.**
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user