Ejemplo n.º 1
0
        public async Task RemoveBadWord(string word)
        {
            BadWordList badWordsClass = Context.Guild.LoadFromFile <BadWordList>(true);

            if (badWordsClass == null)
            {
                await ReplyAsync("Bad words is null");

                return;
            }
            BadWord badToRemove = null;

            foreach (BadWord badWord in badWordsClass.badWords)
            {
                if (badWord.word == word)
                {
                    badToRemove = badWord;
                }
            }
            if (badToRemove != null)
            {
                badWordsClass.badWords.Remove(badToRemove);
                badWordsClass.SaveToFile(Context.Guild);

                await ReplyAsync("removed " + word + " from bad word list");
            }
            else
            {
                await ReplyAsync("Bad word list doesn't contain " + word);
            }
        }
Ejemplo n.º 2
0
        public async Task ToggleContainBadWord(string word)
        {
            BadWords badWords = new BadWords(Context.Guild);

            foreach (BadWord badWord in badWords.all)
            {
                if (badWord.word.ToLower() == word.ToLower())
                {
                    if (badWord.partOfWord)
                    {
                        badWord.partOfWord = false;
                        await ReplyAsync("Set badword to not be filtered if it's inside of another word");
                    }
                    else
                    {
                        badWord.partOfWord = true;
                        await ReplyAsync("Set badword to be filtered even if it's inside of another word");
                    }
                    BadWordList badWordList = new BadWordList {
                        badWords = badWords.all
                    };
                    badWordList.SaveToFile(Context.Guild);
                    return;
                }
            }
            await ReplyAsync("Badword not found");
        }
Ejemplo n.º 3
0
        public async Task AddBadWord(string word, string euphemism = null, float size = 0.5f)
        {
            BadWord     badWord       = new BadWord(word, euphemism, size);
            BadWordList badWordsClass = Context.Guild.LoadFromFile <BadWordList>(true);

            badWordsClass.badWords.Add(badWord);
            badWordsClass.SaveToFile();

            await ReplyAsync($"Added {badWord.Word}{((badWord.Euphemism != null) ? $", also known as {badWord.Euphemism}" : "")} to bad word list");
        }
Ejemplo n.º 4
0
        public async Task AddBadWord(string word, string euphemism = null, float size = 0.5f)
        {
            BadWord badWord = new BadWord {
                word      = word,
                euphemism = euphemism,
                size      = size
            };
            //List<BadWord> badWords = Context.Guild.LoadFromFile<BadWordList>().badWords ?? new List<BadWord>();
            BadWordList badWordsClass = Context.Guild.LoadFromFile <BadWordList>(true);

            badWordsClass.badWords.Add(badWord);
            badWordsClass.SaveToFile(Context.Guild);

            if (euphemism != null)
            {
                await ReplyAsync("added " + badWord.word + " also known as " + euphemism + " to bad word list");
            }
            else
            {
                await ReplyAsync("added " + badWord.word + " to bad word list");
            }
        }
Ejemplo n.º 5
0
        public async Task RemoveBadWord(string word)
        {
            BadWordList badWordsClass = Context.Guild.LoadFromFile <BadWordList>(false);

            if (badWordsClass == null)
            {
                await ReplyAsync("No bad words are set");

                return;
            }
            BadWord badToRemove = badWordsClass.badWords.FirstOrDefault(badWord => badWord.Word == word);

            if (badToRemove != null)
            {
                badWordsClass.badWords.Remove(badToRemove);
                badWordsClass.SaveToFile();

                await ReplyAsync($"Removed {word} from bad word list");
            }
            else
            {
                await ReplyAsync("Bad word list doesn't contain " + word);
            }
        }