bostie¶
bostie는 게이트웨이, HTTP 클라이언트, 음성 엔진이 Rust로 동작하는 Python용 Discord 라이브러리입니다. 봇은 타입이 지정된 비동기 Python으로 작성합니다.

프리알파
bostie의 API는 아직 바뀔 수 있습니다. 현재 슬래시 명령어, 사용자 명령어, 메시지 명령어, 컴포넌트, 모달, 게이트웨이 이벤트, 캐시, REST, 웹후크, HTTP 인터랙션, OAuth2, 음성 재생과 수신이 동작합니다.
import bostie
from bostie import ComponentContext, Context, ui, voice
bot = bostie.Bot()
@bot.command
async def play(ctx: Context, url: str) -> None:
"""Play a direct media URL in your voice channel."""
vc = ctx.voice.current or await ctx.voice.connect()
await vc.play(voice.Url(url))
stop = ui.button("Stop", custom_id=stop_playing.id(guild_id=vc.guild_id))
await ctx.respond(components=[ui.text(f"Playing <{url}>"), ui.row(stop)])
@bot.on_component("stop:{guild_id:int}")
async def stop_playing(ctx: ComponentContext, guild_id: int) -> None:
if (vc := bot.voice.get(guild_id)) is not None:
vc.stop()
await ctx.update(components=[ui.text("Stopped.")])
bot.run()
/play는 명령어를 실행한 사용자가 있는 음성 채널에 들어가 URL을 스트리밍하고, Stop 버튼과 함께 응답합니다. 버튼의 커스텀 ID에는 서버 ID가 들어 있고 @bot.on_component가 이를 다시 int로 파싱하므로, 봇을 재시작한 뒤에도 버튼이 계속 동작합니다. bot.run()은 BOSTIE_TOKEN 환경 변수에서 토큰을 읽고, 명령어가 바뀌었으면 Discord에 보냅니다.
AI 코딩 어시스턴트를 사용하시나요?
bostie 스킬을 설치하면 코딩 어시스턴트가 bostie 작업을 더 잘 처리합니다. 프롬프트를 복사해 코딩 어시스턴트에 붙여 넣으세요. 스킬 자세히 알아보기
bostie 스킬 설치하기
Install the bostie skill for my coding agent so it writes correct bostie code: Discord bots with slash commands, components, events, REST calls, voice and tests.
Use the Agent Skills installer with the bostie repository, https://github.com/nicokim/bostie:
npx skills add nicokim/bostie --skill bostie --yes
If I ask for a global install instead, use:
npx skills add nicokim/bostie --skill bostie --yes --global
Detect which agent or editor I am using. If it is one of these and I prefer the plugin path, install the bostie plugin instead, as https://bostie.dev/ko/assistants/ shows:
Claude Code: /plugin marketplace add nicokim/bostie, then /plugin install bostie@bostie
Codex CLI: codex plugin marketplace add nicokim/bostie, then codex plugin add bostie@bostie
GitHub Copilot CLI: copilot plugin marketplace add nicokim/bostie, then copilot plugin install bostie@bostie
VS Code with GitHub Copilot: run "Chat: Install Plugin from Source" and enter nicokim/bostie
Devin: devin plugins install nicokim/bostie#docs
Factory Droid: droid plugin marketplace add nicokim/bostie, then droid plugin install bostie@bostie --scope user
Qwen Code: qwen extensions install nicokim/bostie:bostie
Do not invent other skill names or install URLs.
Then add this line to the instructions file you read at the start of every session (AGENTS.md at the project root, or your global one for a global install), and create the file if needed:
Before you write or change code that uses bostie, look at how the project is laid out, then load the bostie skill.
After installing, confirm that the bostie skill is available to you.
설계 목표¶
음성¶
Discord는 2026년 3월 1일부터 종단 간 암호화된 통화(DAVE)만 허용합니다. bostie의 음성 엔진은 GIL 밖의 Rust 스레드에서 20 ms 클록, 디코딩, 믹싱, Opus 인코딩, 전송 암호화, DAVE를 처리합니다. Python은 각 싱크의 버퍼만 채워 두면 되며, 기본값은 오디오 0.2초 분량입니다. bostie는 파일, URL, HLS 스트림, 직접 만든 PCM이나 Opus를 재생하고, 여러 소스를 믹싱하며, 화자별로 따로 수신하고, 통화를 녹음합니다.
Discord가 바뀌어도 살아남는 봇¶
알 수 없는 필드, 열거형 값, 컴포넌트 타입, 인터랙션 타입이 와도 디코딩이 깨지지 않습니다. 모든 이벤트와, 페이로드 전체에서 디코딩한 모든 모델은 원시 JSON을 보관합니다. bostie가 아직 모델링하지 않은 기능은 bot.http와 원시 이벤트 리스너로 다룰 수 있습니다.
Discord 문서와 일치하는 타입¶
Discord가 항상 보내는 필드는 절대 None이 아니며, 부분 객체에는 별도의 클래스가 있습니다. 명령어 옵션에서 해석된 멤버는 ResolvedMember이고, 여기에는 deaf나 mute가 없습니다.
시그니처로 만드는 명령어¶
옵션, 선택지, 범위, 자동 완성은 타입 힌트에서 만들어집니다. 이름, 설명, 옵션 개수, 선택지가 Discord의 제한을 지키는지는 Discord가 동기화를 거부할 때가 아니라 데코레이터가 실행될 때 검사합니다.
Discord 없이 하는 테스트¶
bostie.testing.FakeDiscord는 실제 봇을 그대로 연결해 실행할 수 있는 로컬 게이트웨이 겸 REST API입니다.