We currently provide a javascript library to interact with the chat through a bot.
npm install @piczel/chat-client
pong to anyone who says !ping
import { Client } from '@piczel/chat-client';
// Get your bot token from your account settings, under "Chat bots" (once approved)
const client = new Client('YOUR_BOT_TOKEN');
client.on('connected', async () => {
const room = await client.joinRoom('piczel-help');
// Greet the room
room.sendMessage('Hello! I am a bot.');
// React to incoming messages
room.on('message', (message) => {
console.log(message.user.username + ': ' + message.text);
if (message.text === '!ping') {
room.sendMessage('pong');
}
});
});
client.connect();