--- /dev/null
+package bili_danmu
+
+import (
+ "bytes"
+
+ p "github.com/qydysky/part"
+)
+
+type Autoban struct {
+ buf []byte
+ Inuse bool
+}
+
+var autoban = Autoban {
+ Inuse:true,
+}
+
+func Autobanf(s string) float32 {
+ if autoban.Inuse {return 0}
+
+ if len(autoban.buf) == 0 {
+ f := p.File().FileWR(p.Filel{
+ File:"Autoban.txt",
+ Write:false,
+ })
+ autoban.buf = []byte(f)
+ }
+
+ var scop int
+ for _, v := range []byte(s) {
+ if bytes.Contains(autoban.buf, []byte{v}) {scop += 1}
+ }
+ return float32(scop) / float32(len(s))
+}
+
+func Autoban_add(s string) {
+ if autoban.Inuse {return}
+
+ autoban.buf = append(autoban.buf, []byte(s)...)
+ p.File().FileWR(p.Filel{
+ File:"Autoban.txt",
+ Write:true,
+ Loc:-1,
+ Context:[]interface{}{s},
+ })
+}
\ No newline at end of file
msg := infob[1].(string)
auth := infob[2].([]interface{})[1].(string)
+ if Autobanf(msg) > 0.5 {msglog.Base(1, "风险").I(msg)}
if Msg_roomid != 0 && Msg_cookie != "" && msg == "弹幕机在么" {Danmu_s("在", Msg_cookie, Msg_roomid)}
msglog.I(auth, ":", msg)
if len(head) != WS_PACKAGE_HEADER_TOTAL_LENGTH {return false, 0}
danmulog.Base(-1, "头部检查").Level(show)
- defer danmulog.Base(0)
+ defer danmulog.Base(0).Level(LogLevel)
packL := Btoi32(head[:4])
headL := Btoi16(head[4:6])