Skip to content

Commit fd02cf1

Browse files
Merge branch 'master' into autocomplete
2 parents a0e6612 + 416f97c commit fd02cf1

File tree

19 files changed

+498
-72
lines changed

19 files changed

+498
-72
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ docs/crowdin.py
1515
*.flac
1616
*.mo
1717
.idea/
18+
.vs/slnx.sqlite
19+
env/

CONTRIBUTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing to Pycord
2+
We're really happy to accept contributions. However we also ask that you follow several rules when doing so.
3+
4+
# Proper base
5+
When opening a PR, please make sure your branch targets the latest release branch, in this case it would be `master`. Also make sure your branch is even with the target branch, to avoid unnecessary surprises.
6+
7+
# Versioning
8+
We follow [SemVer](https://semver.org/) versioning when it comes to pushing stable releases. Ideally, this means you should only be creating PRs for `patch` and `minor` changes. If you wish to introduce a `major` (breaking) change, please discuss it beforehand so we can determine how to integrate it into our next major version. If this involves removing a public facing property/method, mark it with obsolete instead on the latest release branch.
9+
10+
# Proper titles
11+
When opening issues, make sure the title reflects the purpose of the issue or the pull request. Prefer past tense, and
12+
be brief. Further description belongs inside the issue or PR.
13+
14+
# Descriptive changes
15+
We require the commits describe the change made. It can be a short description. If you fixed or resolved an open issue,
16+
please reference it by using the # notation.
17+
18+
Examples of good commit messages:
19+
20+
* `Fixed a potential memory leak with cache entities. Fixes #142.`
21+
* `Implemented new command extension. Resolves #169.`
22+
* `Changed message cache behaviour. It's now global instead of per-channel.`
23+
* `Fixed a potential NRE.`
24+
* ```
25+
Changed message cache behaviour:
26+
27+
- Messages are now stored globally.
28+
- Cache now deletes messages when they are deleted from discord.
29+
- Cache itself is now a ring buffer.
30+
```
31+
32+
# Code changes
33+
One of our requirements is that all code change commits must build successfully. This is verified by our CI. You can view its summary by visiting it from the checks section on
34+
the PR overview page.
35+
36+
PRs that do not build will not be accepted.
37+
38+
Furthermore we require that methods you implement on Discord entities have a reflection in the Discord API.
39+
40+
In the event your code change is a style change, doc change, or otherwise does not change how the code works, tag
41+
the commit with `[ci skip]`.
42+
43+
# Non-code changes
44+
In the event you change something outside of code (i.e. a meta-change or documentation), you must tag your commit with
45+
`[ci skip]`.

DEVELOPER_CERTIFICATE_OF_ORIGIN.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Developer Certificate of Origin (DCO)
2+
```
3+
Version 1.1
4+
5+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
6+
7+
Everyone is permitted to copy and distribute verbatim copies of this
8+
license document, but changing it is not allowed.
9+
10+
11+
Developer's Certificate of Origin 1.1
12+
13+
By making a contribution to this project, I certify that:
14+
15+
(a) The contribution was created in whole or in part by me and I
16+
have the right to submit it under the open source license
17+
indicated in the file; or
18+
19+
(b) The contribution is based upon previous work that, to the best
20+
of my knowledge, is covered under an appropriate open source
21+
license and I have the right under that license to submit that
22+
work with modifications, whether created in whole or in part
23+
by me, under the same open source license (unless I am
24+
permitted to submit under a different license), as indicated
25+
in the file; or
26+
27+
(c) The contribution was provided directly to me by some other
28+
person who certified (a), (b) or (c) and I have not modified
29+
it.
30+
31+
(d) I understand and agree that this project and the contribution
32+
are public and that a record of the contribution (including all
33+
personal information I submit with it, including my sign-off) is
34+
maintained indefinitely and may be redistributed consistent with
35+
this project or the open source license(s) involved.
36+
```

README.ja.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
pycord
22
==========
33

4-
.. image:: https://discord.com/api/guilds/681882711945641997/embed.png
5-
:target: https://discord.gg/dK2qkEJ37N
4+
.. image:: https://discord.com/api/guilds/881207955029110855/embed.png
5+
:target: https://pycord.dev/discord
66
:alt: Discordサーバーの招待
77
.. image:: https://img.shields.io/pypi/v/py-cord.svg
88
:target: https://pypi.python.org/pypi/py-cord
99
:alt: PyPIのバージョン情報
1010
.. image:: https://img.shields.io/pypi/pyversions/py-cord.svg
1111
:target: https://pypi.python.org/pypi/py-cord
1212
:alt: PyPIのサポートしているPythonのバージョン
13+
.. image:: https://img.shields.io/pypi/dm/py-cord?color=blue
14+
:target: https://pypi.python.org/pypi/py-cord
15+
:alt: PyPIダウンロード
1316

14-
discord.pyのフォーク。 PyCordはPythonで記述されたDiscord用の最新の使いやすい機能豊富な非同期対応APIラッパーです
17+
discord.pyのフォークです。PyCordはPythonで書かれたDiscordのモダンで使いやすく、豊富な機能を持ち、非同期に対応したAPIラッパーです
1518

1619
主な特徴
1720
-------------
1821

1922
- ``async`` と ``await`` を使ったモダンなPythonらしいAPI。
2023
- 適切なレート制限の処理。
21-
- 速度とメモリの両方で最適化されています。
24+
- 速度とメモリ使用量の両方が最適化されています。
25+
- スラッシュコマンド、コンテキストメニュー、メッセージコンポーネントをサポート。
2226

2327
インストール
2428
----------
@@ -59,7 +63,7 @@ discord.pyのフォーク。 PyCordはPythonで記述されたDiscord用の最
5963

6064
* `PyNaCl <https://pypi.org/project/PyNaCl/>`__ (音声サポート用)
6165

62-
Linuxで音声サポートを導入するには、前述のコマンドを実行する前にお気に入りのパッケージマネージャー(例えば ``apt`` や ``dnf`` など)を使って以下のパッケージをインストールする必要があります:
66+
なお、Linuxで音声サポートをインストールする場合は、上記のコマンドを実行する前に、お好みのパッケージマネージャー(apt、dnfなど)を使って以下のパッケージをインストールしておく必要があります。
6367

6468
* libffi-dev (システムによっては ``libffi-devel``)
6569
* python-dev (例えばPython 3.6用の ``python3.6-dev``)
@@ -102,11 +106,14 @@ Botの例
102106
103107
bot.run('token')
104108
105-
examplesディレクトリに更に多くのサンプルがあります。
109+
その他の例は、examples ディレクトリにあります。
110+
111+
注意: ボットトークンを誰にも見せないようにしてください。
106112

107113
リンク
108114
------
109115

110-
- `ドキュメント <https://pycord.readthedocs.io/en/latest/index.html>`_
111-
- `公式Discordサーバー <https://discord.gg/dK2qkEJ37N>`_
116+
- `ドキュメント <https://docs.pycord.dev/en/master/index.html>`_
117+
- `公式Discordサーバー <https://pycord.dev/discord>`_
118+
- `Discord開発者 <https://discord.gg/discord-developers>`_
112119
- `Discord API <https://discord.gg/discord-api>`_

README.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pycord
22
==========
33

44
.. image:: https://discord.com/api/guilds/881207955029110855/embed.png
5-
:target: https://discord.gg/dK2qkEJ37N
5+
:target: https://pycord.dev/discord
66
:alt: Discord server invite
77
.. image:: https://img.shields.io/pypi/v/py-cord.svg
88
:target: https://pypi.python.org/pypi/py-cord
@@ -21,7 +21,7 @@ Key Features
2121

2222
- Modern Pythonic API using ``async`` and ``await``.
2323
- Proper rate limit handling.
24-
- Optimised in both speed and memory.
24+
- Optimised for both speed and memory usage.
2525
- Supports Slash Commands, Context Menus and Message Components.
2626

2727
Installing
@@ -64,7 +64,7 @@ Optional Packages
6464

6565
* `PyNaCl <https://pypi.org/project/PyNaCl/>`__ (for voice support)
6666

67-
Please note that on Linux installing voice you must install the following packages via your favourite package manager (e.g. ``apt``, ``dnf``, etc) before running the above commands:
67+
Please note that while installing voice support on Linux, you must install the following packages via your preferred package manager (e.g. ``apt``, ``dnf``, etc) BEFORE running the above commands:
6868

6969
* libffi-dev (or ``libffi-devel`` on some systems)
7070
* python-dev (e.g. ``python3.6-dev`` for Python 3.6)
@@ -107,10 +107,12 @@ Normal Commands Example
107107
108108
You can find more examples in the examples directory.
109109

110+
Note: Make sure you do not reveal your bot token to anyone, it can grant access to your bot.
111+
110112
Links
111113
------
112114

113-
- `Documentation <https://pycord.readthedocs.io/en/latest/index.html>`_
114-
- `Official Discord Server <https://discord.gg/dK2qkEJ37N>`_
115+
- `Documentation <https://docs.pycord.dev/en/master/index.html>`_
116+
- `Official Discord Server <https://pycord.dev/discord>`_
115117
- `Discord Developers <https://discord.gg/discord-developers>`_
116118
- `Discord API <https://discord.gg/discord-api>`_

SECURITY.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 2.0.0 | :white_check_mark: |
8+
| 1.7.x | :white_check_mark: |
9+
| < 1.7.3 | :x: |
10+
11+
## Reporting a Vulnerability
12+
13+
If you find a vulnerability you have two ways to report it:
14+
- Write us on https://pycord.dev/discord
15+
- Open an [issue](https://github.com/Pycord-Development/pycord/issues/new/choose)

discord/cog.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,12 @@ def remove_cog(self, name: str) -> Optional[Cog]:
591591
cog = self.__cogs.pop(name, None)
592592
if cog is None:
593593
return
594+
595+
if hasattr(self, "_help_command"):
596+
help_command = self._help_command
597+
if help_command and help_command.cog is cog:
598+
help_command.cog = None
594599

595-
help_command = self._help_command
596-
if help_command and help_command.cog is cog:
597-
help_command.cog = None
598600
cog._eject(self)
599601

600602
return cog

discord/commands/commands.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ def _parse_options(self, params) -> List[Option]:
421421

422422
if option.name is None:
423423
option.name = p_name
424+
option._parameter_name = p_name
424425

425426
final_options.append(option)
426427

@@ -479,11 +480,11 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
479480
elif op.input_type == SlashCommandOptionType.string and op._converter is not None:
480481
arg = await op._converter.convert(ctx, arg)
481482

482-
kwargs[op.name] = arg
483+
kwargs[op._parameter_name] = arg
483484

484485
for o in self.options:
485-
if o.name not in kwargs:
486-
kwargs[o.name] = o.default
486+
if o._parameter_name not in kwargs:
487+
kwargs[o._parameter_name] = o.default
487488

488489
if self.cog is not None:
489490
await self.callback(self.cog, ctx, **kwargs)

discord/enums.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def from_datatype(cls, datatype):
649649
if issubclass(datatype, float):
650650
return cls.number
651651

652-
if datatype.__name__ == "Member":
652+
if datatype.__name__ in ["Member", "User"]:
653653
return cls.user
654654
if datatype.__name__ in [
655655
"GuildChannel", "TextChannel",
@@ -667,22 +667,40 @@ def from_datatype(cls, datatype):
667667

668668

669669
class EmbeddedActivity(Enum):
670+
awkword = 879863881349087252
670671
betrayal = 773336526917861400
671-
chess = 832012586023256104
672-
chess_dev = 832012774040141894
672+
cg2_qa = 832012815819604009
673+
cg2_staging = 832012730599735326
674+
cg3_dev = 832012682520428625
675+
cg3_prod = 832013003968348200
676+
cg3_qa = 832012894068801636
677+
cg3_staging = 832012938398400562
678+
cg4_dev = 832013108234289153
679+
cg4_prod = 832025144389533716
680+
cg4_qa = 832025114077298718
681+
cg4_staging = 832025061657280566
682+
chess_in_the_park_dev = 832012586023256104
683+
chess_in_the_park = 832012774040141894
684+
decoders_dev = 891001866073296967
673685
doodle_crew = 878067389634314250
674-
fishing = 814288819477020702
686+
doodle_crew_dev = 878067427668275241
687+
fishington = 814288819477020702
675688
letter_tile = 879863686565621790
676-
poker = 755827207812677713
689+
pn_staging = 763116274876022855
690+
poker_night = 755827207812677713
691+
poker_qa = 801133024841957428
692+
putts = 832012854282158180
693+
sketchy_artist = 879864070101172255
694+
sketchy_artist_dev = 879864104980979792
677695
spell_cast = 852509694341283871
678696
watch_together = 880218394199220334
679697
watch_together_dev = 880218832743055411
680-
word_snack = 879863976006127627
681-
youtube = 755600276941176913
698+
word_snacks = 879863976006127627
699+
word_snacks_dev = 879864010126786570
700+
youtube_together = 755600276941176913
682701

683702
T = TypeVar('T')
684703

685-
686704
def create_unknown_value(cls: Type[T], val: Any) -> T:
687705
value_cls = cls._enum_value_cls_ # type: ignore
688706
name = f'unknown_{val}'

discord/ext/commands/help.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@ async def filter_commands(self, commands, *, sort=False, key=None):
559559
if sort and key is None:
560560
key = lambda c: c.name
561561

562-
iterator = commands if self.show_hidden else filter(lambda c: not c.hidden, commands)
562+
# Ignore Application Commands cause they dont have hidden/docs
563+
prefix_commands = [command for command in commands if not isinstance(command, discord.commands.ApplicationCommand)]
564+
iterator = prefix_commands if self.show_hidden else filter(lambda c: not c.hidden, prefix_commands)
563565

564566
if self.verify_checks is False:
565567
# if we do not need to verify the checks then we can just

0 commit comments

Comments
 (0)