コード例 #1
0
        public async Task RedeemUses([Remainder] string key = "")
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                await ReplyAsync($"Please enter a key or purchase one at: {TranslateService.GetTranslateConfig().StoreUrl}");

                return;
            }

            var profile      = TranslateService.License.GetQuantifiableUser(TranslateService.TranslateType, Context.Guild.Id);
            var redeemResult = TranslateService.License.RedeemLicense(profile, key);

            if (redeemResult == LicenseService.RedemptionResult.Success)
            {
                await ReplyAsync($"You have successfully redeemed the license. Current Balance is: {profile.RemainingUses()}");
            }
            else if (redeemResult == LicenseService.RedemptionResult.AlreadyClaimed)
            {
                await ReplyAsync("License Already Redeemed");
            }
            else if (redeemResult == LicenseService.RedemptionResult.InvalidKey)
            {
                await ReplyAsync("Invalid Key Provided");
            }
        }
コード例 #2
0
        public async Task SetStoreUrl(string storeUrl = null)
        {
            var config = TranslateService.GetTranslateConfig();

            config.StoreUrl = storeUrl;
            await ReplyAsync("Store url set.");

            TranslateService.SaveTranslateConfig(config);
        }
コード例 #3
0
        public async Task ToggleTranslation()
        {
            var config = TranslateService.GetTranslateConfig();

            config.Enabled = !config.Enabled;
            await ReplyAsync($"Translation Enabled: {config.Enabled}\nNOTE: API Key needs to be set in order for translations to run.");

            TranslateService.SaveTranslateConfig(config);
        }
コード例 #4
0
        public async Task SetApiType(TranslateConfig.ApiKey apiKeyType)
        {
            var config = TranslateService.GetTranslateConfig();

            config.ApiKeyType = apiKeyType;
            await ReplyAsync("This will take effect after a restart.");

            TranslateService.SaveTranslateConfig(config);
        }
コード例 #5
0
        public async Task SetApiKey(string apiKey = null)
        {
            var config = TranslateService.GetTranslateConfig();

            config.APIKey = apiKey;
            await ReplyAsync("This will take effect after a restart.");

            TranslateService.SaveTranslateConfig(config);
        }