public override async Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services) { var guildChannels = await context.Guild.GetTextChannelsAsync(); var channels = from c in guildChannels where ChannelIDs.Contains(c.Id) || ChannelNames.Contains(c.Name) select c; return(guildChannels.Intersect(channels).Any() ? PreconditionResult.FromSuccess() : PreconditionResult.FromError($"Forbidden channel!")); }
/// <summary> /// Removes a channel from the list of channels to send the shoutout. /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeleteChannel(uint id) { return(ChannelIDs.Remove(id)); }
/// <summary> /// Adds a channel to the list of channels to send the shoutout. /// </summary> /// <param name="id"></param> public void AddChannel(ulong id) { ChannelIDs.Add(id); }