Two kinds of program can act on Piczel, both managed in your token settings: a personal token lets a program act as you, and a bot connects to chat under its own identity.
Create one with a Name and, optionally, an Expires At date; empty means permanent. The token is shown once, when it is created - copy it then. If you lose it, delete the token and make another.
A token acts as you: anything you can do through the API, whatever holds the token can do. Give each program its own token so you can revoke one without breaking the rest, and delete tokens you no longer recognize.
On the same page, create a bot with a name, a description of what it will do, and an avatar. New bots are held for approval, so it will show as pending until staff review it. Once approved, Show API Key reveals the token it connects with. Treat that key like a password.
Install our demo client:
npm install @piczel/chat-client
A bot that joins a room, greets it, and replies to !ping:
import { Client } from '@piczel/chat-client';
const client = new Client('YOUR_BOT_TOKEN');
client.on('connected', async () => {
const room = await client.joinRoom('yourusernamehere');
room.sendMessage('Hello! I am a bot.');
room.on('message', (message) => {
console.log(message.user.username + ': ' + message.text);
if (message.text === '!ping') {
room.sendMessage('pong');
}
});
});
client.connect();
A bot is subject to the same room rules as anyone else, and rule violations by bots will lead to punishment of the bot owner.