Skip to main content

csp bot commands

Miscellaneous commands for csp-bot

Build Status codecov License PyPI

Overview

This package contains fun, testing, and utility commands for csp-bot.

Command Type Description
/slap, /trout fun Slap someone with a wet trout
/mets utility Get information about the NY Mets baseball team, including roster, players, and schedule information
/thanks fun Thank another user with a random object or cash
/_fun fun Randomly generated/selected quotes or trivia
/delaytest test Tester command for delayed/repeated commands
/choose, /pick utility Pick one supplied option at random
/convert utility Convert common units of length, mass, volume, duration, and temperature
/time utility Convert a date and time between timezones
/epoch utility Convert Unix seconds to an ISO datetime and back
/uuid utility Generate a random version 4 UUID
/json utility Validate and pretty-print JSON
/count utility Count characters, words, and lines

Commands with two names answer to both. /help lists the commands by type, and /help <command> shows a command's usage, arguments, and examples.

Any of these commands can be included in a csp-bot configuration following the documentation:

# @package _global_
defaults:
  - /gateway: slack
  - _self_

bot_name: CSP Bot
app_token: .slack_app_token
bot_token: .slack_bot_token

gateway:
  _target_: csp_bot.Gateway
  modules:
    - /modules/bot
  commands:
    - /commands/help
    - _target_: csp_bot_commands.ChooseCommandModel
    - _target_: csp_bot_commands.ConvertCommandModel
    - _target_: csp_bot_commands.CountCommandModel
    - _target_: csp_bot_commands.DelayTestCommandModel
    - _target_: csp_bot_commands.EpochCommandModel
    - _target_: csp_bot_commands.FunCommandModel
    - _target_: csp_bot_commands.JsonCommandModel
    - _target_: csp_bot_commands.MetsCommandModel
    - _target_: csp_bot_commands.ThanksCommandModel
    - _target_: csp_bot_commands.TimeCommandModel
    - _target_: csp_bot_commands.TroutSlapCommandModel
    - _target_: csp_bot_commands.UuidCommandModel

Utility commands

These commands use Python's standard library. They require no API keys, network services, or agent extra.

/choose

/choose <option> <option> [<option> ...] returns one randomly selected option. At least two nonempty options are required. Double quotes group an option containing spaces:

/choose pizza "fish and chips" sushi

/convert

/convert <value> <unit> [to] <unit> converts between units of the same quantity. The to is optional, and the target unit can also be given as to=km or --to km. Unit names are case-insensitive. Results show up to ten significant digits.

Quantity Units
Length mm, cm, m, km, in, ft, yd, mi
Mass mg, g, kg, oz, lb
Volume ml, l
Duration ms, s, min, h, day
Temperature c, f, k

oz means mass ounces. A day is 24 hours. Nonfinite numbers, unknown units, incompatible quantities, and results outside the numeric range return an error.

/convert 10 mi to km
/convert 32 F to C
/convert 90 min to h

/time

/time <YYYY-MM-DDTHH:MM|now> <source-zone> [in] <target-zone> [<target-zone> ...] shows the source and target times with dates and UTC offsets. Timezones use IANA names such as America/New_York, Europe/London, and Asia/Tokyo; UTC is also accepted. now uses the current instant.

Explicit times are local to the source timezone, without an offset in the input. Times skipped or repeated by a daylight saving transition return an error; UTC input identifies an instant when a local time is ambiguous.

/time 2026-11-22T09:00 America/New_York in Europe/London Asia/Tokyo
/time now UTC in America/New_York

/epoch

/epoch <unix-seconds|ISO-datetime> converts in either direction. Unix timestamps are seconds since 1970-01-01T00:00:00Z, including negative and fractional values. Output datetimes use UTC with a Z suffix. ISO input requires an explicit offset; host-local time is never inferred. Conversion supports microsecond precision and datetime years 1-9999. Timestamp values beyond that range or precision return an error.

/epoch 0
/epoch 1234567890.123456
/epoch 1970-01-01T05:30:00+05:30

The first and last examples return 1970-01-01T00:00:00Z and 0, respectively.

/uuid

/uuid generates one random version 4 UUID in the standard hyphenated format. It accepts no arguments.

/json

/json <JSON> validates JSON and formats it with two-space indentation. JSON is pasted directly after the command; quotes, internal whitespace, and embedded /room or mention text are preserved as data. Objects, arrays, and scalar JSON values are accepted. Invalid JSON and nonfinite numbers return an error.

/json {"message": "hello world", "items": [1, 2, 3]}

Formatted output up to 1,500 characters appears in a code block. Larger output is attached as formatted.json, using the backend's file-upload support.

/count

/count <text> reports Unicode code points, whitespace-separated words, and lines. Quotes are literal text. Internal whitespace and line breaks are preserved; whitespace surrounding the command payload is trimmed by the bot.

/count hello  world

This example reports 12 characters, two words, and one line. /json and /count require csp-bot support for the command class's raw_args option.

Agent commands and MCP

Install csp-bot-commands[agent] to enable /ask (also /ai) and /summarize (also /summary and /tldr). Both command models accept model_name and optional mcp_servers alongside the local chat tools:

_target_: csp_bot_commands.AskCommandModel
model_name: "anthropic:<model>"
mcp_servers:
  - url: https://tools.example.com/mcp
    prefix: knowledge
    headers_env:
      Authorization: KNOWLEDGE_MCP_AUTH
    tools: [search]
    timeout: 60

Use SummarizeCommandModel for the same configuration on /summarize; it still requires a connected chat backend to read channel history. Omit mcp_servers to use only the local tools.

URLs must use HTTPS. headers_env maps HTTP headers to environment variables; each variable contains the full header value, including Bearer when required. tools restricts the server tools exposed to the agent, and prefix distinguishes tools from different servers. Remote servers enforce their own authorization; local chat access policies do not apply to external tools.

Metadata

Release files for csp-bot-commands 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csp-bot-commands 2.3.0
File Size Uploaded Provenance Actions
csp_bot_commands-2.3.0.tar.gz 55.8 kB Without provenance Details for csp_bot_commands-2.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for csp-bot-commands 2.3.0
File Interpreter ABI Platform Actions
csp_bot_commands-2.3.0-py3-none-any.whl Python 3 none any Details for csp_bot_commands-2.3.0-py3-none-any.whl

Total release size: 122.3 kB

Release files / csp_bot_commands-2.3.0.tar.gz

Download URL csp_bot_commands-2.3.0.tar.gz
Size 55.8 kB
Tags Source
SHA-256 checksum
How to use checksums
317bb09b93a50db6d8b7456966d2d908a6870136cdd67e617cd7e846c789054f
BLAKE2b-256 checksum
How to use checksums
9be7ae078217b957c0e34d55436a8d18b599faf85a7c7446b16378622acfb52f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / csp_bot_commands-2.3.0-py3-none-any.whl

Download URL csp_bot_commands-2.3.0-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05548585615a3977772d03c392733e9315d05fefd9e43132a2f5e0a928e698f1
BLAKE2b-256 checksum
How to use checksums
5a8f13afc1a714a077e011f2939c387c953c9119a82405ddabe889ce088cd253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for csp-bot-commands 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page