Merge branch 'main' of https://github.com/PluralKit/PluralKit into upstream
This commit is contained in:
commit
13c055dc0f
21
.github/workflows/docker.yml
vendored
21
.github/workflows/docker.yml
vendored
@ -1,7 +1,6 @@
|
||||
name: Build and push Docker image
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'Myriad/**'
|
||||
- 'PluralKit.API/**'
|
||||
@ -21,15 +20,25 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
- uses: actions/checkout@v2
|
||||
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" | sed 's|/|-|g' >> $GITHUB_ENV
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=raw,value=${{ env.BRANCH_NAME }}
|
||||
type=raw,value=${{ github.sha }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
flavor: |
|
||||
latest=false
|
||||
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
# https://github.com/docker/build-push-action/issues/378
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
||||
ghcr.io/pluralkit/pluralkit:${{ github.sha }}
|
||||
ghcr.io/pluralkit/pluralkit:latest
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
||||
cache-to: type=inline
|
||||
|
@ -222,9 +222,9 @@ public partial class CommandTree
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemRename, m => m.Name(ctx, target));
|
||||
else if (ctx.Match("tag", "t"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemTag, m => m.Tag(ctx, target));
|
||||
else if (ctx.Match("servertag", "st"))
|
||||
else if (ctx.Match("servertag", "st", "stag", "deer"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemServerTag, m => m.ServerTag(ctx, target));
|
||||
else if (ctx.Match("description", "desc", "bio"))
|
||||
else if (ctx.Match("description", "desc", "bio", "info", "text"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemDesc, m => m.Description(ctx, target));
|
||||
else if (ctx.Match("pronouns", "prns"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemPronouns, m => m.Pronouns(ctx, target));
|
||||
|
@ -84,8 +84,12 @@ public class EmbedService
|
||||
var switchMembers =
|
||||
await _db.Execute(conn => _repo.GetSwitchMembers(conn, latestSwitch.Id)).ToListAsync();
|
||||
if (switchMembers.Count > 0)
|
||||
eb.Field(new Embed.Field("Fronter".ToQuantity(switchMembers.Count, ShowQuantityAs.None),
|
||||
string.Join(", ", switchMembers.Select(m => m.NameFor(ctx)))));
|
||||
{
|
||||
var memberStr = string.Join(", ", switchMembers.Select(m => m.NameFor(ctx)));
|
||||
if (memberStr.Length > 200)
|
||||
memberStr = $"[too many to show, see `pk;system {system.Hid} fronters`]";
|
||||
eb.Field(new Embed.Field("Fronter".ToQuantity(switchMembers.Count, ShowQuantityAs.None), memberStr));
|
||||
}
|
||||
}
|
||||
|
||||
if (system.Tag != null)
|
||||
@ -309,10 +313,28 @@ public class EmbedService
|
||||
{
|
||||
var members = await _db.Execute(c => _repo.GetSwitchMembers(c, sw.Id).ToListAsync().AsTask());
|
||||
var timeSinceSwitch = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp;
|
||||
var memberStr = "*(no fronter)*";
|
||||
if (members.Count > 0)
|
||||
{
|
||||
memberStr = "";
|
||||
foreach (var item in members.Select((value, i) => new { i, value }))
|
||||
{
|
||||
memberStr += item.i == 0 ? "" : ", ";
|
||||
// field limit is 1024, capping after 900 gives us plenty of room
|
||||
// for the remaining count message
|
||||
if (memberStr.Length < 900)
|
||||
memberStr += item.value.NameFor(ctx);
|
||||
else
|
||||
{
|
||||
memberStr += $"*({members.Count - item.i} not shown)*";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new EmbedBuilder()
|
||||
.Color(members.FirstOrDefault()?.Color?.ToDiscordColor() ?? DiscordUtils.Gray)
|
||||
.Field(new Embed.Field($"Current {"fronter".ToQuantity(members.Count, ShowQuantityAs.None)}",
|
||||
members.Count > 0 ? string.Join(", ", members.Select(m => m.NameFor(ctx))) : "*(no fronter)*"))
|
||||
.Field(new Embed.Field($"Current {"fronter".ToQuantity(members.Count, ShowQuantityAs.None)}", memberStr))
|
||||
.Field(new Embed.Field("Since",
|
||||
$"{sw.Timestamp.FormatZoned(zone)} ({timeSinceSwitch.FormatDuration()} ago)"))
|
||||
.Build();
|
||||
|
Loading…
Reference in New Issue
Block a user