aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/disconnect.js
blob: 41ca380243a16513d11a52b1af11e8d76cdb2180 (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)'
};