Skip to content

Commit

Permalink
Merge branch 'master' into patch-3
Browse files Browse the repository at this point in the history
Signed-off-by: JustaSqu1d <[email protected]>
  • Loading branch information
JustaSqu1d authored Aug 15, 2024
2 parents c06d396 + 6d6d198 commit fde6560
Show file tree
Hide file tree
Showing 263 changed files with 67,202 additions and 5,551 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/.cleanup-todo
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Status checks that are required.
CodeQL
@github-advanced-security
Check Dependencies
@github-actions
codespell
@github-actions
bandit
@github-actions
docs/readthedocs.org:pycord
mypy
@github-actions
pre-commit.ci - pr
@pre-commit-ci
todo
@github-actions
pytest (ubuntu-latest, 3.10)
@github-actions
pytest (ubuntu-latest, 3.11)
@github-actions
pytest (ubuntu-latest, 3.9)
@github-actions
pytest (windows-latest, 3.9)
@github-actions
pytest (windows-latest, 3.10)
@github-actions
pytest (windows-latest, 3.11)
@github-actions
pytest (macos-latest, 3.10)
@github-actions
pytest (macos-latest, 3.11)
@github-actions
Check Title
@github-actions
pullapprove4
@pullapprove4
Analyze (python)
@github-actions
pylint
@github-actions
docs
@github-actions
pytest (ubuntu-latest, 3.12)
@github-actions
pytest (macos-latest, 3.12)
@github-actions
pytest (windows-latest, 3.12)
@github-actions

--------------------------------------------

paths

