| Crates.io | kick-rust |
| lib.rs | kick-rust |
| version | 0.1.0 |
| created_at | 2025-10-22 02:38:13.307723+00 |
| updated_at | 2025-10-22 02:38:13.307723+00 |
| description | A Rust library for interacting with Kick.com WebSocket chat and API |
| homepage | https://github.com/nglmercer/kick-rust |
| repository | https://github.com/nglmercer/kick-rust |
| max_upload_size | |
| id | 1894836 |
| size | 229,386 |
A Rust library for interacting with Kick.com WebSocket chat and API. This library provides a simple and robust way to connect to Kick.com chat rooms, receive real-time messages, and interact with the Kick.com API.
Add this to your Cargo.toml:
[dependencies]
kick-rust = "0.1.0"
use kick_rust::KickClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = KickClient::new();
// Handle chat messages
client.on_chat_message(|data| {
println!("{}: {}", data.sender.username, data.content);
}).await;
// Handle connection ready
client.on_ready(|()| {
println!("Connected to chat!");
}).await;
// Connect to a channel
client.connect("channel_name").await?;
// Keep the program running
loop {
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
}
}
use kick_rust::{KickClient, KickWebSocketOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = KickClient::with_options(KickWebSocketOptions {
auto_reconnect: true,
reconnect_interval: 5000,
enable_buffer: true,
buffer_size: 1000,
debug: true,
..Default::default()
});
// Set up event handlers
client.on_chat_message(|msg| {
println!("Chat: {} - {}", msg.sender.username, msg.content);
}).await;
client.on_user_banned(|event| {
println!("User banned: {}", event.username);
}).await;
client.on_subscription(|event| {
println!("New subscription from: {}", event.username);
}).await;
// Connect with timeout
client.connect_with_timeout("channel_name", std::time::Duration::from_secs(10)).await?;
// Your application logic here
loop {
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
}
}
use kick_rust::KickApiClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = KickApiClient::new();
// Get channel information
let channel = client.get_channel("channel_name").await?;
println!("Channel: {} ({})", channel.user.username, channel.id);
// Get chatroom information
let chatroom = client.get_chatroom("channel_name").await?;
println!("Chatroom ID: {}", chatroom.id);
Ok(())
}
The library supports various event types:
ChatMessage: Regular chat messagesMessageDeleted: When a message is deletedUserBanned: When a user is bannedUserUnbanned: When a user is unbannedSubscription: New subscriptionsGiftedSubscriptions: Gifted subscriptionsPinnedMessageCreated: When a message is pinnedStreamHost: Stream hosting eventsPollUpdate: Poll updatesPollDelete: Poll deletionsKickWebSocketOptions {
debug: false, // Enable debug logging
auto_reconnect: true, // Auto-reconnect on disconnect
reconnect_interval: 5000, // Reconnection interval in ms
enable_buffer: false, // Enable message buffer
buffer_size: 1000, // Buffer size
filtered_events: vec![], // Events to filter out
custom_user_agent: None, // Custom user agent
rotate_user_agent: true, // Rotate user agent
}
This project is licensed under either of:
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please file an issue on the GitHub repository.
Now let me check if there are license files: