mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
set host catch error.
This commit is contained in:
parent
2b0d85a98c
commit
95ce0063ec
@ -66,7 +66,10 @@ func (h *MessageHandler) adminControl(id string, session types.Session) error {
|
|||||||
|
|
||||||
host, ok := h.sessions.GetHost()
|
host, ok := h.sessions.GetHost()
|
||||||
|
|
||||||
h.sessions.SetHost(id)
|
if err := h.sessions.SetHost(id); err != nil {
|
||||||
|
h.logger.Warn().Err(err).Msgf("SetHost failed")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
if err := h.sessions.Broadcast(
|
if err := h.sessions.Broadcast(
|
||||||
@ -138,7 +141,10 @@ func (h *MessageHandler) adminGive(id string, session types.Session, payload *me
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set host
|
// set host
|
||||||
h.sessions.SetHost(payload.ID)
|
if err := h.sessions.SetHost(payload.ID); err != nil {
|
||||||
|
h.logger.Warn().Err(err).Msgf("SetHost failed")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// let everyone know
|
// let everyone know
|
||||||
if err := h.sessions.Broadcast(
|
if err := h.sessions.Broadcast(
|
||||||
|
@ -35,7 +35,10 @@ func (h *MessageHandler) controlRequest(id string, session types.Session) error
|
|||||||
// check for host
|
// check for host
|
||||||
if !h.sessions.HasHost() {
|
if !h.sessions.HasHost() {
|
||||||
// set host
|
// set host
|
||||||
h.sessions.SetHost(id)
|
if err := h.sessions.SetHost(id); err != nil {
|
||||||
|
h.logger.Warn().Err(err).Msgf("SetHost failed")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// let everyone know
|
// let everyone know
|
||||||
if err := h.sessions.Broadcast(
|
if err := h.sessions.Broadcast(
|
||||||
@ -89,7 +92,10 @@ func (h *MessageHandler) controlGive(id string, session types.Session, payload *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set host
|
// set host
|
||||||
h.sessions.SetHost(payload.ID)
|
if err := h.sessions.SetHost(payload.ID); err != nil {
|
||||||
|
h.logger.Warn().Err(err).Msgf("SetHost failed")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// let everyone know
|
// let everyone know
|
||||||
if err := h.sessions.Broadcast(
|
if err := h.sessions.Broadcast(
|
||||||
|
Loading…
Reference in New Issue
Block a user