Browse Source

Added exactMatch option to FindChannels

tags/docs-0.9
RogueException 9 years ago
parent
commit
78c097fa42
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/Discord.Net/DiscordClient.Channels.cs

+ 3
- 2
src/Discord.Net/DiscordClient.Channels.cs View File

@@ -56,12 +56,13 @@ namespace Discord
/// <summary> Returns all channels with the specified server and name. </summary> /// <summary> Returns all channels with the specified server and name. </summary>
/// <remarks> Name formats supported: Name and #Name. Search is case-insensitive. </remarks> /// <remarks> Name formats supported: Name and #Name. Search is case-insensitive. </remarks>
public IEnumerable<Channel> FindChannels(Server server, string name, ChannelType type = null)
public IEnumerable<Channel> FindChannels(Server server, string name, ChannelType type = null, bool exactMatch = false)
{ {
if (server == null) throw new ArgumentNullException(nameof(server)); if (server == null) throw new ArgumentNullException(nameof(server));
CheckReady();


IEnumerable<Channel> result; IEnumerable<Channel> result;
if (name.StartsWith("#"))
if (!exactMatch && name.StartsWith("#"))
{ {
string name2 = name.Substring(1); string name2 = name.Substring(1);
result = _channels.Where(x => x.Server == server && result = _channels.Where(x => x.Server == server &&


Loading…
Cancel
Save