Skip to content

Repository files navigation

SC Sub Poster (Kether.pl Steam Client Library)

A Rust library that provides a wrapper around the steam-vent crate for logging in to Steam and operating on the Steam Group Chats.

Actually all we need just to post !sub requests on our Steam Group Chat ;)

Usage

Here's a basic example of how to use this library to login to Steam and send messages:

use std::{env, error::Error};useSC_Sub_Poster::{LogOn,ChatRoomClient};#[tokio::main]asyncfnmain() -> Result<(),Box<dynError>>{// Initialize logging
tracing_subscriber::fmt::init();// Create a client using credentials from environment variableslet account = env::var("STEAM_ACCOUNT").expect("STEAM_ACCOUNT not set");let password = env::var("STEAM_PASSWORD").expect("STEAM_PASSWORD not set");// Login to Steamlet logon = LogOn::new(&account,&password).await?;println!("✓ Login successful! Steam ID: {}", logon.steam_id().steam3());let snapshot = logon.session_snapshot();println!("Session cell id: {}", snapshot.cell_id);// Create chat room clientlet chat_client = ChatRoomClient::new(logon.connection().clone());// Get your chat roomslet chat_rooms = chat_client.groups().get_my_chat_rooms().await?;println!("Found {} chat rooms", chat_rooms.len());// Send a message to a specific group chatlet group_id:u64 = 6887767;// Replace with your group IDlet chat_id:u64 = 22190790;// Replace with your chat IDlet message = "Hello from Rust!";let response = chat_client
.messaging().send_group_message(group_id, chat_id, message,true).await?;println!("✓ Message sent successfully!");println!("Modified message: {}", response.modified_message);Ok(())}

Environment Variables

Set these environment variables before running:

export STEAM_ACCOUNT="your_steam_username"export STEAM_PASSWORD="your_steam_password"export CHAT_GROUP_ID="your_group_id"# Optionalexport CHAT_ID="your_chat_id"# Optional

Features

  • Message Preprocessing: Automatically processes BBCode formatting and mentions
  • Mention Support: Handle @all, @here, and [U:1:xxxxx] SteamID mentions with serde-safe wrappers
  • Real-time Listening: Listen for incoming friend and group messages with error-aware callbacks
  • Enhanced Messages: Get detailed information about processed messages, including immutable session snapshots
  • Message Deletion: Delete group chat messages by (server_timestamp, ordinal) or directly from PreprocessedMessage send responses
  • Message Reactions: Add and remove emoticon or sticker reactions, list reactors, fetch reaction summaries from message history, and listen for real-time reaction events
  • Chat Groups: List chat groups and their rooms via get_my_chat_groups, returning structured ChatGroupInfo with nested ChatRoomInfo
  • Tracing Spans: Built-in tracing instrumentation for logon, chat dispatch, preprocessing, deletion, and reactions

For more advanced usage, see the examples/chat_demo.rs file.

Error Handling

  • LogOn::new and LogOn::new_anonymous return a boxed LogonError that can be downcast for retry hints (ErrorInventoryEntry).
  • Notification loops expose listen_for_*_messages_with helpers that bubble transport failures rather than silently retrying forever.

Dependencies

This library depends on:

  • steam-vent - Steam network interaction
  • tokio - Async runtime
  • tracing - Logging
  • serde - Serialization

License

LGPL-3.0-only

However, the author requests in good faith that it not be used for military, surveillance, or malicious purposes.

About

Minimal port of NodeJS steam-user library to Rust just for sending messages to group chats

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages