AutoMod custom block message (#2613)
This commit is contained in:
@@ -2895,7 +2895,7 @@ namespace Discord.WebSocket
|
||||
|
||||
var rule = guild.AddOrUpdateAutoModRule(data);
|
||||
|
||||
await TimedInvokeAsync(_autoModRuleCreated, nameof(AutoModRuleCreated), rule);
|
||||
await TimedInvokeAsync(_autoModRuleCreated, nameof(AutoModRuleCreated), rule);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2942,8 +2942,14 @@ namespace Discord.WebSocket
|
||||
? data.Action.Metadata.Value.DurationSeconds.IsSpecified
|
||||
? data.Action.Metadata.Value.DurationSeconds.Value
|
||||
: null
|
||||
: null,
|
||||
data.Action.Metadata.IsSpecified
|
||||
? data.Action.Metadata.Value.CustomMessage.IsSpecified
|
||||
? data.Action.Metadata.Value.CustomMessage.Value
|
||||
: null
|
||||
: null);
|
||||
|
||||
|
||||
var member = guild.GetUser(data.UserId);
|
||||
|
||||
var cacheableUser = new Cacheable<SocketGuildUser, ulong>(member,
|
||||
@@ -2965,7 +2971,7 @@ namespace Discord.WebSocket
|
||||
channel != null,
|
||||
async () =>
|
||||
{
|
||||
if(data.ChannelId.IsSpecified)
|
||||
if (data.ChannelId.IsSpecified)
|
||||
return await GetChannelAsync(data.ChannelId.Value).ConfigureAwait(false) as ISocketMessageChannel;
|
||||
return null;
|
||||
});
|
||||
@@ -2980,7 +2986,7 @@ namespace Discord.WebSocket
|
||||
cachedMsg is not null,
|
||||
async () =>
|
||||
{
|
||||
if(data.MessageId.IsSpecified)
|
||||
if (data.MessageId.IsSpecified)
|
||||
return (await channel!.GetMessageAsync(data.MessageId.Value).ConfigureAwait(false)) as IUserMessage;
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -93,7 +93,16 @@ namespace Discord.WebSocket
|
||||
MentionTotalLimit = model.TriggerMetadata.MentionLimit.IsSpecified
|
||||
? model.TriggerMetadata.MentionLimit.Value
|
||||
: null;
|
||||
Actions = model.Actions.Select(x => new AutoModRuleAction(x.Type, x.Metadata.GetValueOrDefault()?.ChannelId.ToNullable(), x.Metadata.GetValueOrDefault()?.DurationSeconds.ToNullable())).ToImmutableArray();
|
||||
Actions = model.Actions.Select(x => new AutoModRuleAction(
|
||||
x.Type,
|
||||
x.Metadata.GetValueOrDefault()?.ChannelId.ToNullable(),
|
||||
x.Metadata.GetValueOrDefault()?.DurationSeconds.ToNullable(),
|
||||
x.Metadata.IsSpecified
|
||||
? x.Metadata.Value.CustomMessage.IsSpecified
|
||||
? x.Metadata.Value.CustomMessage.Value
|
||||
: null
|
||||
: null
|
||||
)).ToImmutableArray();
|
||||
Enabled = model.Enabled;
|
||||
ExemptRoles = model.ExemptRoles.Select(x => Guild.GetRole(x)).ToImmutableArray();
|
||||
ExemptChannels = model.ExemptChannels.Select(x => Guild.GetChannel(x)).ToImmutableArray();
|
||||
|
||||
Reference in New Issue
Block a user