fix: 修改多个处理函数的返回类型为指针类型,以提高内存使用效率并避免不必要的拷贝

This commit is contained in:
lixiangwuxian
2025-04-09 23:28:39 +08:00
parent 144034939c
commit 7f0560b56e
32 changed files with 211 additions and 210 deletions

View File

@@ -11,15 +11,15 @@ func init() {
// handler.RegisterHelpInform("上网", "getweb", "上网 <URL> 截取网页")
}
func getweb(msg model.Message) (reply model.Reply) {
func getweb(msg model.Message) (reply *model.Reply) {
if len(msg.RawMsg) <= len("上网 ") {
return model.Reply{}
return &model.Reply{}
}
url := msg.RawMsg[len("上网 "):]
url = formatURL(url)
// if err := util.ScreenshotURL(url, "./tmp/getweb/url.png", 1620, 1960, 0, 0, 0, 0, ""); err != nil {
if err := util.ScreenshotURL(url, util.GenTempFilePath("getweb/url.png"), 1620, 1960, 0, 0, 0, 0, ""); err != nil {
return model.Reply{
return &model.Reply{
ReplyMsg: err.Error(),
ReferOriginMsg: true,
FromMsg: msg,
@@ -31,7 +31,7 @@ func getweb(msg model.Message) (reply model.Reply) {
File: "file:///tmp/qqbot/getweb/url.png",
},
}
return model.Reply{
return &model.Reply{
ReplyMsg: imageMsg.ToCQString(),
ReferOriginMsg: true,
FromMsg: msg,