This guide covers advanced configuration options and usage patterns for Kick Bot, helping you fine-tune your bot's behavior and create more sophisticated integrations.
Complete Configuration Reference
Kick Bot supports numerous configuration options. Here's the complete reference:
const bot = createBot({
// Required Configuration
clientId: 'your-kick-client-id', // Kick.com OAuth client ID
clientSecret: 'your-kick-client-secret', // Kick.com OAuth client secret
skillfulApiKey: 'your-skillful-api-key', // Skillful AI API key
chatroomId: 'your-chatroom-id', // Kick.com chatroom ID
// Authentication & Server Options
redirectUri: 'http://localhost:3000/callback', // OAuth redirect URI
serverPort: 3000, // Port for the server
// AI Options
defaultAgent: 'General Assistant', // Default Skillful agent
allowAgentChanges: true, // Allow viewers to change agents
// Message Options
maxResponseLength: 500, // Maximum message length
// Logging Options
logLevel: 'info', // Log level (error/warn/info/debug/trace)
debug: false, // Enable debug mode
// Command Options
enabledCommands: ['8ball', 'imagine'] // Additional commands to enable
// Enabled / Disable the dashboard
enableDashboard: true, // Enable the web dashboard
dashboardPassword: 'your-strong-password' // The password used for access
});
Advanced AI Configuration
Working with Different AI Agents
Kick Bot integrates with Skillful AI, which allows you to create different AI agents with distinct personalities and capabilities.
// Using a specific default agent
const bot = createBot({
// Basic configuration...
defaultAgent: 'Customer Support Agent', // Use a specific agent by name
// Control whether viewers can change agents
allowAgentChanges: true // Set to false to lock to the default agent
});
// Programmatically change the agent
bot.start().then(async () => {
// Get available agents
const agents = await bot.skillfulClient.getAgents();
console.log('Available agents:', agents.map(a => a.name));
// Find a specific agent
const customAgent = await bot.skillfulClient.findAgentByName('Custom Agent');
if (customAgent) {
// Change to this agent
await bot.skillfulClient.setAgent(customAgent);
bot.activeAgent = customAgent;
console.log('Changed to agent:', customAgent.name);
}
});
Advanced Agent Change Control
You can provide fine-grained control over agent changes:
// Allow agent changes but disable specific core commands
const bot = createBot({
// Basic configuration...
allowAgentChanges: true
});
// Disable specific commands programmatically
bot.start().then(() => {
// Disable voting commands but keep agents list available
bot.disableCommand('changeagent');
bot.disableCommand('yes');
bot.disableCommand('no');
// Later, you can re-enable them
setTimeout(() => {
bot.enableCommand('changeagent');
bot.enableCommand('yes');
bot.enableCommand('no');
console.log('Agent voting is now enabled');
}, 30 * 60 * 1000); // Enable after 30 minutes
});
Advanced Logging
KickBot uses a customizable logging system that allows different levels of verbosity for different components.
// Configure logging during bot creation
const bot = createBot({
// Basic configuration...
logLevel: 'debug', // Set the global log level
debug: true // Shorthand for enabling debug mode
});
// Access component loggers
bot.start().then(() => {
// Log a message using the main logger
bot.logger.info('Bot started successfully');
// Use component-specific loggers
bot.wsLogger.debug('WebSocket connection details...');
bot.authLogger.info('Authentication status...');
// Create a custom component logger
const myLogger = bot.logger.createComponentLogger('MyModule');
myLogger.info('Custom component initialized');
});
Available Log Levels
error: Only critical errors
warn: Errors and warnings
info: General information (default)
debug: Detailed information for debugging
trace: Very verbose, includes all details
Event System
Kick Bot provides an event system that lets you respond to various occurrences:
// Register event handlers
bot.on('message', (messageData) => {
console.log(`Chat message from ${messageData.username}: ${messageData.content}`);
});
bot.on('command', (commandData) => {
console.log(`Command executed: !${commandData.command} by ${commandData.username}`);
});
bot.on('connected', (connectionData) => {
console.log(`Connected to channel: ${connectionData.channel}`);
});
bot.on('error', (errorData) => {
console.error(`Error (${errorData.type}): ${errorData.message}`);
});
// Start the bot after registering handlers
bot.start();
Command Manager Advanced Usage
The Command Manager provides powerful tools for managing commands:
// Access the Command Manager after bot creation
const { commandManager } = bot.messageHandler;
// Get all registered commands
const allCommands = commandManager.getAllCommands();
console.log('Registered commands:', Array.from(allCommands.keys()));
// Get all enabled commands
const enabledCommands = commandManager.getEnabledCommands();
console.log('Enabled commands:', Array.from(enabledCommands.keys()));
// Check if a specific command is enabled
const isHelpEnabled = commandManager.isEnabled('help');
console.log('Help command enabled:', isHelpEnabled);
// Enable/disable commands programmatically
commandManager.enable('8ball');
commandManager.disable('8ball');
// Work with command state
commandManager.setCommandState('mycommand', 'mykey', 'myvalue', 3600000); // TTL: 1 hour
const value = commandManager.getCommandState('mycommand', 'mykey');
Dynamic Command Registration
You can dynamically register and manage commands at runtime: