Remove guild check from Message.Resolve
This commit is contained in:
@@ -14,11 +14,11 @@ namespace Discord.Commands
|
||||
private readonly Func<IMessage, IReadOnlyList<object>, Task> _action;
|
||||
|
||||
public MethodInfo Source { get; }
|
||||
public Module Module { get; }
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string Summary { get; }
|
||||
public string Text { get; }
|
||||
public Module Module { get; }
|
||||
public IReadOnlyList<CommandParameter> Parameters { get; }
|
||||
public IReadOnlyList<PreconditionAttribute> Preconditions { get; }
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace Discord.Commands
|
||||
|
||||
@@ -171,14 +171,10 @@ namespace Discord
|
||||
private string Resolve(string text, UserMentionHandling userHandling, ChannelMentionHandling channelHandling,
|
||||
RoleMentionHandling roleHandling, EveryoneMentionHandling everyoneHandling)
|
||||
{
|
||||
var guild = (Channel as IGuildChannel)?.Guild;
|
||||
text = MentionUtils.ResolveUserMentions(text, Channel, MentionedUsers, userHandling);
|
||||
if (guild != null)
|
||||
{
|
||||
text = MentionUtils.ResolveChannelMentions(text, guild, channelHandling);
|
||||
text = MentionUtils.ResolveRoleMentions(text, guild, MentionedRoles, roleHandling);
|
||||
text = MentionUtils.ResolveEveryoneMentions(text, everyoneHandling);
|
||||
}
|
||||
text = MentionUtils.ResolveChannelMentions(text, (Channel as IGuildChannel)?.Guild, channelHandling);
|
||||
text = MentionUtils.ResolveRoleMentions(text, MentionedRoles, roleHandling);
|
||||
text = MentionUtils.ResolveEveryoneMentions(text, everyoneHandling);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Discord.WebSocket;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
@@ -215,7 +216,7 @@ namespace Discord
|
||||
return "";
|
||||
case ChannelMentionHandling.Name:
|
||||
IGuildChannel channel = null;
|
||||
channel = guild.GetChannelAsync(id).GetAwaiter().GetResult();
|
||||
channel = guild?.GetChannel(id);
|
||||
if (channel != null)
|
||||
return $"#{channel.Name}";
|
||||
else
|
||||
@@ -227,7 +228,7 @@ namespace Discord
|
||||
}
|
||||
return text;
|
||||
}
|
||||
internal static string ResolveRoleMentions(string text, IGuild guild, IReadOnlyCollection<IRole> mentions, RoleMentionHandling mode)
|
||||
internal static string ResolveRoleMentions(string text, IReadOnlyCollection<IRole> mentions, RoleMentionHandling mode)
|
||||
{
|
||||
if (mode == RoleMentionHandling.Ignore) return text;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user