Repository navigation
API Chat
| Import | from proleak import chat |
Chat commands and messages.
| Class | |
|---|---|
Command |
A chat command as typed by the player: !name arg1 arg2. |
| 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. |
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(text: str, color: str | None = None) -> None
Show a line in your own chat only. color is "#rrggbb" (default: normal chat colour).
send(text: str) -> None
Send a chat message as the player. Needs the actions capability.
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). |
name: str
The command's name, without the prefix.
args: list[str]
The words after the name.
raw: str
Everything after the name, as typed.
owner: str
The id of the plugin that registered it.
reply(text: str, color: str | None = None) -> None
Answer in the player's own chat (nobody else sees it). color is "#rrggbb".
Using ProLeak
Features
Tutorial
- Your first plugin
- Plugin basics
- Handling events
- Plugin settings
- User interface
- Players, units and game data
- Purchases, signals and pings
- Chat, camera, input and more
- Game assets
- Game modes
- Game updates
- Publishing plugins
Reference