Support threads/posts in logs

Support setting the log channel to a forum post or public thread. The bot will unlock a post if it gets archived.

Co-Authored-By: spiral <spiral@spiral.sh>
This commit is contained in:
IGuessItsBray 2023-03-23 15:41:03 -04:00
parent 37025bbeb3
commit d8933a21de
3 changed files with 2 additions and 11 deletions

View file

@ -46,7 +46,7 @@ public class ServerConfig
var channelString = ctx.PeekArgument(); var channelString = ctx.PeekArgument();
channel = await ctx.MatchChannel(); channel = await ctx.MatchChannel();
if (channel == null || channel.GuildId != ctx.Guild.Id) throw Errors.ChannelNotFound(channelString); if (channel == null || channel.GuildId != ctx.Guild.Id) throw Errors.ChannelNotFound(channelString);
if (channel.Type != Channel.ChannelType.GuildText) if (channel.Type != Channel.ChannelType.GuildText && channel.Type != Channel.ChannelType.GuildPublicThread)
throw new PKError("PluralKit cannot log messages to this type of channel."); throw new PKError("PluralKit cannot log messages to this type of channel.");
var perms = await _cache.PermissionsIn(channel.Id); var perms = await _cache.PermissionsIn(channel.Id);

View file

@ -75,7 +75,7 @@ public class LogChannelService
// Find log channel and check if valid // Find log channel and check if valid
var logChannel = await FindLogChannel(guildId, logChannelId.Value); var logChannel = await FindLogChannel(guildId, logChannelId.Value);
if (logChannel == null || logChannel.Type != Channel.ChannelType.GuildText) return null; if (logChannel == null || logChannel.Type != Channel.ChannelType.GuildText && logChannel.Type != Channel.ChannelType.GuildPublicThread) return null;
// Check bot permissions // Check bot permissions
var perms = await GetPermissionsInLogChannel(logChannel); var perms = await GetPermissionsInLogChannel(logChannel);

View file

@ -1,9 +0,0 @@
{
"PluralKit": {
"Bot": {
"Token": "BOT_TOKEN_GOES_HERE",
"ClientId": 466707357099884544,
},
"Database": "Host=localhost;Port=5432;Username=myusername;Password=mypassword;Database=mydatabasename"
}
}