From f8843ddaa1220d3ac6313712f6038f6840cff95d Mon Sep 17 00:00:00 2001 From: Takayama <49364055+MGMCN@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:30:21 +0900 Subject: [PATCH] Now you can view the illustrations in non-preview mode --- pkg/static/command.go | 7 +++++++ pkg/static/pixiv.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/pkg/static/command.go b/pkg/static/command.go index 53e2e9f..507d4a1 100644 --- a/pkg/static/command.go +++ b/pkg/static/command.go @@ -54,6 +54,13 @@ func ParseCommandMessage(content datatype.CommandContentRecv) (string, string, b } else { msg, err = getByPixivUid(dices[1]) } + case "illust": + dices := strings.FieldsFunc(content.Text, splitter) + if len(dices) == 1 { + msg = "plz give me an illustId!" + } else { + msg, err = getByillustId(dices[1]) + } default: return msg, parseMode, false, err } diff --git a/pkg/static/pixiv.go b/pkg/static/pixiv.go index e79e021..9d1b4fa 100644 --- a/pkg/static/pixiv.go +++ b/pkg/static/pixiv.go @@ -107,3 +107,7 @@ func getByPixivRankingMode(mode string) (string, error) { func getPixivTags() (string, error) { return handleRequest("GET", "", "", "getTrendingTags") } + +func getByillustId(illustId string) (string, error) { + return handleRequest("POST", "illust_id", illustId, "getIllustDownloadUrl") +}