Metadata-Version: 2.4
Name: openchat-client
Version: 0.6.0
Summary: A simple terminal chat tool — join servers, chat in channels, mention people.
Author: OpenChat
License: MIT
Keywords: chat,irc,terminal,tui
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: prompt_toolkit>=3.0
Requires-Dist: certifi>=2023.0.0
Requires-Dist: dnspython>=2.0
Dynamic: license-file

# openchat

A simple, no-frills terminal chat tool. Think tiny IRC: you make one account,
join servers by id or `ip:port`, hop between channels, and `@mention` people.

```bash
pip install open-chat-client
chat
```

That's it — running `chat` opens the start menu. (The distribution is named
`open-chat-client` on PyPI; the command it installs is `chat`.)

## What you get

- **One central account.** Sign up / log in against the registry website
  (chat.sushii.dev by default) on first run. The client stores a login **token**
  (not your password) in `~/.openchat/config.json`, and that one account logs you
  into every server you join.
- **A start menu** to join communities, browse the ones you've joined, and
  change settings.
- **Channels** — switch with `/join <channel>`, see them in the sidebar.
- **Direct messages** — `/dm <user>` opens a private thread; DM threads show up
  in the sidebar and are delivered later if the person is offline.
- **History** — recent messages (per channel *and* per DM thread) are kept by
  the server, so you see scrollback when you join or reopen a thread.
- **Mentions** — type `@name`; when someone mentions *you* it lights up.
- **Roles** — owner, admin, member. Admins can create/delete channels, assign
  roles, and kick.
- **Bots / webhooks** — admins can create a webhook URL for a channel; anyone
  can `POST` JSON to it to post messages as a bot (Discord-style).

## Joining a server

From the menu pick **Join a community** and enter either:

- a raw address like `203.0.113.5:6767`,
- a **domain** like `chat.example.com` (resolved via a `_openchat._tcp` DNS SRV
  record, so operators can publish a friendly hostname with no port), or
- a friendly id like `mountain-club` (resolved via the OpenChat registry at
  <https://chat.sushii.dev> by default — change it in Settings if you self-host).

## In-chat commands

| command | what it does |
|---------|--------------|
| `/help` | list commands |
| `/channels` | list channels |
| `/join <channel>` | switch channel |
| `/dm <user> [text]` | open a DM thread (and optionally send a message) |
| `/reply <id> <text>` | reply to a message |
| `/edit` | pick a message with ↑/↓, Enter, retype, Enter (or `/edit <id> <text>`) |
| `/del` | pick a message with ↑/↓, Enter to delete (or `/del <id>`) |
| `/who` | who's online |
| `/create <channel>` | create a channel *(admin)* |
| `/delete <channel>` | delete a channel *(admin)* |
| `/role <user> <role>` | set role: owner/admin/member *(admin)* |
| `/kick <user>` | kick a user to the start menu *(admin)* |
| `/ban <user> [reason]` / `/unban <user>` / `/bans` | bans *(admin)* |
| `/timeout <user> <secs>` / `/untimeout <user>` | temporary mute *(admin)* |
| `/webhook create <name>` | make a bot webhook URL for this channel *(admin)* |
| `/webhook list` / `/webhook delete <id>` | manage webhooks *(admin)* |
| `/rename <name>` | rename the server *(owner)* |
| `/admin` | open the owner/admin panel — a menu of all the moderation/server actions *(owner/admin)* |
| `/quit` | leave, back to the menu |

Names are colored by role (owner/admin/member), the sidebar groups members by
role and online/offline, `PageUp`/`PageDown` scroll history, and typing `@` or
`/` autocompletes usernames and commands.

**Themes & settings** — Settings has color themes (dark, dracula, nord,
solarized, matrix, rose) plus toggles for timestamps, message ids, join/leave
lines, the 24-hour clock, and the mention bell.

### Bots via webhooks

`/webhook create mybot` prints a URL. `POST` JSON to it and the message shows up
in the channel as a bot:

```bash
curl -X POST -H 'Content-Type: application/json' \
  -d '{"text":"hello from a script","username":"mybot"}' \
  http://SERVER_HOST:6768/hooks/<id>/<token>
```

Keep the URL secret — anyone with it can post to that channel.

`Ctrl-Q` also leaves the chat. `PageUp`/`PageDown` scroll the history.

## Running your own server

The server is a separate open-source project,
[`open-chat-server`](https://pypi.org/project/open-chat-server):

```bash
pip install open-chat-server
openchat-server --name "my server" --port 6767
```

Then anyone can `chat` → **Join a community** → `your.ip:6767`. The first
account to connect becomes the owner.

## The registry website

This repo also ships a small Flask site (in `website/`, not part of the pip
package) where you can register a community id → `host:port` so friends can join
by name instead of an IP. See `website/README.md`.

## Develop locally

```bash
pip install -e .
chat
```

## Publishing

Releases are published to PyPI automatically by
[`.github/workflows/publish.yml`](.github/workflows/publish.yml) via PyPI
Trusted Publishing. To cut a release: bump `version` in `pyproject.toml`, commit,
then tag and push:

```bash
git tag v0.1.0
git push origin v0.1.0
```

The workflow builds the sdist/wheel and publishes `open-chat-client`. See the
comments at the top of the workflow for the one-time PyPI trusted-publisher setup.

MIT licensed.
