mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-30 09:27:10 +02:00
move locks and bans to state.
This commit is contained in:
parent
06e25df962
commit
e045bd8a1e
6 changed files with 88 additions and 33 deletions
|
@ -34,8 +34,7 @@ func (h *MessageHandler) controlRequest(id string, session types.Session) error
|
|||
// check for host
|
||||
if !h.sessions.HasHost() {
|
||||
// check if control is locked or user is admin
|
||||
_, ok := h.Locked["control"]
|
||||
if ok && !session.Admin() {
|
||||
if h.state.IsLocked("control") && !session.Admin() {
|
||||
h.logger.Debug().Msg("control is locked")
|
||||
return nil
|
||||
}
|
||||
|
@ -98,8 +97,7 @@ func (h *MessageHandler) controlGive(id string, session types.Session, payload *
|
|||
}
|
||||
|
||||
// check if control is locked or giver is admin
|
||||
_, ok := h.Locked["control"]
|
||||
if ok && !session.Admin() {
|
||||
if h.state.IsLocked("control") && !session.Admin() {
|
||||
h.logger.Debug().Msg("control is locked")
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue