File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ func handleUser(ctx *zero.Ctx) {
81
81
82
82
// 处理set命令
83
83
if set > 0 {
84
+ if ctx .Event .UserID == user {
85
+ ctx .SendChain (message .Text ("你不能设置自己的权限等级" ))
86
+ return
87
+ }
84
88
if control .CheckPremission (ctx .Event .UserID , 9 ) {
85
89
err := setPermissionLevel (user , set )
86
90
if err != nil {
@@ -97,6 +101,10 @@ func handleUser(ctx *zero.Ctx) {
97
101
98
102
// 处理unban命令
99
103
if pardon {
104
+ if ctx .Event .UserID == user {
105
+ ctx .SendChain (message .Text ("你不能解除封禁自己" ))
106
+ return
107
+ }
100
108
if control .CheckPremission (ctx .Event .UserID , 9 ) {
101
109
err := pardonUser (user )
102
110
if err != nil {
@@ -112,6 +120,10 @@ func handleUser(ctx *zero.Ctx) {
112
120
113
121
// 处理reset命令
114
122
if reset {
123
+ if ctx .Event .UserID == user {
124
+ ctx .SendChain (message .Text ("你不能重置自己的权限等级" ))
125
+ return
126
+ }
115
127
if control .CheckPremission (ctx .Event .UserID , 9 ) {
116
128
err := resetUser (user )
117
129
if err != nil {
@@ -126,6 +138,10 @@ func handleUser(ctx *zero.Ctx) {
126
138
}
127
139
128
140
// 处理ban命令
141
+ if ctx .Event .UserID == user {
142
+ ctx .SendChain (message .Text ("你不能封禁自己" ))
143
+ return
144
+ }
129
145
if control .CheckPremission (ctx .Event .UserID , 9 ) {
130
146
err := banUser (user , ban )
131
147
if err != nil {
You can’t perform that action at this time.
0 commit comments