Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
fb47a669
Commit
fb47a669
authored
Aug 03, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
local image sending supported. #8
parent
4be73b28
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
coolq/cqcode.go
coolq/cqcode.go
+16
-0
go.mod
go.mod
+1
-1
go.sum
go.sum
+4
-0
No files found.
coolq/cqcode.go
View file @
fb47a669
...
@@ -10,8 +10,10 @@ import (
...
@@ -10,8 +10,10 @@ import (
log
"github.com/sirupsen/logrus"
log
"github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
"github.com/tidwall/gjson"
"io/ioutil"
"io/ioutil"
"net/url"
"path"
"path"
"regexp"
"regexp"
"runtime"
"strconv"
"strconv"
"strings"
"strings"
)
)
...
@@ -176,6 +178,20 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
...
@@ -176,6 +178,20 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
}
}
return
message
.
NewImage
(
b
),
nil
return
message
.
NewImage
(
b
),
nil
}
}
if
strings
.
HasPrefix
(
f
,
"file"
)
{
fu
,
err
:=
url
.
Parse
(
f
)
if
err
!=
nil
{
return
nil
,
err
}
if
strings
.
HasPrefix
(
fu
.
Path
,
"/"
)
&&
runtime
.
GOOS
==
`windows`
{
fu
.
Path
=
fu
.
Path
[
1
:
]
}
b
,
err
:=
ioutil
.
ReadFile
(
fu
.
Path
)
if
err
!=
nil
{
return
nil
,
err
}
return
message
.
NewImage
(
b
),
nil
}
if
global
.
PathExists
(
path
.
Join
(
global
.
IMAGE_PATH
,
f
))
{
if
global
.
PathExists
(
path
.
Join
(
global
.
IMAGE_PATH
,
f
))
{
b
,
err
:=
ioutil
.
ReadFile
(
path
.
Join
(
global
.
IMAGE_PATH
,
f
))
b
,
err
:=
ioutil
.
ReadFile
(
path
.
Join
(
global
.
IMAGE_PATH
,
f
))
if
err
!=
nil
{
if
err
!=
nil
{
...
...
go.mod
View file @
fb47a669
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
go 1.14
require (
require (
github.com/Mrs4s/MiraiGo v0.0.0-2020080
2150153-a7761bfb7571
github.com/Mrs4s/MiraiGo v0.0.0-2020080
3034534-d8ed1a49ff8b
github.com/gin-gonic/gin v1.6.3
github.com/gin-gonic/gin v1.6.3
github.com/gorilla/websocket v1.4.2
github.com/gorilla/websocket v1.4.2
github.com/guonaihong/gout v0.1.1
github.com/guonaihong/gout v0.1.1
...
...
go.sum
View file @
fb47a669
...
@@ -2,6 +2,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
...
@@ -2,6 +2,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Mrs4s/MiraiGo v0.0.0-20200802150153-a7761bfb7571 h1:OQQhH7IVRX5BqjUwrlg6mKVUlxKoBzOPUNwZEToGQ00=
github.com/Mrs4s/MiraiGo v0.0.0-20200802150153-a7761bfb7571 h1:OQQhH7IVRX5BqjUwrlg6mKVUlxKoBzOPUNwZEToGQ00=
github.com/Mrs4s/MiraiGo v0.0.0-20200802150153-a7761bfb7571/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200802150153-a7761bfb7571/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200802165028-683ad4b6cbb5 h1:NF3YM6Bv2/sA6yc1wxuBuHRfVBhQws02INRpqrkqmh4=
github.com/Mrs4s/MiraiGo v0.0.0-20200802165028-683ad4b6cbb5/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200803034534-d8ed1a49ff8b h1:XQEeWyot+xvUDV9btSbI+fAJdWXxRLBWE8wRyzpgmfA=
github.com/Mrs4s/MiraiGo v0.0.0-20200803034534-d8ed1a49ff8b/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment