Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
c574956d94 | |||
2bf2d4465d | |||
2a3fe1f45c | |||
6841c3969a |
3 changed files with 17 additions and 5 deletions
|
@ -17,6 +17,9 @@ public static class MigrationQueries
|
||||||
|
|
||||||
public static void MigrateSar(MigrationBuilder migrationBuilder)
|
public static void MigrateSar(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
if (migrationBuilder.IsNpgsql())
|
||||||
|
return;
|
||||||
|
|
||||||
migrationBuilder.Sql("""
|
migrationBuilder.Sql("""
|
||||||
INSERT INTO GroupName (Number, GuildConfigId)
|
INSERT INTO GroupName (Number, GuildConfigId)
|
||||||
SELECT DISTINCT "Group", GC.Id
|
SELECT DISTINCT "Group", GC.Id
|
||||||
|
|
|
@ -19,7 +19,7 @@ public sealed class CheckForUpdatesService : IEService, IReadyExecutor
|
||||||
private readonly IMessageSenderService _sender;
|
private readonly IMessageSenderService _sender;
|
||||||
|
|
||||||
|
|
||||||
private const string RELEASES_URL = "https://toastielab.dev/api/v1/repos/Emotions-stuff/elliebot/releases";
|
private const string RELEASES_URL = "https://toastielab.dev/api/v1/repos/EllieBotDevs/elliebot/releases";
|
||||||
|
|
||||||
public CheckForUpdatesService(
|
public CheckForUpdatesService(
|
||||||
BotConfigService bcs,
|
BotConfigService bcs,
|
||||||
|
@ -72,7 +72,7 @@ public sealed class CheckForUpdatesService : IEService, IReadyExecutor
|
||||||
UpdateLastKnownVersion(latestVersion);
|
UpdateLastKnownVersion(latestVersion);
|
||||||
|
|
||||||
// pull changelog
|
// pull changelog
|
||||||
var changelog = await http.GetStringAsync("https://toastielab.dev/Emotions-stuff/elliebot/raw/branch/v5/CHANGELOG.md");
|
var changelog = await http.GetStringAsync("https://toastielab.dev/EllieBotDevs/elliebot/raw/branch/v5/CHANGELOG.md");
|
||||||
|
|
||||||
var thisVersionChangelog = GetVersionChangelog(latestVersion, changelog);
|
var thisVersionChangelog = GetVersionChangelog(latestVersion, changelog);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public sealed class CheckForUpdatesService : IEService, IReadyExecutor
|
||||||
.WithOkColor()
|
.WithOkColor()
|
||||||
.WithAuthor($"EllieBot v{latest} Released!")
|
.WithAuthor($"EllieBot v{latest} Released!")
|
||||||
.WithTitle("Changelog")
|
.WithTitle("Changelog")
|
||||||
.WithUrl("https://toastielab.dev/Emotions-stuff/elliebot/src/branch/v5/CHANGELOG.md")
|
.WithUrl("https://toastielab.dev/EllieBotDevs/elliebot/src/branch/v5/CHANGELOG.md")
|
||||||
.WithDescription(thisVersionChangelog.TrimTo(4096))
|
.WithDescription(thisVersionChangelog.TrimTo(4096))
|
||||||
.WithFooter(
|
.WithFooter(
|
||||||
"You may disable these messages by typing '.conf bot checkforupdates false'");
|
"You may disable these messages by typing '.conf bot checkforupdates false'");
|
||||||
|
|
|
@ -59,10 +59,15 @@ public class SelfAssignedRolesService : IEService, IReadyExecutor
|
||||||
},
|
},
|
||||||
_ => new()
|
_ => new()
|
||||||
{
|
{
|
||||||
|
SarGroupId = ctx.GetTable<SarGroup>()
|
||||||
|
.Where(x => x.GuildId == guildId && x.GroupNumber == groupNumber)
|
||||||
|
.Select(x => x.Id)
|
||||||
|
.First()
|
||||||
},
|
},
|
||||||
() => new()
|
() => new()
|
||||||
{
|
{
|
||||||
RoleId = roleId,
|
RoleId = roleId,
|
||||||
|
GuildId = guildId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,8 +285,12 @@ public sealed class SarAssignerService : IEService, IReadyExecutor
|
||||||
|
|
||||||
if (item.Group.IsExclusive)
|
if (item.Group.IsExclusive)
|
||||||
{
|
{
|
||||||
var rolesToRemove = item.Group.Roles.Select(x => x.RoleId);
|
var rolesToRemove = item.Group.Roles
|
||||||
await item.User.RemoveRolesAsync(rolesToRemove);
|
.Where(x => item.User.RoleIds.Contains(x.RoleId))
|
||||||
|
.Select(x => x.RoleId)
|
||||||
|
.ToArray();
|
||||||
|
if (rolesToRemove.Length > 0)
|
||||||
|
await item.User.RemoveRolesAsync(rolesToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
await item.User.AddRoleAsync(item.RoleId);
|
await item.User.AddRoleAsync(item.RoleId);
|
||||||
|
|
Loading…
Reference in a new issue