Skip to content

API Chat

Alexandre 'kidev' Poumaroux edited this page Oct 21, 2026 · 5 revisions

Chat

Import from proleak import chat

Chat commands and messages.

Classes

Class
Command A chat command as typed by the player: !name arg1 arg2.

Functions

Returns Function
Callable command(name: str, fn: Callable[[Command], None] | None = None, send: bool = False) Register <prefix>name (prefix ! by default).
None say(text: str, color: str | None = None) Show a line in your own chat only.
None send(text: str) Send a chat message as the player.

Function documentation

command

command(name: str, fn: Callable[[Command], None] | None = None, send: bool = False) -> Callable

Register <prefix>name (prefix ! by default).

By default the message stays on this client: teammates never see it. send=True lets it go to the server as typed and still runs the handler.

Use as @chat.command("hello") or chat.command("hello", fn). The handler gets a Command. When two plugins register the same name, the first keeps !name and both stay reachable as !<plugin id>:name.

say

say(text: str, color: str | None = None) -> None

Show a line in your own chat only. color is "#rrggbb" (default: normal chat colour).

send

send(text: str) -> None

Send a chat message as the player. Needs the actions capability.

Command class

A chat command as typed by the player: !name arg1 arg2.

Type Property
str name The command's name, without the prefix.
list[str] args The words after the name.
str raw Everything after the name, as typed.
str owner The id of the plugin that registered it.
Returns Method
None reply(text: str, color: str | None = None) Answer in the player's own chat (nobody else sees it).

Property documentation

name

name: str

The command's name, without the prefix.

args

args: list[str]

The words after the name.

raw

raw: str

Everything after the name, as typed.

owner

owner: str

The id of the plugin that registered it.

Method documentation

reply

reply(text: str, color: str | None = None) -> None

Answer in the player's own chat (nobody else sees it). color is "#rrggbb".


Previous: Camera | Next: Errors

Clone this wiki locally