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
|
name: Build and push Docker image
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
|
||||||
paths:
|
paths:
|
||||||
- 'Myriad/**'
|
- 'Myriad/**'
|
||||||
- 'PluralKit.API/**'
|
- 'PluralKit.API/**'
|
||||||
@ -21,15 +20,25 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.CR_PAT }}
|
password: ${{ secrets.CR_PAT }}
|
||||||
- uses: actions/checkout@v2
|
- 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
|
- uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
# https://github.com/docker/build-push-action/issues/378
|
# https://github.com/docker/build-push-action/issues/378
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
|
||||||
ghcr.io/pluralkit/pluralkit:${{ github.sha }}
|
|
||||||
ghcr.io/pluralkit/pluralkit:latest
|
|
||||||
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
||||||
cache-to: type=inline
|
cache-to: type=inline
|
||||||
|
@ -222,9 +222,9 @@ public partial class CommandTree
|
|||||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemRename, m => m.Name(ctx, target));
|
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemRename, m => m.Name(ctx, target));
|
||||||
else if (ctx.Match("tag", "t"))
|
else if (ctx.Match("tag", "t"))
|
||||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemTag, m => m.Tag(ctx, target));
|
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));
|
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));
|
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemDesc, m => m.Description(ctx, target));
|
||||||
else if (ctx.Match("pronouns", "prns"))
|
else if (ctx.Match("pronouns", "prns"))
|
||||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemPronouns, m => m.Pronouns(ctx, target));
|
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemPronouns, m => m.Pronouns(ctx, target));
|
||||||
|
@ -84,8 +84,12 @@ public class EmbedService
|
|||||||
var switchMembers =
|
var switchMembers =
|
||||||
await _db.Execute(conn => _repo.GetSwitchMembers(conn, latestSwitch.Id)).ToListAsync();
|
await _db.Execute(conn => _repo.GetSwitchMembers(conn, latestSwitch.Id)).ToListAsync();
|
||||||
if (switchMembers.Count > 0)
|
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)
|
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 members = await _db.Execute(c => _repo.GetSwitchMembers(c, sw.Id).ToListAsync().AsTask());
|
||||||
var timeSinceSwitch = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp;
|
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()
|
return new EmbedBuilder()
|
||||||
.Color(members.FirstOrDefault()?.Color?.ToDiscordColor() ?? DiscordUtils.Gray)
|
.Color(members.FirstOrDefault()?.Color?.ToDiscordColor() ?? DiscordUtils.Gray)
|
||||||
.Field(new Embed.Field($"Current {"fronter".ToQuantity(members.Count, ShowQuantityAs.None)}",
|
.Field(new Embed.Field($"Current {"fronter".ToQuantity(members.Count, ShowQuantityAs.None)}", memberStr))
|
||||||
members.Count > 0 ? string.Join(", ", members.Select(m => m.NameFor(ctx))) : "*(no fronter)*"))
|
|
||||||
.Field(new Embed.Field("Since",
|
.Field(new Embed.Field("Since",
|
||||||
$"{sw.Timestamp.FormatZoned(zone)} ({timeSinceSwitch.FormatDuration()} ago)"))
|
$"{sw.Timestamp.FormatZoned(zone)} ({timeSinceSwitch.FormatDuration()} ago)"))
|
||||||
.Build();
|
.Build();
|
||||||
|
Loading…
Reference in New Issue
Block a user