# discord.py-stubs
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/bryanforbes/discord.py-stubs/blob/master/LICENSE)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
This package contains type stubs to provide more precise static types and type inference for discord.py.
## Installation
```
pip install discord.py-stubs
```
**NOTE:** Because `discord.py` uses namespace packages for its extensions, `mypy` must be configured to use namespace packages either with the `--namespace-packages` command line flag, or by setting `namespace_packages = True` in your `mypy` configuration file. See the [import discovery](https://mypy.readthedocs.io/en/stable/command_line.html#import-discovery) section of the `mypy` documentation for more details.
## Usage Notes
In most cases, installing this package will enable developers to type check their discord.py bots using mypy out of the box. However, if developers wish to subclass the classes in `discord.ext.commands` they will need to follow the `mypy` documentation outlining how to use [classes that are generic in stubs but not at runtime](https://mypy.readthedocs.io/en/stable/common_issues.html#using-classes-that-are-generic-in-stubs-but-not-at-runtime):
```python
from typing import TYPE_CHECKING
from discord.ext import commands
class MyContext(commands.Context):
...
if TYPE_CHECKING:
Cog = commands.Cog[MyContext]
else:
Cog = commands.Cog
class MyCog(Cog):
...
```
In order to avoid this issue, developers can use [`discord-ext-typed-commands`](https://github.com/bryanforbes/discord-ext-typed-commands/):
```python
from discord.ext import typed_commands
class MyContext(typed_commands.Context):
...
class MyCog(typed_commands.Cog[MyContext]):
...
```
## Development
Make sure you have [poetry](https://python-poetry.org/) installed.
```
poetry install
poetry run pre-commit install --hook-type pre-commit --hook-type post-checkout
```
## Version numbering scheme
At this time, the version number of `discord.py-stubs` will follow the version number of `discord.py` it corresponds to and append one more version segment that indicates the sequence of releases for the stubs. For instance, if you are using `discord.py` version `1.3.4`, you would use `discord.py-stubs` version `1.3.4.X` where `X` is an integer.
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
discord.py-stubs-1.5.0.0.tar.gz (65个子文件)
discord.py-stubs-1.5.0.0
PKG-INFO 3KB
discord-stubs
permissions.pyi 8KB
role.pyi 2KB
calls.pyi 2KB
opus.pyi 1KB
file.pyi 366B
gateway.pyi 5KB
oggparse.pyi 436B
appinfo.pyi 671B
errors.pyi 1KB
http.pyi 26KB
activity.pyi 4KB
partial_emoji.pyi 833B
template.pyi 523B
invite.pyi 2KB
mixins.pyi 214B
channel.pyi 6KB
iterators.pyi 2KB
relationship.pyi 202B
audit_logs.pyi 1KB
object.pyi 317B
message.pyi 4KB
abc.pyi 5KB
asset.pyi 835B
enums.pyi 4KB
reaction.pyi 934B
backoff.pyi 176B
ext
commands
cooldowns.pyi 2KB
errors.pyi 5KB
cog.pyi 1KB
help.pyi 7KB
context.pyi 1KB
_types.pyi 24B
bot.pyi 7KB
core.pyi 10KB
converter.pyi 2KB
view.pyi 510B
__init__.pyi 509B
tasks
__init__.pyi 2KB
team.pyi 464B
embeds.pyi 4KB
state.pyi 276B
shard.pyi 4KB
client.pyi 18KB
flags.pyi 4KB
guild.pyi 10KB
mentions.pyi 1KB
integrations.pyi 870B
user.pyi 5KB
player.pyi 4KB
utils.pyi 4KB
context_managers.pyi 534B
__main__.pyi 638B
voice_client.pyi 2KB
webhook.pyi 5KB
raw_models.pyi 2KB
member.pyi 4KB
emoji.pyi 1KB
widget.pyi 1KB
__init__.pyi 4KB
colour.pyi 2KB
pyproject.toml 1KB
LICENSE 1KB
setup.py 3KB
README.md 2KB
共 65 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 12w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功