docs/ Documentation
docs/build/locales/ | docs/locales/ Translations
discord/ | setup.py | pyproject.toml, MAINFEST.in Main python lib
.github/ github meta
.github/workflows/ github actions
.github/depandabot.yml github actions configurations
.github/ISSUE_TEMPLATE/ github templates
examples/ example python code, should not be checked
requirements/ python requirements
tests/ currently more or less unused, maybe check?
.files configurations
/ repo content
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Checks
on: [pull_request, push]
on: [pull_request, push, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
name: "CodeQL"

on:
push: null
pull_request: null
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "26 6 * * 6"

Expand Down
86 changes: 82 additions & 4 deletions .github/workflows/docs-localization-download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ on:
workflow_dispatch:

jobs:
localizse:
download:
permissions: write-all
name: "Localisize Docs"
name: "Download localizations from Crowdin"
runs-on: ubuntu-latest
outputs:
pr_ref: ${{ steps.convert_outputs.outputs.pr_ref }}
pr_id: ${{ steps.convert_outputs.outputs.pr_id }}
steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-tags: true
- name: "Install Python"
uses: actions/setup-python@v5
with:
Expand All @@ -28,10 +34,11 @@ jobs:
working-directory: ./docs
- name: "Build locales"
run:
sphinx-intl update -p ./build/locales -l de -l ja -l de -l ja -l fr -l it -l
sphinx-intl update -p ./build/locales -l ja -l de -l ja -l fr -l it -l en -l
hi -l ko -l pt_BR -l es -l zh_CN -l ru
working-directory: ./docs
- name: "Crowdin"
id: crowdin
uses: crowdin/github-action@v2
with:
upload_sources: false
Expand All @@ -53,3 +60,74 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
- name: "Convert Outputs"
id: convert_outputs
run: |
PR_REF="l10n_master"
PR_ID="${{ steps.crowdin.outputs.pull_request_number }}"
echo "pr_ref=$(echo -n "$PR_REF" | base64)" >> $GITHUB_OUTPUT
echo "pr_id=$(echo -n "$PR_ID" | base64)" >> $GITHUB_OUTPUT
pr:
permissions: write-all
name: "Trigger PR workflows manually"
needs: [download]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Refresh Pull
run: |
git fetch --all
git reset --hard origin/master
git pull
- name: "Convert Outputs"
id: convert_outputs
run: |
PR_REF=$(echo -n "${{ needs.download.outputs.pr_ref }}" | base64 --decode)
PR_ID=$(echo -n "${{ needs.download.outputs.pr_id }}" | base64 --decode)
echo "pr_ref=$PR_REF" >> $GITHUB_OUTPUT
echo "pr_id=$PR_ID" >> $GITHUB_OUTPUT
- name: Invoke checks workflow
uses: benc-uk/[email protected]
with:
workflow: check.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: Invoke codeql workflow
uses: benc-uk/[email protected]
with:
workflow: codeql-analysis.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: Invoke lint workflow
uses: benc-uk/[email protected]
with:
workflow: lint.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: Invoke pr workflow
uses: benc-uk/[email protected]
with:
workflow: pr.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: Invoke test workflow
uses: benc-uk/[email protected]
with:
workflow: test.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: Invoke todo workflow
uses: benc-uk/[email protected]
with:
workflow: todo.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: Invoke version updates workflow
uses: benc-uk/[email protected]
with:
workflow: version-updates.yml
ref: ${{ steps.convert_outputs.outputs.pr_ref }}
# - run: gh pr review --approve -b "auto-approval for localization sync :3" "$PR_ID"
# env:
# PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: gh pr merge --auto --squash $PR_ID
env:
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/docs-localization-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
workflow_dispatch:

jobs:
localizse:
upload:
permissions: write-all
name: "Localisize Docs"
name: "Upload localization base to Crowdin"
runs-on: ubuntu-latest
if:
contains(github.event.head_commit.message, '!crowdin upload') || github.event_name
Expand All @@ -34,7 +34,7 @@ jobs:
working-directory: ./docs
- name: "Build locales"
run:
sphinx-intl update -p ./build/locales -l de -l ja -l de -l ja -l fr -l it -l
sphinx-intl update -p ./build/locales -l ja -l de -l ja -l fr -l it -l en -l
hi -l ko -l pt_BR -l es -l zh_CN -l ru
working-directory: ./docs
- name: "Crowdin"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Type Check and Lint
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Lint PR"

on:
workflow_dispatch:
pull_request_target:
types: [opened, synchronize, reopened, edited]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Unit Tests
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/todo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Check TODO
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
todo:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-updates.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Version Update Auto Merge
on: pull_request
on: [pull_request, workflow_dispatch]

permissions:
contents: write
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ These changes are available on the `master` branch, but have not yet been releas

### Added

- Added `Guild.fetch_role` method.
([#2528](https://github.com/Pycord-Development/pycord/pull/2528))
- Added `AppInfo` attributes.
([#2520](https://github.com/Pycord-Development/pycord/pull/2520))

Expand Down
24 changes: 24 additions & 0 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,30 @@ async def fetch_roles(self) -> list[Role]:
data = await self._state.http.get_roles(self.id)
return [Role(guild=self, state=self._state, data=d) for d in data]

async def fetch_role(self, role_id: int) -> Role:
"""|coro|
Retrieves a :class:`Role` that the guild has.
.. note::
This method is an API call. For general usage, consider using :attr:`get_role` instead.
.. versionadded:: 2.7
Returns
-------
:class:`Role`
The role in the guild with the specified ID.
Raises
------
HTTPException
Retrieving the role failed.
"""
data = await self._state.http.get_role(self.id, role_id)
return Role(guild=self, state=self._state, data=data)

async def _fetch_role(self, role_id: int) -> Role:
"""|coro|
Expand Down
10 changes: 10 additions & 0 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,16 @@ def delete_invite(
def get_roles(self, guild_id: Snowflake) -> Response[list[role.Role]]:
return self.request(Route("GET", "/guilds/{guild_id}/roles", guild_id=guild_id))

def get_role(self, guild_id: Snowflake, role_id: Snowflake) -> Response[role.Role]:
return self.request(
Route(
"GET",
"/guilds/{guild_id}/roles/{role_id}",
guild_id=guild_id,
role_id=role_id,
)
)

def edit_role(
self,
guild_id: Snowflake,
Expand Down
4 changes: 2 additions & 2 deletions docs/api/enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,13 @@ of :class:`enum.Enum`.
Represents a slash command interaction.
.. attribute:: component

Represents a component based interaction, i.e. using the Discord Bot UI Kit.
Represents a component-based interaction, i.e. using the Discord Bot UI Kit.
.. attribute:: auto_complete

Represents a autocomplete interaction for slash commands.
.. attribute:: modal_submit

Represents a modal based interaction.
Represents a modal-based interaction.

.. class:: InteractionResponseType

Expand Down
Binary file modified docs/build/locales/.doctrees/api/abcs.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/application_commands.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/application_info.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/async_iter.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/audit_logs.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/clients.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/cogs.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/data_classes.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/enums.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/events.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/exceptions.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/index.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/models.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/sinks.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/ui_kit.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/utils.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/version_info.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/voice.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/api/webhooks.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/changelog.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/cogs.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/discord.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/bridge/api.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/bridge/index.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/commands/api.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/commands/cogs.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/commands/commands.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/commands/extensions.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/commands/index.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/pages/index.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/ext/tasks/index.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/faq.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/index.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/installing.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/intents.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/logging.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/migrating_to_v1.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/migrating_to_v2.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/old_changelog.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/quickstart.doctree
Binary file not shown.
Binary file modified docs/build/locales/.doctrees/version_guarantees.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/locales/api/abcs.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-10 02:50+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/application_commands.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-12 14:51+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/application_info.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-10 02:50+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/async_iter.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-10 02:50+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/audit_logs.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-10 02:50+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/clients.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-12 14:51+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/cogs.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-12 14:51+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/build/locales/api/data_classes.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pycord 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-10 02:50+0000\n"
"POT-Creation-Date: 2024-08-13 10:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
Loading

0 comments on commit fde6560

Please sign in to comment.