StreamsGallery
LoginSign up

Help

  • Discord Bot
    • OBS Studio
      • Optimization
        • OBS Settings for WebRTC
          • More accurate colors
            • Piczel Markdown
              • Terms of Service
                • Privacy Policy
                  • Bots
                    • Poll Browser Source (OBS)

                      Bots

                      How to connect to the chat

                      We currently provide a javascript library to interact with the chat through a bot.

                      1. Install the javascript client library
                      npm install @piczel/chat-client
                      1. See the following reference implementation: a small bot that joins a room, greets it, and replies 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();