feat: shard status update, delete old messages when they expire

This commit is contained in:
sam 2024-10-13 17:08:32 +02:00
parent 8e030acaf3
commit 32732d74d0
9 changed files with 302 additions and 17 deletions

View file

@ -6,6 +6,9 @@ using Newtonsoft.Json.Serialization;
using Prometheus;
using Remora.Commands.Extensions;
using Remora.Discord.API.Abstractions.Gateway.Commands;
using Remora.Discord.API.Abstractions.Objects;
using Remora.Discord.API.Gateway.Commands;
using Remora.Discord.API.Objects;
using Remora.Discord.Caching.Extensions;
using Remora.Discord.Commands.Extensions;
using Remora.Discord.Extensions.Extensions;
@ -33,16 +36,34 @@ builder
.ConfigureServices(s =>
s.AddRespondersFromAssembly(typeof(Program).Assembly)
.Configure<DiscordGatewayClientOptions>(g =>
{
g.Intents =
GatewayIntents.Guilds
| GatewayIntents.GuildBans // Actually GUILD_MODERATION
// Actually GUILD_MODERATION
| GatewayIntents.GuildBans
| GatewayIntents.GuildInvites
| GatewayIntents.GuildMembers
| GatewayIntents.GuildMessages
| GatewayIntents.GuildWebhooks
| GatewayIntents.MessageContents
| GatewayIntents.GuildEmojisAndStickers // Actually GUILD_EXPRESSIONS
)
// Actually GUILD_EXPRESSIONS
| GatewayIntents.GuildEmojisAndStickers;
// Set a default status for all shards. This is updated to a shard-specific one in StatusUpdateService.
g.Presence = new UpdatePresence(
Status: UserStatus.Online,
IsAFK: false,
Since: null,
Activities:
[
new Activity(
Name: "Beep",
Type: ActivityType.Custom,
State: "/catalogger help"
),
]
);
})
.AddDiscordCaching()
.AddDiscordCommands(enableSlash: true, useDefaultCommandResponder: false)
.AddCommandTree()