feat: pk;config

This commit is contained in:
spiral
2021-11-29 21:35:21 -05:00
parent d195c80d92
commit 56d07e0f2d
41 changed files with 648 additions and 313 deletions

View File

@@ -126,7 +126,8 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
try
{
var system = ctx.SystemId != null ? await _repo.GetSystem(ctx.SystemId.Value) : null;
await _tree.ExecuteCommand(new Context(_services, shard, guild, channel, evt, cmdStart, system, ctx));
var config = ctx.SystemId != null ? await _repo.GetSystemConfig(ctx.SystemId.Value) : null;
await _tree.ExecuteCommand(new Context(_services, shard, guild, channel, evt, cmdStart, system, config, ctx));
}
catch (PKError)
{

View File

@@ -9,6 +9,8 @@ using Myriad.Types;
using PluralKit.Core;
using NodaTime;
using Serilog;
namespace PluralKit.Bot;
@@ -174,7 +176,8 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
msg.System,
msg.Member,
guild,
LookupContext.ByNonOwner
LookupContext.ByNonOwner,
DateTimeZone.Utc
)
});
@@ -199,7 +202,9 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
var requiredPerms = PermissionSet.ViewChannel | PermissionSet.SendMessages;
if (member == null || !(await _cache.PermissionsFor(evt.ChannelId, member)).HasFlag(requiredPerms)) return;
if (msg.System.PingsEnabled)
var config = await _repo.GetSystemConfig(msg.System.Id);
if (config.PingsEnabled)
// If the system has pings enabled, go ahead
await _rest.CreateMessage(evt.ChannelId, new MessageRequest
{