-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Purchase: ガチャとスロットで集計を分ける * コマンドも分けた * まちがえた
- Loading branch information
Showing
17 changed files
with
264 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Approvers.King.Common; | ||
using Discord; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Approvers.King.Events; | ||
|
||
public class GachaRankingPresenter : DiscordMessagePresenterBase | ||
{ | ||
protected override async Task MainAsync() | ||
{ | ||
await using var app = AppService.CreateSession(); | ||
|
||
var selfUser = await app.FindOrCreateUserAsync(Message.Author.Id); | ||
var users = await app.Users | ||
.OrderByDescending(user => user.MonthlyGachaPurchasePrice) | ||
.Take(MasterManager.SettingMaster.PurchaseInfoRankingViewUserCount) | ||
.ToListAsync(); | ||
|
||
await SendReplyAsync(selfUser, users); | ||
} | ||
|
||
private async Task SendReplyAsync(User selfUser, IReadOnlyList<User> users) | ||
{ | ||
var embed = new EmbedBuilder() | ||
.WithColor(Color.LightOrange) | ||
.AddField("おまえの今月のガチャ課金額", $"{selfUser.MonthlyGachaPurchasePrice:N0}†カス†(税込)", inline: true) | ||
.AddField("ガチャ課金額ランキング", GachaUtility.CreateRankingView(users)) | ||
.WithCurrentTimestamp() | ||
.Build(); | ||
|
||
await Message.ReplyAsync(embed: embed); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Approvers.King.Common; | ||
using Discord; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Approvers.King.Events; | ||
|
||
public class SlotRankingPresenter : DiscordMessagePresenterBase | ||
{ | ||
protected override async Task MainAsync() | ||
{ | ||
await using var app = AppService.CreateSession(); | ||
|
||
var selfUser = await app.FindOrCreateUserAsync(Message.Author.Id); | ||
var users = await app.Users | ||
.OrderByDescending(user => user.MonthlySlotProfitPrice) | ||
.Take(MasterManager.SettingMaster.PurchaseInfoRankingViewUserCount) | ||
.ToListAsync(); | ||
|
||
await SendReplyAsync(selfUser, users); | ||
} | ||
|
||
private async Task SendReplyAsync(User selfUser, IReadOnlyList<User> users) | ||
{ | ||
var embed = new EmbedBuilder() | ||
.WithColor(Color.LightOrange) | ||
.AddField("おまえの今月のスロット利益額", $"{selfUser.MonthlySlotProfitPrice:N0}†カス†(税込)", inline: true) | ||
.AddField("スロット利益額ランキング", SlotUtility.CreateRankingView(users)) | ||
.WithCurrentTimestamp() | ||
.Build(); | ||
|
||
await Message.ReplyAsync(embed: embed); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Text; | ||
using Approvers.King.Common; | ||
using Discord; | ||
|
||
namespace Approvers.King.Events; | ||
|
||
public static class SlotUtility | ||
{ | ||
public static string CreateRankingView(IReadOnlyList<User> rankingUsers) | ||
{ | ||
var embedBuilder = new StringBuilder(); | ||
var order = 1; | ||
foreach (var user in rankingUsers) | ||
{ | ||
var scoreText = Math.Min(999_999_999, user.MonthlySlotProfitPrice).ToString("N0"); | ||
var whiteSpace = Math.Max(0, 11 - scoreText.Length); | ||
var line = | ||
Format.Code($"#{order:D2} - {"".PadLeft(whiteSpace, ' ')}{scoreText}†カス†(税込)") + " " + | ||
MentionUtils.MentionUser(user.DiscordId); | ||
embedBuilder.AppendLine(line); | ||
order++; | ||
} | ||
|
||
return embedBuilder.ToString(); | ||
} | ||
} |
Oops, something went wrong.