Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Modules
const Hiven = require('hiven.js');
const Client = new Hiven.Client();
Client.on('INIT_STATE', () => {
console.log(`Ready, connected as ${Client.user.username} (${Client.user.id})`);
});
Client.on('MESSAGE_CREATE', msg => {
console.log(`MSG : [${msg.room.name}@${msg.house.name}] ${msg.author.username}: ${msg.content}`);
});
Client.connect('noTokenForU');
/**
* A bot that will post in a room when a user joins
*/
// Modules
const Hiven = require('hiven.js');
// Remember to put { clientType: 'user' } in this function call to enable user accounts
const Client = new Hiven.Client();
// This event is emitted when the client successfully authenticates
Client.on('INIT_STATE', () => {
console.log(`Ready, connected as ${Client.user.username} (${Client.user.id})`);
});
// This event is emitted when a user joins a house
Client.on('HOUSE_MEMBER_JOIN', async member => {
let room = await Client.rooms.resolve('55494222333080793');
if (member.house.id !== room.house.id) return;
console.log(`New member in house ${member.house.name}`);
room.send(`New member joined: @\`${member.username}\`\nName: \`${member.name}\`\nID: \`${member.id}\``);
});
/**
* A bot that responds Pong when you send ping.
*/
// Modules
const Hiven = require('hiven.js');
// Remember to put { clientType: 'user' } in this function call to enable user accounts
const Client = new Hiven.Client();
// This event is emitted when the client successfully authenticates
Client.on('INIT_STATE', () => {
console.log(`Ready, connected as ${Client.user.username} (${Client.user.id})`);
});
// This event is emitted when the client receives a message
Client.on('MESSAGE_CREATE', msg => {
if (msg.content.toLowerCase() == '!ping') {
msg.room.send('Pong!');
}
});
// Connect to hiven using a token
Client.connect('token_here');
/**
* A bot that will show you how to send, update and delete messages
*/
// Modules
const Hiven = require('hiven.js');
// Remember to put { clientType: 'user' } in this function call to enable user accounts
const Client = new Hiven.Client();
// This event is emitted when the client successfully authenticates
Client.on('INIT_STATE', () => {
console.log(`Ready, connected as ${Client.user.username} (${Client.user.id})`);
});
// This event is emitted when the client receives a message
Client.on('MESSAGE_CREATE', async msg => {
if (msg.content.toLowerCase() == '!delete') {
let message = await msg.room.send(`Deleting this message in like 5 seconds`);
setTimeout(async () => {
await message.delete();
}, 5000);
}