aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/disconnect.js
blob: 1a9c63542b53249109d94b6b9c64d2b611c4f1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
  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.
*/

'use strict';

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)'
};