-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5efd2f7
commit 3d73729
Showing
103 changed files
with
19,640 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Contributing | ||
We welcome contributions to discord.http! | ||
Before you get started, please take a moment to review the following guidelines: | ||
|
||
## Testing | ||
Before submitting a pull request, ensure that your code changes have been thoroughly tested. | ||
Include relevant test cases and make sure that all existing tests pass. | ||
|
||
## Documentation | ||
Please update the documentation to reflect any changes you introduce. | ||
This includes code comments, docstrings, and README files. | ||
|
||
## Reporting Issues | ||
If you encounter any issues with discord.http, | ||
please open a GitHub issue and provide detailed information about | ||
the problem, including steps to reproduce it. | ||
|
||
## Pull Request Process | ||
1. Fork the repository and create a new branch for your feature or bug fix. | ||
2. Submit a pull request, filling in the template with a brief description of your changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Report a bug | ||
description: Use this template for reporting a bug | ||
labels: bug | ||
|
||
body: | ||
- type: input | ||
attributes: | ||
label: Summary | ||
description: Brief summary of what went wrong | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Reproduction steps | ||
description: How can we reproduce the issue you ended up with? | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: System information | ||
description: Run `python -m discord_http -v` in the terminal and paste the output. | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Anything else? | ||
description: Something we need to know that was not an option above? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Description | ||
|
||
<!-- Briefly describe the purpose of this pull request --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Fetch, build and deploy docs | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Fetch branch | ||
uses: actions/[email protected] | ||
with: | ||
ref: master | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install dependencies | ||
run: make install_docs | ||
|
||
- name: Build docs | ||
run: make create_docs | ||
|
||
- name: Create the CNAME for GitHub Pages | ||
run: echo discordhttp.alexflipnote.dev > ./docs/_build/html/CNAME | ||
|
||
- name: Prevent GitHub Pages Jekyll behaviour | ||
run: touch ./docs/_build/html/.nojekyll | ||
|
||
- name: Deploy docs | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: ./docs/_build/html | ||
clean: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# Custom ignore | ||
*.config.json | ||
config.json | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FLAKE8_CONFIG := $(shell \ | ||
if python -c "import toml" 2>/dev/null; then \ | ||
python -c "import toml; data = toml.load('pyproject.toml'); flake8 = data.get('tool', {}).get('flake8', {}); max_line_length = flake8.get('max-line-length', 128); ignores = ' '.join(['--ignore=' + i for i in flake8.get('ignore', [])]); print(f'--max-line-length {max_line_length} {ignores}')"; \ | ||
else \ | ||
echo "--max-line-length 128"; \ | ||
fi) | ||
|
||
target: | ||
@echo -e "\033[1mdiscord.http v$(shell grep -oP '(?<=__version__ = ")[^"]*' discord_http/__init__.py)\033[0m" \ | ||
"\nUse 'make \033[0;36mtarget\033[0m' where \033[0;36mtarget\033[0m is one of the following:" | ||
@awk -F ':|##' '/^[^\t].+?:.*?##/ { printf " \033[0;36m%-15s\033[0m %s\n", $$1, $$NF }' $(MAKEFILE_LIST) | ||
|
||
# Production tools | ||
install: ## Install the package | ||
pip install . | ||
|
||
uninstall: ## Uninstall the package | ||
pip uninstall -y discord.http | ||
|
||
reinstall: uninstall install ## Reinstall the package | ||
|
||
# Development tools | ||
install_dev: ## Install the package in development mode | ||
pip install .[dev] | ||
|
||
install_docs: ## Install the documentation dependencies | ||
pip install .[docs] | ||
|
||
create_docs: ## Create the documentation | ||
@cd docs && make html | ||
|
||
venv: ## Create a virtual environment | ||
python -m venv .venv | ||
|
||
flake8: ## Run flake8 on the package | ||
@flake8 $(FLAKE8_CONFIG) discord_http | ||
@echo -e "\033[0;32mNo errors found.\033[0m" | ||
|
||
type: ## Run pyright on the package | ||
@pyright discord_http --pythonversion 3.11 | ||
|
||
clean: ## Clean the project | ||
@rm -rf build dist *.egg-info .venv docs/_build | ||
|
||
# Maintainer-only commands | ||
upload_pypi: ## Maintainer only - Upload latest version to PyPi | ||
@echo Uploading to PyPi... | ||
pip install . | ||
python -m build | ||
twine upload dist/* | ||
@echo Done! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# discord.http | ||
Python library that handles interactions from Discord POST requests. | ||
|
||
## Supported installs | ||
- [Guild application (normal bot)](/examples/ping_cmd_example.py) | ||
- [User application (bots on user accounts)](/examples/user_command_example.py) | ||
|
||
## Installing | ||
> You need **Python >=3.11** to use this library. | ||
Install by using `pip install discord.http` in the terminal. | ||
If `pip` does not work, there are other ways to install as well, most commonly: | ||
- `python -m pip install discord.http` | ||
- `python3 -m pip install discord.http` | ||
- `pip3 install discord.http` | ||
|
||
## Quick example | ||
```py <!-- DOCS: quick_example --> | ||
from discord_http import Context, Client | ||
|
||
client = Client( | ||
token="Your bot token here", | ||
application_id="Bot application ID", | ||
public_key="Bot public key", | ||
sync=True | ||
) | ||
|
||
@client.command() | ||
async def ping(ctx: Context): | ||
""" A simple ping command """ | ||
return ctx.response.send_message("Pong!") | ||
|
||
client.start() | ||
``` | ||
|
||
Need further help on how to make Discord API able to send requests to your bot? | ||
Check out [the documentation](https://discordhttp.alexflipnote.dev/pages/getting_started.html) for more detailed information. | ||
|
||
## Resources | ||
- Documentations | ||
- [Library documentation](https://discordhttp.alexflipnote.dev) | ||
- [Discord API documentation](https://discord.com/developers/docs/intro) | ||
- [Discord server](https://discord.gg/AlexFlipnote) | ||
|
||
|
||
## Acknowledgements | ||
This library was inspired by [discord.py](https://github.com/Rapptz/discord.py), developed by [Rapptz](https://github.com/Rapptz). | ||
We would like to express our gratitude for their amazing work, which has served as a foundation for this project. | ||
|
||
The project is also a fork of [joyn-gg/discord.http](https://github.com/joyn-gg/discord.http) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
__version__ = "1.3.19" | ||
|
||
# flake8: noqa: F401 | ||
from .asset import * | ||
from .backend import * | ||
from .channel import * | ||
from .client import * | ||
from .colour import * | ||
from .context import * | ||
from .cooldowns import * | ||
from .embeds import * | ||
from .emoji import * | ||
from .enums import * | ||
from .errors import * | ||
from .file import * | ||
from .flag import * | ||
from .flag import * | ||
from .guild import * | ||
from .http import * | ||
from .invite import * | ||
from .member import * | ||
from .mentions import * | ||
from .mentions import * | ||
from .message import * | ||
from .multipart import * | ||
from .object import * | ||
from .response import * | ||
from .role import * | ||
from .sticker import * | ||
from .user import * | ||
from .utils import MISSING, DISCORD_EPOCH, _MissingType | ||
from .view import * | ||
from .webhook import * |
Oops, something went wrong.