Merge branch 'pr/40' into dev

This commit is contained in:
Kanri 2021-07-02 12:49:55 +08:00
commit 3b8df7f14a
8 changed files with 125 additions and 22 deletions

9
.idea/ZeroBot-Plugin.iml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ZeroBot-Plugin.iml" filepath="$PROJECT_DIR$/.idea/ZeroBot-Plugin.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

64
.idea/workspace.xml Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="075d8bd1-a584-4439-8e19-b0c2acd4ed59" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="GOROOT" url="file://F:/gosdk/go1.16" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GoLibraries">
<option name="indexEntireGoPath" value="false" />
</component>
<component name="ProjectId" id="1uihCVlCP3LZiTROCGKX2A0l3rd" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="go.import.settings.migrated" value="true" />
<property name="go.sdk.automatically.set" value="true" />
<property name="go.tried.to.enable.integration.vgo.integrator" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="go.sdk" />
</component>
<component name="RemoteSynchronizer">
<option name="targetMappings">
<list>
<TargetMappings>
<option name="name" value="Default" />
</TargetMappings>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="go build github.com/FloatTech/ZeroBot-Plugin" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="ZeroBot-Plugin" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/main.go" />
<package value="github.com/FloatTech/ZeroBot-Plugin" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Go Build.go build github.com/FloatTech/ZeroBot-Plugin" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>
</project>

1
go.mod
View File

@ -7,6 +7,7 @@ require (
github.com/FloatTech/ZeroBot-Plugin-Timer v1.2.2
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/robfig/cron v1.2.0
github.com/shirou/gopsutil v3.21.5+incompatible
github.com/sirupsen/logrus v1.8.1
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816

2
go.sum
View File

@ -51,6 +51,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/shirou/gopsutil v3.21.5+incompatible h1:OloQyEerMi7JUrXiNzy8wQ5XN+baemxSl12QgIzt0jc=
github.com/shirou/gopsutil v3.21.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=

View File

@ -1,29 +1,31 @@
package plugin_diana
package plugin_bilibili
import (
"encoding/json"
"github.com/robfig/cron"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"net/http"
"time"
)
type follower struct {
Mid int `json:"mid"`
Uname string `json:"uname"`
Video int `json:"video"`
Roomid int `json:"roomid"`
Rise int `json:"rise"`
Follower int `json:"follower"`
GuardNum int `json:"guardNum"`
AreaRank int `json:"areaRank"`
Mid int `json:"mid"`
Uname string `json:"uname"`
Video int `json:"video"`
Roomid int `json:"roomid"`
Rise int `json:"rise"`
Follower int `json:"follower"`
GuardNum int `json:"guardNum"`
AreaRank int `json:"areaRank"`
}
// 开启日报推送
func init() {
zero.OnFullMatch("/开启粉丝日报", zero.AdminPermission).
Handle(func(ctx *zero.Ctx) {
FansDaily(130591566) //群号传进去给下面发信息的函数
})
})
}
// 定时任务每天晚上最后2分钟执行一次
@ -96,7 +98,7 @@ func fansData(groupID int64) {
"舰队: ", carol.GuardNum, "\n",
"直播总排名: ", carol.AreaRank, "\n",
"数据来源: ", "https://vtbs.moe/detail/", "351609538",
))
))
return true
})
}
@ -115,4 +117,4 @@ func fensiapi(uid string) *follower {
panic(err)
}
return result
}
}

View File

@ -6,12 +6,23 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"math"
"strconv"
"time"
zero "github.com/wdvxdr1123/ZeroBot"
"net/http"
"strings"
)
type zhiwang struct {
Code int `json:"code"`
Data struct {
EndTime int `json:"end_time"`
Rate float64 `json:"rate"`
Related [][]interface{} `json:"related"`
StartTime int `json:"start_time"`
} `json:"data"`
Message string `json:"message"`
}
// 小作文查重: 回复要查的消息 查重
func init() {
@ -36,21 +47,21 @@ func init() {
related := zhiwangjson.Data.Related[0][1].(map[string]interface{})
ctx.SendChain(message.Text(
"枝网文本复制检测报告(简洁)", "\n",
"查重时间: ", timecurrent(), "\n",
"总文字复制比: ", math.Floor(zhiwangjson.Data.Rate * 100), "%", "\n",
"查重时间: ", time.Now().Format("2006-01-02 15:04:05"), "\n",
"总文字复制比: ", math.Floor(zhiwangjson.Data.Rate*100), "%", "\n",
"相似小作文:", "\n",
related["content"].(string)[:102] + ".....", "\n",
related["content"].(string)[:102]+".....", "\n",
"获赞数", related["like_num"], "\n",
zhiwangjson.Data.Related[0][2].(string), "\n",
"作者: ", related["m_name"], "\n",
"发表时间: ", timestamp(related["ctime"].(float64)), "\n",
"发表时间: ", time.Unix(int64(related["ctime"].(float64)), 0).Format("2006-01-02 15:04:05"), "\n",
"查重结果仅作参考,请注意辨别是否为原创", "\n",
"数据来源: https://asoulcnki.asia/",
))
}else {
))
} else {
return
}
})
})
}
// 发起api请求并把返回body交由json库解析
@ -65,7 +76,7 @@ func zhiwangapi(Text string) *zhiwang {
client := &http.Client{}
resp, err := client.Do(req)
if err != nil{
if err != nil {
panic(err)
}
defer resp.Body.Close()
@ -95,4 +106,4 @@ func FullMatchText(src ...string) zero.Rule {
}
return false
}
}
}