aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/disconnect.js
blob: 9b54214a1a065bcd244077c26c81058fee0c913e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
  Description: This module will be directly called by the server event handler
               when a socket connection is closed or lost. It can calso be called
               by a client to have the connection severed.
*/

exports.run = async (core, server, socket, data) => {
  if (socket.channel) {
    server.broadcast({
      cmd: 'onlineRemove',
      nick: socket.nick
    }, { channel: socket.channel });
  }

  socket.terminate();
};

exports.info = {
  name: 'disconnect',
  description: 'Event handler or force disconnect (if your into that kind of thing)'
};