-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update 满足合并需要 #1094
Update 满足合并需要 #1094
Conversation
Changes by create-pull-request action
panic(err) | ||
logrus.Infof("[tarot]uri: %s", engine.DataFolder()) | ||
|
||
MajorArcana := engine.DataFolder() + "MajorArcana" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不必检测是否存在此文件夹,MkdirAll在文件夹存在时不会报错。直接每次执行即可。对于报错,直接panic(err),return没用。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
检测了又能咋样?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github源在国内能拉取到的地方能有多少,大部分地区都是timeout,raw.githubusercontent.com的可访问性几乎为0,只有github.io的可访问性比较高,github.com能不能访问纯属看当地sni阻断程度,绝大部分时间都是无法访问
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有没有一种可能,就是说我有办法绕过去,并且已经在zbp实装了。只要DNS正确就能下载,多的就不说了,你自己试试不就知道了。
} | ||
} | ||
|
||
MinorArcana := engine.DataFolder() + "MinorArcana" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
变量名全部以小写开头。
return os.WriteFile(f.Name(), data, 0755) | ||
}, ctxext.Send(ctx)) | ||
imgurl := reverse[p] + card.ImgURL | ||
_, err := engine.GetLazyData(imgurl, true) // 获取数据和错误 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接使用返回的data, 发 base64,即message.ImageBytes(data)
@@ -319,23 +318,13 @@ func init() { | |||
}) | |||
} | |||
|
|||
func poolimg(imgurl, imgname, cache string) (msg message.Segment, err error) { | |||
imgfile := cache + "/" + imgname + ".png" | |||
func poolimg(engine *control.Engine, imgurl, cache string) (msg message.Segment, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可直接删去pool/cache。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数并无它名字的意义,它只是为了减少代码的修改量而存在,并且对于imgfile的拼凑这个提交的最新的代码为:
imgfile := cache + "/" + imgurl aimgfile := file.BOTPATH + "/" + imgfile
,它是为了拼凑出一个合适的路径
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那你应当把函数名和入参名都改了,该改的时候不该说减少修改量,反而影响之后看的人阅读代码。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
算了,看看别人改的吧,这是我想要达到的效果 #1097
No description provided.