Discord channel for Bub
Project description
bub-discord
Discord channel adapter for bub.
What It Provides
- Channel implementation:
DiscordChannel(name = "discord") - Inbound message adaptation from Discord to Bub
ChannelMessage - Outbound sending to Discord channels with:
- automatic chunking at Discord's 2000-character limit
- reply-to-latest-message behavior per session
Installation
uv pip install bub-discord
You can also install it with Bub:
bub install bub-discord@main
Configuration
DiscordChannel reads settings from environment variables with the BUB_DISCORD_ prefix.
BUB_DISCORD_TOKEN(required): Discord bot tokenBUB_DISCORD_ALLOW_USERS(optional): Comma-separated allowlist of sender identifiers- Supports user ID, username, and global name
BUB_DISCORD_ALLOW_CHANNELS(optional): Comma-separated allowlist of channel IDsBUB_DISCORD_COMMAND_PREFIX(optional, default:!)BUB_DISCORD_PROXY(optional): HTTP proxy URL for Discord API
Runtime Behavior
- Session ID format:
discord:<channel_id> - Inbound messages:
- ignores bot messages
- ignores empty text messages
- applies allowlist filters when configured
- Message activation (
is_active = true) when any of these is true:- message is in DM
- message mentions the bot
- content contains
bub - content starts with
<prefix>bub - message replies to a previous bot message
- Command detection:
- if content starts with
<prefix>bub, that prefix is removed first - if remaining content starts with
,, message kind becomescommand
- if content starts with
Payload Shape
Inbound non-command messages are encoded as JSON string content, including fields like:
messagemessage_idtypeusernamefull_namesender_iddatechannel_idguild_idreply_to_message(when present)
Outbound Notes
- Uses
session_idto resolve destination channel. - Splits long messages into multiple Discord posts.
- Replies to the latest inbound message in the same session when possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bub_discord-0.0.1.tar.gz
(8.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bub_discord-0.0.1.tar.gz.
File metadata
- Download URL: bub_discord-0.0.1.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d442655e20d902c2a7341881f0db18df745a9c9e6c298e1742ef1806188bc885
|
|
| MD5 |
e8d790248851d653c1378396faaa30ec
|
|
| BLAKE2b-256 |
207d73ffe95431ce2e17ab08ab90c6d5638c9977fd23d0ce4f1319709009e1d2
|
File details
Details for the file bub_discord-0.0.1-py3-none-any.whl.
File metadata
- Download URL: bub_discord-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d101dbafe6b2a5cda286b0a29b132ddace720f5e22bc871d8152537e0a0e81c
|
|
| MD5 |
022e902a42648499eb82463758fff1f6
|
|
| BLAKE2b-256 |
8a30178ce9b0ec587d106911389db7263c25ce2a0f36dfabe7872fee3a9377dc
|