Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

Minimum Refectoring #2

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Samurai/Components/ApiManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class ApiManager
{
public static async Task<Ticker> 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))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be verbose expressions. If you are feeling risks about it, please make unsafe member names safety.

using (var response = request.Content)
{
return JsonConvert.DeserializeObject<Ticker[]>(await response.ReadAsStringAsync().ConfigureAwait(false))[0];
Expand All @@ -21,7 +21,7 @@ public static async Task<Ticker> GetTickerAsync(string id, string convert = null

public static async Task<Dictionary<string, string>> 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))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be verbose expressions. If you are feeling risks about it, please make unsafe member names safety.

using (var response = request.Content)
{
return JsonConvert.DeserializeObject<Dictionary<string, string>[]>(await response.ReadAsStringAsync().ConfigureAwait(false))[0];
Expand All @@ -30,7 +30,7 @@ public static async Task<Dictionary<string, string>> GetTickerAsDictionaryAsync(

public static async Task<Ticker[]> 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))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be verbose expressions. If you are feeling risks about it, please make unsafe member names safety.

using (var response = request.Content)
{
return JsonConvert.DeserializeObject<Ticker[]>(await response.ReadAsStringAsync().ConfigureAwait(false));
Expand All @@ -39,7 +39,7 @@ public static async Task<Ticker[]> GetTickersAsync(string convert = null)

public static async Task<Dictionary<string, string>[]> 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))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be verbose expressions. If you are feeling risks about it, please make unsafe member names safety.

using (var response = request.Content)
{
return JsonConvert.DeserializeObject<Dictionary<string, string>[]>(await response.ReadAsStringAsync().ConfigureAwait(false));
Expand Down
2 changes: 1 addition & 1 deletion Samurai/Modules/TippingModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be verbose expressions. If you are feeling risks about it, please make unsafe member names safety.

}
var targets = await TippingManager.GetUsersAsync(Context.Channel, Context.User, 10).ConfigureAwait(false);
if (targets.Any())
Expand Down
7 changes: 2 additions & 5 deletions Samurai/Samurai.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
Expand All @@ -14,11 +13,9 @@
<PackageIconUrl>https://raw.githubusercontent.com/acid-chicken/Samurai/master/Assets/Samurai.png</PackageIconUrl>
<RepositoryUrl>https://github.com/acid-chicken/Samurai.git</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Net.Ping" Version="4.3.0" />
<PackageReference Include="Discord.Net" Version="1.0.2" />
<PackageReference Include="LiteDB" Version="4.1.0" />
</ItemGroup>

</Project>
</Project>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the ends of files have to be finished with a new line.