File tree Expand file tree Collapse file tree 3 files changed +17
-30
lines changed
Expand file tree Collapse file tree 3 files changed +17
-30
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ import (
1919 log "github.com/sirupsen/logrus"
2020)
2121
22- var Path = "device"
23-
2422func RandDevice (randGen * rand.Rand ) * client.DeviceInfo {
2523 device := & client.DeviceInfo {
2624 AndroidId : []byte ("MIRAI.123456.001" ),
@@ -111,7 +109,7 @@ func GetDevice(seed int64, clientProtocol int32) *client.DeviceInfo {
111109 randGen = rand .New (rand .NewSource (time .Now ().UnixNano ()))
112110 }
113111 // 默认 device/device-qq.json
114- devicePath := path .Join (Path , fmt .Sprintf ("device-%d.json" , seed ))
112+ devicePath := path .Join ("device" , fmt .Sprintf ("device-%d.json" , seed ))
115113
116114 // 优先使用参数目录
117115 if config .Device != "" {
Original file line number Diff line number Diff line change @@ -24,15 +24,14 @@ import (
2424)
2525
2626var (
27- sms = false // 参数优先使用短信验证
28- wsUrls = "" // websocket url
29- port = 9000 // 端口号
30- uin int64 = 0 // qq
31- pass = "" //password
32- device = "" // device file path
33- help = false // help
34- auth = ""
35- LogPath = "logs"
27+ sms = false // 参数优先使用短信验证
28+ wsUrls = "" // websocket url
29+ port = 9000 // 端口号
30+ uin int64 = 0 // qq
31+ pass = "" //password
32+ device = "" // device file path
33+ help = false // help
34+ auth = ""
3635)
3736
3837func init () {
@@ -58,10 +57,10 @@ func InitLog() {
5857 log .SetOutput (os .Stdout )
5958
6059 // 输出到文件
61- rotateLogs , err := rotatelogs .New (path .Join (LogPath , "%Y-%m-%d.log" ),
62- rotatelogs .WithLinkName (path .Join (LogPath , "latest.log" )), // 最新日志软链接
63- rotatelogs .WithRotationTime (time .Hour * 24 ), // 每天一个新文件
64- rotatelogs .WithMaxAge (time .Hour * 24 * 3 ), // 日志保留3天
60+ rotateLogs , err := rotatelogs .New (path .Join ("logs" , "%Y-%m-%d.log" ),
61+ rotatelogs .WithLinkName (path .Join ("logs" , "latest.log" )), // 最新日志软链接
62+ rotatelogs .WithRotationTime (time .Hour * 24 ), // 每天一个新文件
63+ rotatelogs .WithMaxAge (time .Hour * 24 * 3 ), // 日志保留3天
6564 )
6665 if err != nil {
6766 util .FatalError (err )
Original file line number Diff line number Diff line change 11package gmc_android
22
33import (
4+ "os"
5+
46 "github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
5- "github.com/ProtobufBot/Go-Mirai-Client/pkg/device"
67 "github.com/ProtobufBot/Go-Mirai-Client/pkg/gmc"
78
89 log "github.com/sirupsen/logrus"
@@ -11,24 +12,13 @@ import (
1112
1213var logger AndroidLogger
1314
14- // SetPluginPath 设置插件配置路径
15- func SetPluginPath (pluginPath string ) {
16- config .PluginPath = pluginPath
17- }
18-
1915// SetSms 设置是否短信优先
2016func SetSms (sms bool ) {
2117 config .SMS = sms
2218}
2319
24- // SetLogPath 设置日志目录
25- func SetLogPath (logPath string ) {
26- gmc .LogPath = logPath
27- }
28-
29- // SetDevicePath 设置设备信息路径
30- func SetDevicePath (devicePath string ) {
31- device .Path = devicePath
20+ func Chdir (dir string ) {
21+ _ = os .Chdir (dir )
3222}
3323
3424// Start 启动主程序
You can’t perform that action at this time.
0 commit comments