public static ChannelPermissions All(ChannelType channelType, bool isPrivate) { if (isPrivate) return PrivateOnly; else if (channelType == ChannelType.Text) return TextOnly; else if (channelType == ChannelType.Voice) return VoiceOnly; else return None; }
/// <summary> Creates a new channel. </summary> public async Task<Channel> CreateChannel(string name, ChannelType type) { if (name == null) throw new ArgumentNullException(nameof(name)); if (type == null) throw new ArgumentNullException(nameof(type)); var request = new CreateChannelRequest(Id) { Name = name, Type = type.Value }; var response = await Client.ClientAPI.Send(request).ConfigureAwait(false); var channel = AddChannel(response.Id); channel.Update(response); return channel; }
/// <summary> Returns all channels with the specified server and name. </summary> /// <remarks> Name formats supported: Name, #Name and <#Id>. Search is case-insensitive if exactMatch is false.</remarks> public IEnumerable<Channel> FindChannels(string name, ChannelType type = null, bool exactMatch = false) { if (name == null) throw new ArgumentNullException(nameof(name)); return _channels.Select(x => x.Value).Find(name, type, exactMatch); }