Esempio n. 1
0
        public async Task ToggleDmReactions()
        {
            var config = TranslateService.GetTranslateGuild(Context.Guild.Id);

            config.DirectMessageTranslations = !config.DirectMessageTranslations;
            TranslateService.SaveTranslateGuild(config);
            await ReplyAsync($"DM Users Translations: {config.DirectMessageTranslations}");
        }
Esempio n. 2
0
        public async Task ToggleReactions()
        {
            var config = TranslateService.GetTranslateGuild(Context.Guild.Id);

            config.ReactionTranslations = !config.ReactionTranslations;
            TranslateService.SaveTranslateGuild(config);
            await ReplyAsync($"Translation Reactions Enabled: {config.ReactionTranslations}");
        }
Esempio n. 3
0
        public async Task RemoveWhitelistRole(ulong roleId)
        {
            var config = TranslateService.GetTranslateGuild(Context.Guild.Id);

            config.WhitelistRoles.Remove(roleId);
            TranslateService.SaveTranslateGuild(config);
            await ReplyAsync("Role removed.");
        }
Esempio n. 4
0
        public async Task AddWhitelistedRole(IRole role)
        {
            var config = TranslateService.GetTranslateGuild(Context.Guild.Id);

            config.WhitelistRoles = config.WhitelistRoles.Where(x => x != role.Id).ToList();
            config.WhitelistRoles.Add(role.Id);
            TranslateService.SaveTranslateGuild(config);
            await ReplyAsync("Role has been whitelisted.");
        }
Esempio n. 5
0
        public async Task RemovePair(Emoji emote)
        {
            var config = TranslateService.GetTranslateGuild(Context.Guild.Id);

            foreach (var pair in config.CustomPairs)
            {
                pair.EmoteMatches.Remove(emote.Name);
            }

            await ReplyAsync("Reaction removed.");

            TranslateService.SaveTranslateGuild(config);
        }
Esempio n. 6
0
        public async Task AddPair(Emoji emote, string code)
        {
            if (!TranslateService.Translator.IsValidLanguageCode(code))
            {
                await ReplyAsync("Language code is not valid.");

                return;
            }

            var config = TranslateService.GetTranslateGuild(Context.Guild.Id);
            var match  = config.CustomPairs.FirstOrDefault(x => x.LanguageString.Equals(code, StringComparison.InvariantCultureIgnoreCase));

            if (match != null)
            {
                if (match.EmoteMatches.Any(x => x == emote.Name))
                {
                    await ReplyAsync("This emote is already configured to work with this language.");

                    return;
                }

                match.EmoteMatches.Add(emote.Name);
            }
            else
            {
                config.CustomPairs.Add(new LanguageMap.TranslationSet()
                {
                    EmoteMatches = new List <string> {
                        emote.Name
                    },
                    LanguageString = code
                });
            }

            TranslateService.SaveTranslateGuild(config);
            await ReplyAsync($"{emote.Name} reactions will now translate messages to {code}");
        }