diff --git a/Samurai/Components/ApiManager.cs b/Samurai/Components/ApiManager.cs index 1a222a8..cfa341e 100644 --- a/Samurai/Components/ApiManager.cs +++ b/Samurai/Components/ApiManager.cs @@ -1,18 +1,15 @@ -using System; using System.Collections.Generic; -using System.Net.Http; using System.Threading.Tasks; +using AcidChicken.Samurai.Models; using Newtonsoft.Json; namespace AcidChicken.Samurai.Components { - using static Program; - using Models; public static class ApiManager { public static async Task GetTickerAsync(string id, string convert = null) { - using (var request = await HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/{id}/{(string.IsNullOrEmpty(convert) ? "" : $"?convert={convert}")}").ConfigureAwait(false)) + using (var request = await Program.HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/{id}/{(string.IsNullOrEmpty(convert) ? "" : $"?convert={convert}")}").ConfigureAwait(false)) using (var response = request.Content) { return JsonConvert.DeserializeObject(await response.ReadAsStringAsync().ConfigureAwait(false))[0]; @@ -21,7 +18,7 @@ public static async Task GetTickerAsync(string id, string convert = null public static async Task> GetTickerAsDictionaryAsync(string id, string convert = null) { - using (var request = await HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/{id}/{(string.IsNullOrEmpty(convert) ? "" : $"?convert={convert}")}").ConfigureAwait(false)) + using (var request = await Program.HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/{id}/{(string.IsNullOrEmpty(convert) ? "" : $"?convert={convert}")}").ConfigureAwait(false)) using (var response = request.Content) { return JsonConvert.DeserializeObject[]>(await response.ReadAsStringAsync().ConfigureAwait(false))[0]; @@ -30,7 +27,7 @@ public static async Task> GetTickerAsDictionaryAsync( public static async Task GetTickersAsync(string convert = null) { - using (var request = await HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/?limit=0{(string.IsNullOrEmpty(convert) ? "" : $"&convert={convert}")}").ConfigureAwait(false)) + using (var request = await Program.HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/?limit=0{(string.IsNullOrEmpty(convert) ? "" : $"&convert={convert}")}").ConfigureAwait(false)) using (var response = request.Content) { return JsonConvert.DeserializeObject(await response.ReadAsStringAsync().ConfigureAwait(false)); @@ -39,7 +36,7 @@ public static async Task GetTickersAsync(string convert = null) public static async Task[]> GetTickersAsDictionaryAsync(string convert = null) { - using (var request = await HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/?limit=0{(string.IsNullOrEmpty(convert) ? "" : $"&convert={convert}")}").ConfigureAwait(false)) + using (var request = await Program.HttpClient.GetAsync($"https://api.coinmarketcap.com/v1/ticker/?limit=0{(string.IsNullOrEmpty(convert) ? "" : $"&convert={convert}")}").ConfigureAwait(false)) using (var response = request.Content) { return JsonConvert.DeserializeObject[]>(await response.ReadAsStringAsync().ConfigureAwait(false)); diff --git a/Samurai/Models/RpcResponse.cs b/Samurai/Models/RpcResponse.cs index 191fd95..f1fdd9f 100644 --- a/Samurai/Models/RpcResponse.cs +++ b/Samurai/Models/RpcResponse.cs @@ -1,6 +1,4 @@ -using System; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace AcidChicken.Samurai.Models { diff --git a/Samurai/Models/Ticker.cs b/Samurai/Models/Ticker.cs index 2f78c15..37dfefd 100644 --- a/Samurai/Models/Ticker.cs +++ b/Samurai/Models/Ticker.cs @@ -1,10 +1,7 @@ -using System; using Newtonsoft.Json; namespace AcidChicken.Samurai.Models { - using Tasks; - [JsonObject] public class Ticker { diff --git a/Samurai/Modules/CommonModule.cs b/Samurai/Modules/CommonModule.cs index 9e7f12a..99ee2aa 100644 --- a/Samurai/Modules/CommonModule.cs +++ b/Samurai/Modules/CommonModule.cs @@ -4,16 +4,14 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; +using AcidChicken.Samurai.Assets; +using AcidChicken.Samurai.Components; using Discord; using Discord.Commands; namespace AcidChicken.Samurai.Modules { using static Program; - using Assets; - using Components; - using Models; - using Tasks; [Group(""), Summary("汎用モジュールです。")] public class CommonModule : ModuleBase diff --git a/Samurai/Modules/ConversionModule.cs b/Samurai/Modules/ConversionModule.cs index 1ab6673..72ac28d 100644 --- a/Samurai/Modules/ConversionModule.cs +++ b/Samurai/Modules/ConversionModule.cs @@ -1,15 +1,12 @@ -using System; using System.Linq; using System.Threading.Tasks; +using AcidChicken.Samurai.Assets; +using AcidChicken.Samurai.Components; using Discord; using Discord.Commands; namespace AcidChicken.Samurai.Modules { - using static Program; - using Assets; - using Components; - [Group("conversion"), Summary("通貨換算モジュールです。"), Alias("conv", "c")] public class ConversionModule : ModuleBase { diff --git a/Samurai/Modules/ModuleManager.cs b/Samurai/Modules/ModuleManager.cs index cbebb7b..84537cf 100644 --- a/Samurai/Modules/ModuleManager.cs +++ b/Samurai/Modules/ModuleManager.cs @@ -1,8 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; +using AcidChicken.Samurai.Assets; +using AcidChicken.Samurai.Components; using Discord; using Discord.Commands; using Discord.WebSocket; @@ -10,8 +11,6 @@ namespace AcidChicken.Samurai.Modules { using static Program; - using Assets; - using Components; public static class ModuleManager { diff --git a/Samurai/Modules/TippingModule.cs b/Samurai/Modules/TippingModule.cs index 383571b..03299ee 100644 --- a/Samurai/Modules/TippingModule.cs +++ b/Samurai/Modules/TippingModule.cs @@ -1,20 +1,16 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using AcidChicken.Samurai.Assets; +using AcidChicken.Samurai.Components; +using AcidChicken.Samurai.Models; +using AcidChicken.Samurai.Tasks; using Discord; using Discord.Commands; -using Discord.Net; -using LiteDB; -using Newtonsoft.Json; namespace AcidChicken.Samurai.Modules { using static Program; - using Assets; - using Components; - using Models; - using Tasks; [Group(""), Summary("投げ銭モジュールです。")] public class TippingModule : ModuleBase @@ -88,7 +84,7 @@ public async Task RainAsync([Summary("金額")] decimal totalAmount = decimal.Mi { if (totalAmount == decimal.MinusOne) { - totalAmount = (decimal)Math.Pow(10, Random.NextDouble()) - 1; + totalAmount = (decimal)Math.Pow(10, Program.Random.NextDouble()) - 1; } var targets = await TippingManager.GetUsersAsync(Context.Channel, Context.User, 10).ConfigureAwait(false); if (targets.Any()) diff --git a/Samurai/Program.cs b/Samurai/Program.cs index 366c555..335dfc0 100644 --- a/Samurai/Program.cs +++ b/Samurai/Program.cs @@ -1,10 +1,11 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using AcidChicken.Samurai.Models; +using AcidChicken.Samurai.Modules; +using AcidChicken.Samurai.Tasks; using Discord; using Discord.WebSocket; using LiteDB; @@ -12,11 +13,6 @@ namespace AcidChicken.Samurai { - using Components; - using Models; - using Modules; - using Tasks; - public static class Program { public const string ConfigurePath = "config.json"; diff --git a/Samurai/Samurai.csproj b/Samurai/Samurai.csproj index da98ce8..89309af 100644 --- a/Samurai/Samurai.csproj +++ b/Samurai/Samurai.csproj @@ -1,5 +1,4 @@ - - + Exe netcoreapp2.0 @@ -14,11 +13,9 @@ https://raw.githubusercontent.com/acid-chicken/Samurai/master/Assets/Samurai.png https://github.com/acid-chicken/Samurai.git - - - + \ No newline at end of file diff --git a/Samurai/Tasks/TickerManager.cs b/Samurai/Tasks/TickerManager.cs index 91ef05a..a02a329 100644 --- a/Samurai/Tasks/TickerManager.cs +++ b/Samurai/Tasks/TickerManager.cs @@ -1,15 +1,13 @@ using System; -using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using AcidChicken.Samurai.Components; +using AcidChicken.Samurai.Models; using Discord; -using Newtonsoft.Json; namespace AcidChicken.Samurai.Tasks { using static Program; - using Components; - using Models; public static class TickerManager { diff --git a/Samurai/Tasks/TippingManager.cs b/Samurai/Tasks/TippingManager.cs index f195cdd..a9c0328 100644 --- a/Samurai/Tasks/TippingManager.cs +++ b/Samurai/Tasks/TippingManager.cs @@ -2,22 +2,16 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; using System.Threading; using System.Threading.Tasks; +using AcidChicken.Samurai.Models; using Discord; using LiteDB; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace AcidChicken.Samurai.Tasks { using static Program; - using Components; - using Models; public static class TippingManager {