const Client = require('./index'); const main = async () => { const client = new Client('http://localhost:3000', { throwErrors: true }); await client.setToken('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InVzZXIiLCJpYXQiOjE2MDcxOTE5NjAsImV4cCI6MTYwNzIwMjc2MH0.dfI6CMeDNck-ubqwEmiMFdHbRR4iiuooeTuzgVc_8rY'); await client.gatewayConnect(); client.gateway.on('connect', () => { client.gateway.subscribeToCategoryChat('5fc829314e96e00725c17fd8'); client.gateway.on('message', (e) => { if (e.author._id === client.user._id) return; client.gateway.sendMessage('5fc829314e96e00725c17fd8', e.content, { nickAuthor: {username: e.author.username}, //destUser: {_id: e.author._id} }); }); }); }; main();