aboutsummaryrefslogtreecommitdiff
path: root/node_modules/discord.js/test/shard.js
blob: 6021a18c925325dc8cdb61acfb067d8cdd5aefab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const Discord = require('../');
const { token } = require('./auth.json');

const client = new Discord.Client({
  shardId: process.argv[2],
  shardCount: process.argv[3],
});

client.on('message', msg => {
  if (msg.content.startsWith('?eval') && msg.author.id === '66564597481480192') {
    try {
      const com = eval(msg.content.split(' ').slice(1).join(' '));
      msg.channel.sendMessage('```\n' + com + '```');
    } catch (e) {
      msg.channel.sendMessage('```\n' + e + '```');
    }
  }
});

process.send(123);

client.on('ready', () => {
  console.log('Ready', client.options.shardId);
  if (client.options.shardId === 0)
    setTimeout(() => {
      console.log('kek dying');
      client.destroy();
    }, 5000);
});

client.login(token).catch(console.error);