1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

Merge pull request #110 from ProtobufBot/master

kick,mute: return error
This commit is contained in:
Mrs4s 2021-01-25 04:11:15 +08:00 committed by GitHub
commit fb93c5c731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,17 +316,24 @@ func (m *GroupMemberInfo) EditSpecialTitle(title string) {
} }
} }
func (m *GroupMemberInfo) Kick(msg string, block bool) { func (m *GroupMemberInfo) Kick(msg string, block bool) error {
if m.Uin != m.Group.client.Uin && m.Manageable() { if m.Uin != m.Group.client.Uin && m.Manageable() {
m.Group.client.kickGroupMember(m.Group.Code, m.Uin, msg, block) m.Group.client.kickGroupMember(m.Group.Code, m.Uin, msg, block)
return nil
} else {
return errors.New("not manageable")
} }
} }
func (m *GroupMemberInfo) Mute(time uint32) { func (m *GroupMemberInfo) Mute(time uint32) error {
if time >= 2592000 {
return errors.New("time is not in range")
}
if m.Uin != m.Group.client.Uin && m.Manageable() { if m.Uin != m.Group.client.Uin && m.Manageable() {
if time < 2592000 { m.Group.client.groupMute(m.Group.Code, m.Uin, time)
m.Group.client.groupMute(m.Group.Code, m.Uin, time) return nil
} } else {
return errors.New("not manageable")
} }
} }