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
d1da08a3
Commit
d1da08a3
authored
Aug 18, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix at.
parent
5768c61b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
coolq/api.go
coolq/api.go
+15
-12
global/param.go
global/param.go
+6
-6
No files found.
coolq/api.go
View file @
d1da08a3
...
@@ -98,9 +98,23 @@ func (bot *CQBot) CQGetGroupMemberInfo(groupId, userId int64, noCache bool) MSG
...
@@ -98,9 +98,23 @@ func (bot *CQBot) CQGetGroupMemberInfo(groupId, userId int64, noCache bool) MSG
// https://cqhttp.cc/docs/4.15/#/API?id=send_group_msg-%E5%8F%91%E9%80%81%E7%BE%A4%E6%B6%88%E6%81%AF
// https://cqhttp.cc/docs/4.15/#/API?id=send_group_msg-%E5%8F%91%E9%80%81%E7%BE%A4%E6%B6%88%E6%81%AF
func
(
bot
*
CQBot
)
CQSendGroupMessage
(
groupId
int64
,
i
interface
{},
autoEscape
bool
)
MSG
{
func
(
bot
*
CQBot
)
CQSendGroupMessage
(
groupId
int64
,
i
interface
{},
autoEscape
bool
)
MSG
{
var
str
string
var
str
string
fixAt
:=
func
(
elem
[]
message
.
IMessageElement
)
{
for
_
,
e
:=
range
elem
{
if
at
,
ok
:=
e
.
(
*
message
.
AtElement
);
ok
&&
at
.
Target
!=
0
{
at
.
Display
=
"@"
+
func
()
string
{
mem
:=
bot
.
Client
.
FindGroup
(
groupId
)
.
FindMember
(
at
.
Target
)
if
mem
!=
nil
{
return
mem
.
DisplayName
()
}
return
strconv
.
FormatInt
(
at
.
Target
,
10
)
}()
}
}
}
if
m
,
ok
:=
i
.
(
gjson
.
Result
);
ok
{
if
m
,
ok
:=
i
.
(
gjson
.
Result
);
ok
{
if
m
.
Type
==
gjson
.
JSON
{
if
m
.
Type
==
gjson
.
JSON
{
elem
:=
bot
.
ConvertObjectMessage
(
m
,
true
)
elem
:=
bot
.
ConvertObjectMessage
(
m
,
true
)
fixAt
(
elem
)
mid
:=
bot
.
SendGroupMessage
(
groupId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
mid
:=
bot
.
SendGroupMessage
(
groupId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
if
mid
==
-
1
{
if
mid
==
-
1
{
return
Failed
(
100
)
return
Failed
(
100
)
...
@@ -125,18 +139,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
...
@@ -125,18 +139,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
}
else
{
}
else
{
elem
=
bot
.
ConvertStringMessage
(
str
,
true
)
elem
=
bot
.
ConvertStringMessage
(
str
,
true
)
}
}
// fix at display
fixAt
(
elem
)
for
_
,
e
:=
range
elem
{
if
at
,
ok
:=
e
.
(
*
message
.
AtElement
);
ok
&&
at
.
Target
!=
0
{
at
.
Display
=
"@"
+
func
()
string
{
mem
:=
bot
.
Client
.
FindGroup
(
groupId
)
.
FindMember
(
at
.
Target
)
if
mem
!=
nil
{
return
mem
.
DisplayName
()
}
return
strconv
.
FormatInt
(
at
.
Target
,
10
)
}()
}
}
mid
:=
bot
.
SendGroupMessage
(
groupId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
mid
:=
bot
.
SendGroupMessage
(
groupId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
if
mid
==
-
1
{
if
mid
==
-
1
{
return
Failed
(
100
)
return
Failed
(
100
)
...
...
global/param.go
View file @
d1da08a3
...
@@ -6,15 +6,15 @@ import (
...
@@ -6,15 +6,15 @@ import (
)
)
var
trueSet
=
map
[
string
]
struct
{}{
var
trueSet
=
map
[
string
]
struct
{}{
"true"
:
struct
{}
{},
"true"
:
{},
"yes"
:
struct
{}
{},
"yes"
:
{},
"1"
:
struct
{}
{},
"1"
:
{},
}
}
var
falseSet
=
map
[
string
]
struct
{}{
var
falseSet
=
map
[
string
]
struct
{}{
"false"
:
struct
{}
{},
"false"
:
{},
"no"
:
struct
{}
{},
"no"
:
{},
"0"
:
struct
{}
{},
"0"
:
{},
}
}
func
EnsureBool
(
p
interface
{},
defaultVal
bool
)
bool
{
func
EnsureBool
(
p
interface
{},
defaultVal
bool
)
bool
{
...
...
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