🐛 Bug Report: discord-command-bot Python build fails in setup.py

Đang mở
#491 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, nodejs, python
Lĩnh vực
api, backend

Hướng nghiên cứu

Start with python/discord_command_bot/src/setup.py and compare the Go and Node.js template build steps; the issue identifies the failing relative import and the request body content type. Check how the build invokes setup.py and how Node.js registers its command. Done means the Python build completes and sends JSON, and the Go command is registered during build or its manual registration requirement is documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug python

Summary

The Python variant of discord-command-bot fails to build, so it never registers its slash command.

Details

  • Appwrite builds this variant with pip install -r requirements.txt && python src/setup.py. The config is in app/config/templates/function.php in appwrite/appwrite.
  • python/discord_command_bot/src/setup.py starts with from .utils import throw_if_missing. A relative import fails when the file runs as a script (ImportError: attempted relative import with no known parent package), so the build fails.
  • With the import fixed, the request still sends form data under a JSON content type: requests.post(..., data={...}, headers={"Content-Type": "application/json"}). Discord expects a JSON body, so this should be json={...}.
  • The Go variant's build command is empty, so it doesn't register the command during the build the way the Node.js variant does (npm run setup).

Suggested fix

  • Use an absolute import (or run the script as a module) and json= in setup.py.
  • Add a registration step for Go, or document that the command must be registered manually.

Notes

This turned up while adding templates to the appwrite.io integrations catalog. The catalog page points readers to the Node.js runtime for now.

cc @adityaoberai

Ngôn ngữ chính
HTML
Star
174
Fork
129
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của appwrite/templates

Tất cả issue của appwrite/templates

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.