本文整理汇总了C#中Server.FindUsers方法的典型用法代码示例。如果您正苦于以下问题:C# Server.FindUsers方法的具体用法?C# Server.FindUsers怎么用?C# Server.FindUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server.FindUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOfficeChannels
public Dictionary<Channel, List<User>> GetOfficeChannels(Server NewServer)
{
//Console.WriteLine("Scanning for office channels");
Dictionary<Channel, List<User>> OfficeChannels = new Dictionary<Channel, List<User>>();
foreach (Channel ServerChannel in NewServer.AllChannels)
{
if (ServerChannel.Type == ChannelType.Voice)
{
if (ServerChannel.Name.Contains("Office"))
{
Match NameMatch = Regex.Match(ServerChannel.Name, "(.+?)'s Office");
if (NameMatch.Success)
{
List<User> OfficeUsers = NewServer.FindUsers(NameMatch.Groups[1].Value, exactMatch: true).Where(U => U.ServerPermissions.MoveMembers).ToList();
if (OfficeUsers.Count > 0)
{
OfficeChannels[ServerChannel] = OfficeUsers;
//await ServerChannel.Edit(maxusers: 2);
//Console.WriteLine(($"Registered Office Channel '{ServerChannel}' with users [{string.Join(", ", OfficeUsers)}]"));
}
}
}
}
}
return OfficeChannels;
}
示例2: FindUsers
public static IEnumerable<User> FindUsers(this DiscordClient client, Server server, string name, bool exactMatch = false)
{
if (server == null) throw new ArgumentNullException(nameof(server));
return server.FindUsers(name, exactMatch);
}