Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vote for the first round of the Steam Awards (nominations) #340

Closed
woctezuma opened this issue Nov 27, 2024 · 14 comments
Closed

Vote for the first round of the Steam Awards (nominations) #340

woctezuma opened this issue Nov 27, 2024 · 14 comments
Labels
added Features that already added enhancement New feature or request

Comments

@woctezuma
Copy link

woctezuma commented Nov 27, 2024

I am not sure whether we have a command to vote for the first round of the Steam Awards (nominations):

Maybe a new !vote ASF command for this event would be feasible.

!vote ASF

Related:

Picture

@chr233
Copy link
Owner

chr233 commented Nov 28, 2024

added in 2.2.8.0

@chr233 chr233 added enhancement New feature or request added Features that already added labels Nov 28, 2024
@bolexator
Copy link

Only two passes. Does not play or write a review.

@woctezuma
Copy link
Author

woctezuma commented Nov 28, 2024

I can get 3 ticks out of 4 with the following code.

!vote ASF 2379780,1712350,275850,2727650,2347910,1425350,2570630,1147860,2835570,1497360,1177980
!addlicense ASF a/2570630
!play ASF 2570630
!resume ASF
!checkvote ASF

For the fourth tick (writing a review), one needs the IPC interface. I need to investigate.

You need to agree to the EULA before using this function.
For details, see [Plug-in Configuration Instructions](#plug-in configuration instructions)

API 方法 说明
/Api/Recommend/PublishReview/{botNames} POST 发布游戏评测
/Api/Recommend/DeleteReview/{botNames} POST 删除游戏评测

/// <summary>
/// 发布游戏评测
/// </summary>
/// <param name="bot"></param>
/// <param name="gameId"></param>
/// <param name="comment"></param>
/// <param name="rateUp"></param>
/// <param name="isPublic"></param>
/// <param name="enComment"></param>
/// <param name="forFree"></param>
/// <returns></returns>
internal static async Task<RecommendGameResponse?> PublishReview(this Bot bot, uint gameId, string comment, bool rateUp = true, bool isPublic = true, bool enComment = true, bool forFree = false)
{
var request = new Uri(SteamStoreURL, "/friends/recommendgame");
var referer = new Uri(SteamStoreURL, $"/app/{gameId}");
var data = new Dictionary<string, string>(11, StringComparer.Ordinal)
{
{ "appid", gameId.ToString() },
{ "steamworksappid", gameId.ToString() },
{ "comment", comment + '\u200D' },
{ "rated_up", rateUp ? "true" : "false" },
{ "is_public", isPublic ? "true" : "false" },
{ "language", DefaultOrCurrentLanguage },
{ "received_compensation", forFree ? "1" : "0" },
{ "disable_comments", enComment ? "0" : "1" },
};
var response = await bot.ArchiWebHandler.UrlPostToJsonObjectWithSession<RecommendGameResponse>(request, data: data, referer: referer).ConfigureAwait(false);
return response?.Content;
}

However, don't expect a simple command in my opinion:

@Gitlenova
Copy link

hi i am newbie
what command that use to review a game

@bolexator
Copy link

hi i am newbie what command that use to review a game

command for the Review does not work

@Gitlenova
Copy link

then how to do that

@bolexator
Copy link

then how to do that

Not yet, manually

@woctezuma
Copy link
Author

woctezuma commented Nov 28, 2024

Alright, this works as long as you have enough playtime to write a review.

import json

import requests

BASE_URL = "http://localhost:1242"
TIMEOUT_IN_SECONDS = 3


def publish_review(bot_name: str, app_id: int) -> requests.Response:
    endpoint = "/Api/Recommend/PublishReview/"
    data = {
        "Recommends": [
            {
                "AppId": app_id,
                "RateUp": True,
                "AllowReply": True,
                "ForFree": True,
                "Public": True,
                "Comment": "This is my review for the Steam Awards.",
            },
        ],
    }
    return requests.post(
        url=f"{BASE_URL}{endpoint}{bot_name}",
        json=data,
        timeout=TIMEOUT_IN_SECONDS,
    )


def delete_review(bot_name: str, app_id: int) -> requests.Response:
    endpoint = "/Api/Recommend/DeleteReview/"
    data = {
        "AppIds": [app_id],
    }
    return requests.post(
        url=f"{BASE_URL}{endpoint}{bot_name}",
        json=data,
        timeout=TIMEOUT_IN_SECONDS,
    )


def is_successful(r: requests.Response, bot_name: str, app_id: int) -> bool:
    d = json.loads(r.text)
    return d["Result"][bot_name][str(app_id)]


def main() -> None:
    for bot_name in ["MyBot_A", "MyBot_B", "MyBot_C"]:
        app_id = 2570630
        r = publish_review(bot_name, app_id)
        if is_successful(r, bot_name, app_id):
            delete_review(bot_name, app_id)


if __name__ == "__main__":
    main()

@bolexator
Copy link

Yes, need at least 30 minutes of the game, then the review is done

@Gitlenova
Copy link

@woctezuma please how to use this script

@woctezuma
Copy link
Author

woctezuma commented Nov 30, 2024

You need Python with requests, ASF properly configured with the IPC interface, and enough playtime to be able to write a review.

Edit: You also have to accept the EULA in the config of ASFEnhance.

@bolexator
Copy link

You need Python with requests, ASF properly configured with the IPC interface, and enough playtime to be able to write a review.

The standard set of ASF + ASF Enhance is sufficient, by default. Python is not necessary at all. It is necessary that the game has enough played hours. I conducted an experiment yesterday, PLAY command is enough for the selected game, for at least 30 minutes. After that, the PREC command works fine. I didn't register EULA in the config in a special way, but PREC works.

@woctezuma please how to use this script

It is necessary that the game for which the review is being written has a simulated time of at least 5 minutes. For example, you need to do a review on the DOTA game (AppID 570). Launching the game - PLAY ASF 570. Wait 30 minutes, then you can write a review - PREC ASF +570 SUPER. After the script has worked, it is advisable to delete the review - DREC ASF 570.

@woctezuma
Copy link
Author

woctezuma commented Nov 30, 2024

I see. I did not know about PREC and DREC, because the description mentions a comment or a recommendation (or a "recomment") instead of a review, so I thought that was something else. 😆

Command Shorthand Access Description
PUBLISHRECOMMENT [Bots] <AppIDs> COMMENT PREC Master Publish a recommendation for the game/app, appd or +appId rateUp, -appId rateDown
DELETERECOMMENT [Bots] <AppIDs> DREC Master Delete a recommendation for the game/app

@chr233
Copy link
Owner

chr233 commented Nov 30, 2024

I see. I did not know about PREC and DREC, because the description mentions a comment or a recommendation (or a "recomment") instead of a review, so I thought that was something else. 😆

Command Shorthand Access Description
PUBLISHRECOMMENT [Bots] <AppIDs> COMMENT PREC Master Publish a recommendation for the game/app, appd or +appId rateUp, -appId rateDown
DELETERECOMMENT [Bots] <AppIDs> DREC Master Delete a recommendation for the game/app

it's the same thing, I followed steam's called "recommend"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added Features that already added enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants