forked from hippoz/brainlet
23 lines
No EOL
779 B
JavaScript
23 lines
No EOL
779 B
JavaScript
const Client = require('./index');
|
|
|
|
const main = async () => {
|
|
const client = new Client('http://localhost:3000', {
|
|
throwErrors: true
|
|
});
|
|
|
|
await client.setToken('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InVzZXIiLCJpYXQiOjE2MDcxNzkyMzAsImV4cCI6MTYwNzE5MDAzMH0.X7KJA-8KmcdwTORXXVZcQTId3iz4_c7H7FYgF2X6nq8');
|
|
|
|
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, {
|
|
username: e.author.username
|
|
});
|
|
});
|
|
});
|
|
};
|
|
|
|
main(); |