Skip to content

Commit

Permalink
misc 适配冬促投票
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Dec 20, 2024
1 parent 978f236 commit 5b4717d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions ASFEnhance/ASFEnhance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ public Task OnLoaded()

"V" or
"VOTE" when access >= EAccess.Operator =>
Event.Command.ResponseAutumnSteamAwardVote(bot, ""),
Event.Command.ResponseWinterSteamAwardVote(bot, ""),

"CV" or
"CHECKVOTE" when access >= EAccess.Operator =>
Event.Command.ResponseCheckAutumnSteamAwardVote(bot),
Event.Command.ResponseCheckWinterSteamAwardVote(bot),

//Shortcut
"P" =>
Expand Down Expand Up @@ -503,14 +503,14 @@ public Task OnLoaded()

"V" or
"VOTE" when argLength > 2 && access >= EAccess.Operator =>
Event.Command.ResponseAutumnSteamAwardVote(args[1], Utilities.GetArgsAsText(args, 2, ",")),
Event.Command.ResponseWinterSteamAwardVote(args[1], Utilities.GetArgsAsText(args, 2, ",")),
"V" or
"VOTE" when access >= EAccess.Operator =>
Event.Command.ResponseAutumnSteamAwardVote(args[1], ""),
Event.Command.ResponseWinterSteamAwardVote(args[1], ""),

"CV" or
"CHECKVOTE" when access >= EAccess.Operator =>
Event.Command.ResponseCheckAutumnSteamAwardVote(Utilities.GetArgsAsText(args, 1, ",")),
Event.Command.ResponseCheckWinterSteamAwardVote(Utilities.GetArgsAsText(args, 1, ",")),

//Shortcut
"AL" =>
Expand Down
16 changes: 8 additions & 8 deletions ASFEnhance/Event/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ASFEnhance.Event;

internal static class Command
{
private const int categoryBegin = 110;
private const int CategoryBegin = 110;

/// <summary>
/// 获取DL2贴纸 6.28 - ?
Expand Down Expand Up @@ -127,7 +127,7 @@ internal static class Command
return FormatStaticResponse(Strings.BotNotFound, botNames);
}

var results = await Utilities.InParallel(bots.Select(bot => ResponseClaimItem(bot))).ConfigureAwait(false);
var results = await Utilities.InParallel(bots.Select(ResponseClaimItem)).ConfigureAwait(false);
var responses = new List<string?>(results.Where(result => !string.IsNullOrEmpty(result)));

return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
Expand Down Expand Up @@ -195,7 +195,7 @@ internal static class Command
return FormatStaticResponse(Strings.BotNotFound, botNames);
}

var results = await Utilities.InParallel(bots.Select(bot => ResponseClaim20Th(bot))).ConfigureAwait(false);
var results = await Utilities.InParallel(bots.Select(ResponseClaim20Th)).ConfigureAwait(false);
var responses = new List<string?>(results.Where(result => !string.IsNullOrEmpty(result)));

return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
Expand Down Expand Up @@ -227,7 +227,7 @@ internal static class Command
continue;
}

intGamsIDs.Add(choice);
intGamsIDs.Add(choice);
if (intGamsIDs.Count >= categories)
{
break;
Expand Down Expand Up @@ -257,7 +257,7 @@ internal static class Command

for (var i = 0; i < categories; i++)
{
tasks.Add(WebRequest.MakeVoteForAutumnSale(bot, intGamsIDs[i], categoryBegin + i, token, semaphore));
tasks.Add(WebRequest.MakeVoteForAutumnSale(bot, intGamsIDs[i], CategoryBegin + i, token, semaphore));
}

await Utilities.InParallel(tasks).ConfigureAwait(false);
Expand Down Expand Up @@ -375,7 +375,7 @@ internal static class Command
if (intGamsIDs.Count < categories) //不足11个游戏自动补齐
{
List<int> defaultGames =
[2358720, 2669410, 548430, 2230650, 1623730, 2358720, 2679460, 2358720, 2358720, 2704110, 3097560];
[2358720, 2669410, 413150, 2379780, 1623730, 1145350, 2379780, 2358720, 2396980, 2358720, 2198150];
while (intGamsIDs.Count < categories)
{
intGamsIDs.Add(defaultGames[intGamsIDs.Count]);
Expand All @@ -395,7 +395,7 @@ internal static class Command

for (var i = 0; i < categories; i++)
{
tasks.Add(WebRequest.MakeWinterSteamAwardVote(bot, intGamsIDs[i], categoryBegin + i, token, semaphore));
tasks.Add(WebRequest.MakeWinterSteamAwardVote(bot, intGamsIDs[i], CategoryBegin + i, token, semaphore));
}

await Utilities.InParallel(tasks).ConfigureAwait(false);
Expand Down Expand Up @@ -476,7 +476,7 @@ internal static class Command
return FormatStaticResponse(Strings.BotNotFound, botNames);
}

var results = await Utilities.InParallel(bots.Select(bot => ResponseCheckWinterSteamAwardVote(bot)))
var results = await Utilities.InParallel(bots.Select(ResponseCheckWinterSteamAwardVote))
.ConfigureAwait(false);
var responses = new List<string>(results.Where(result => !string.IsNullOrEmpty(result))!);

Expand Down
4 changes: 2 additions & 2 deletions ASFEnhance/Event/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ internal static async Task MakeWinterSteamAwardVote(Bot bot, int gameID, int cat
try
{
await semaphore.WaitAsync().ConfigureAwait(false);
var payload = new NominatePayload { CategoryId = categoryID, NominatedId = gameID, Source = 2640290 };
var payload = new NominatePayload { CategoryId = categoryID, NominatedId = gameID, Source = 3334340 };

var data = new Dictionary<string, string>(1, StringComparer.Ordinal)
{
Expand All @@ -254,7 +254,7 @@ internal static async Task MakeWinterSteamAwardVote(Bot bot, int gameID, int cat
/// <returns></returns>
internal static async Task<string?> CheckWinterSteamAwardVote(Bot bot)
{
var request = new Uri(SteamStoreURL, "/steamawards");
var request = new Uri(SteamStoreURL, "/steamawards/2024");
var response = await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request).ConfigureAwait(false);

if (response == null)
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.3.2.0</Version>
<Version>2.3.2.1</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 5b4717d

Please sign in to comment.