Example #1
0
        private async Task <bool> RemoveGuildBinding(IGuild guild)
        {
            using (var db = new BadWordContext(dbOptions))
            {
                var bindings = await db.BadWordServerBindings.Where(b => b.ServerId == guild.Id).ToListAsync();

                if (!bindings.Any())
                {
                    return(false);
                }
                foreach (var guildBinding in bindings)
                {
                    db.Remove(guildBinding);
                }
                await db.SaveChangesAsync();

                return(true);
            }
        }
Example #2
0
        private async Task <bool> RemoveChannelBinding(ITextChannel channel)
        {
            using (var db = new BadWordContext(dbOptions))
            {
                var bindings = await db.BadWordChannelBindings.Where(b => b.ChannelId == channel.Id).ToListAsync();

                if (!bindings.Any())
                {
                    return(false);
                }
                foreach (var channelBinding in bindings)
                {
                    db.Remove(channelBinding);
                }
                await db.SaveChangesAsync();

                return(true);
            }
        }