Discord.py style async library for Karrot chat
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
karrot.py
Discord.py 스타일의 당근마켓 채팅 비동기 라이브러리
설치
pip install aiohttp websockets
사용법
import asyncio
from karrot import Client, Message
client = Client(command_prefix="!")
@client.event
async def on_ready():
print(f"로그인: {client.user_id}")
@client.event
async def on_message(message: Message):
print(f"[{message.sender_nickname}] {message.text}")
# 자신의 메시지에만 명령어 처리
if message.sender_id == client.user_id:
await client.process_commands(message)
@client.command("안녕", aliases=["hi", "hello"])
async def hello_command(message: Message, args: str):
await message.reply("안녕하세요!")
@client.command("도움말", aliases=["help", "?"])
async def help_command(message: Message, args: str):
help_text = """
📋 명령어 목록
!안녕 - 인사
!도움말 - 도움말
"""
await message.reply(help_text)
client.run("YOUR_TOKEN_HERE")
주요 기능
Client
client = Client(
command_prefix="!", # 명령어 접두사
region="kr", # 지역 (kr, jp, ca, uk, us)
auto_reconnect=True # 자동 재연결
)
이벤트
on_ready()- 연결 완료on_message(message)- 새 메시지on_notification(notification)- 알림on_disconnect()- 연결 해제
명령어
@client.command("명령어", aliases=["별칭1", "별칭2"], description="설명")
async def my_command(message: Message, args: str):
# args: 명령어 뒤의 인자 (예: "!명령어 인자" -> args = "인자")
await message.reply("응답")
메시지
# 답장
await message.reply("텍스트")
# 채널로 전송
await client.send_message(channel_id, "텍스트")
채널
# 모든 채널
channels = client.channels
# ID로 채널 찾기
channel = client.get_channel_by_id(channel_id)
# 채널 정보
channel.display_name # 표시 이름
channel.type # ChannelType.DIRECT 또는 ChannelType.GROUP
토큰 얻기
- 당근마켓 웹 (https://karrotmarket.com) 로그인
- 개발자 도구 (F12) → Network 탭
chat.daangn요청 찾기- Request Headers에서
Authorization: Bearer ...값 복사
라이선스
MIT
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
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 karrot-0.1.0.tar.gz.
File metadata
- Download URL: karrot-0.1.0.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34f01f50334e2a78c2186bb611642354301c1909be5a93c3ebd6fccf7ea8b616
|
|
| MD5 |
acb5f2867175efd702ada06a92c7b773
|
|
| BLAKE2b-256 |
24c7892e1454d9b6251cc117a7df6dbacfebefb71bd085066fa6896e9da666e1
|
Provenance
The following attestation bundles were made for karrot-0.1.0.tar.gz:
Publisher:
workflow.yml on deongdion/karrot.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
karrot-0.1.0.tar.gz -
Subject digest:
34f01f50334e2a78c2186bb611642354301c1909be5a93c3ebd6fccf7ea8b616 - Sigstore transparency entry: 841097201
- Sigstore integration time:
-
Permalink:
deongdion/karrot.py@159ef5a55a586dba7d121f1270074c12389f13d8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/deongdion
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@159ef5a55a586dba7d121f1270074c12389f13d8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file karrot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: karrot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de9a4123706128cafeddc9846bfb8859845c4299e70985c14c8d04950c94bd29
|
|
| MD5 |
b625512d090f2d771caea0943d3da414
|
|
| BLAKE2b-256 |
824d4f0b183b2be6caac3ddfb2c1d14e1a7da1449c0c29330f859f2f812d0a29
|
Provenance
The following attestation bundles were made for karrot-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on deongdion/karrot.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
karrot-0.1.0-py3-none-any.whl -
Subject digest:
de9a4123706128cafeddc9846bfb8859845c4299e70985c14c8d04950c94bd29 - Sigstore transparency entry: 841097223
- Sigstore integration time:
-
Permalink:
deongdion/karrot.py@159ef5a55a586dba7d121f1270074c12389f13d8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/deongdion
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@159ef5a55a586dba7d121f1270074c12389f13d8 -
Trigger Event:
release
-
Statement type: