From 1d9813691c7ca264d4e53ce203a64b784a8350af Mon Sep 17 00:00:00 2001 From: Kanri Date: Mon, 6 Dec 2021 09:03:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=E2=9A=A1=EF=B8=8F=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=90=9C=E7=B4=A2=E4=BB=93=E5=BA=93=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=B8=A6=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_github/repo_searcher.go | 63 ++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/plugin_github/repo_searcher.go b/plugin_github/repo_searcher.go index cee535df..16155027 100644 --- a/plugin_github/repo_searcher.go +++ b/plugin_github/repo_searcher.go @@ -47,25 +47,50 @@ func init() { // 插件主体 // 发送结果 switch ctx.State["regex_matched"].([]string)[1] { case "-p ": // 图片模式 - ctx.SendChain(message.Image( - "https://opengraph.githubassets.com/0/"+repo.Get("full_name").Str, - ).Add("cache", 0)) - default: - ctx.SendChain(message.Text( - repo.Get("full_name").Str, "\n", - "Description: ", - repo.Get("description").Str, "\n", - "Star/Fork/Issue: ", - repo.Get("watchers").Int(), "/", repo.Get("forks").Int(), "/", repo.Get("open_issues").Int(), "\n", - "Language: ", - notnull(repo.Get("language").Str, "None"), "\n", - "License: ", - notnull(strings.ToUpper(repo.Get("license.key").Str), "None"), "\n", - "Last pushed: ", - repo.Get("pushed_at").Str, "\n", - "Jump: ", - repo.Get("html_url").Str, "\n", - )) + ctx.SendChain( + message.Image( + "https://opengraph.githubassets.com/0/"+repo.Get("full_name").Str, + ).Add("cache", 0), + ) + case "-t ": // 文字模式 + ctx.SendChain( + message.Text( + repo.Get("full_name").Str, "\n", + "Description: ", + repo.Get("description").Str, "\n", + "Star/Fork/Issue: ", + repo.Get("watchers").Int(), "/", repo.Get("forks").Int(), "/", repo.Get("open_issues").Int(), "\n", + "Language: ", + notnull(repo.Get("language").Str, "None"), "\n", + "License: ", + notnull(strings.ToUpper(repo.Get("license.key").Str), "None"), "\n", + "Last pushed: ", + repo.Get("pushed_at").Str, "\n", + "Jump: ", + repo.Get("html_url").Str, "\n", + ), + ) + default: // 文字模式 + ctx.SendChain( + message.Text( + repo.Get("full_name").Str, "\n", + "Description: ", + repo.Get("description").Str, "\n", + "Star/Fork/Issue: ", + repo.Get("watchers").Int(), "/", repo.Get("forks").Int(), "/", repo.Get("open_issues").Int(), "\n", + "Language: ", + notnull(repo.Get("language").Str, "None"), "\n", + "License: ", + notnull(strings.ToUpper(repo.Get("license.key").Str), "None"), "\n", + "Last pushed: ", + repo.Get("pushed_at").Str, "\n", + "Jump: ", + repo.Get("html_url").Str, "\n", + ), + message.Image( + "https://opengraph.githubassets.com/0/"+repo.Get("full_name").Str, + ).Add("cache", 0), + ) } }) }