@@ -3,11 +3,11 @@ package bot
33import (
44 "io/ioutil"
55 "os"
6- "strings"
76 "sync"
87 "time"
98
109 "github.com/Mrs4s/MiraiGo/client"
10+ "github.com/Mrs4s/MiraiGo/utils"
1111 "github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
1212 "github.com/fanliao/go-promise"
1313 log "github.com/sirupsen/logrus"
@@ -20,22 +20,23 @@ func InitDevice(path string) {
2020 if ! util .PathExists (path ) {
2121 log .Warn ("虚拟设备信息不存在, 将自动生成随机设备." )
2222 client .GenRandomDevice ()
23- client .SystemDeviceInfo .Display = []byte (strings . Replace ( string ( client . SystemDeviceInfo . Display ) , "MIRAI" , "GMC" , - 1 ) )
24- client .SystemDeviceInfo .FingerPrint = []byte (strings . Replace ( string ( client . SystemDeviceInfo . FingerPrint ) , "MIRAI" , "GMC" , - 1 ) )
25- client .SystemDeviceInfo .FingerPrint = []byte (strings . Replace ( string ( client . SystemDeviceInfo . FingerPrint ), "mirai" , "gmc" , - 1 ) )
26- client .SystemDeviceInfo .FingerPrint = [] byte ( strings . Replace ( string ( client .SystemDeviceInfo .FingerPrint ), "mamoe" , "pbbot" , - 1 ))
23+ client .SystemDeviceInfo .Display = []byte ("GMC." + utils . RandomStringRange ( 6 , "0123456789" ) + ".001" )
24+ client .SystemDeviceInfo .FingerPrint = []byte ("pbbot/gmc/gmc:10/PBBOT.200324.001/" + utils . RandomStringRange ( 7 , "0123456789" ) + ":user/release-keys" )
25+ client .
SystemDeviceInfo .
ProcVersion = []
byte (
"Linux version 4.0.8-" + utils . RandomString ( 8 ) + " ([email protected] )" )
26+ client .SystemDeviceInfo .AndroidId = client .SystemDeviceInfo .Display
2727 client .SystemDeviceInfo .Device = []byte ("gmc" )
2828 client .SystemDeviceInfo .Board = []byte ("gmc" )
2929 client .SystemDeviceInfo .Model = []byte ("gmc" )
3030 client .SystemDeviceInfo .Brand = []byte ("pbbot" )
3131 client .SystemDeviceInfo .Product = []byte ("gmc" )
32+ client .SystemDeviceInfo .Protocol = client .MacOS
3233 _ = ioutil .WriteFile (path , client .SystemDeviceInfo .ToJson (), 0644 )
3334 log .Infof ("已生成设备信息并保存到 %s 文件." , path )
34- } else {
35- log .Infof ("将使用 %s 内的设备信息运行" , path )
36- if err := client .SystemDeviceInfo .ReadJson ( []byte ( util . ReadAllText ( path ))); err != nil {
37- log . Fatalf ( "加载设备信息失败: %v" , err )
38- }
35+ }
36+ log .Infof ("将使用 %s 内的设备信息运行" , path )
37+ client .SystemDeviceInfo .IpAddress = []byte { 192 , 168 , 31 , 101 }
38+ if err := client . SystemDeviceInfo . ReadJson ([] byte ( util . ReadAllText ( path ))); err != nil {
39+ log . Fatalf ( "加载设备信息失败: %v" , err )
3940 }
4041}
4142
0 commit comments