Example #1
0
        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;
		}
Example #2
0
        /// <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;
        }
Example #3
0
        /// <summary> Returns all channels with the specified server and name. </summary>
        /// <remarks> Name formats supported: Name, #Name and &lt;#Id&gt;. 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);
        }