Full Code of Rapptz/discord.py for AI

master 5d74ed3e0ce5 cached
278 files
6.1 MB
1.6M tokens
5690 symbols
1 requests
Download .txt
Showing preview only (6,429K chars total). Download the full file or copy to clipboard to get everything.
Repository: Rapptz/discord.py
Branch: master
Commit: 5d74ed3e0ce5
Files: 278
Total size: 6.1 MB

Directory structure:
gitextract_zmbxq9eo/

├── .git-blame-ignore-revs
├── .github/
│   ├── CONTRIBUTING.md
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml
│   │   ├── config.yml
│   │   └── feature_request.yml
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       ├── build.yml
│       ├── crowdin_download.yml
│       ├── crowdin_upload.yml
│       ├── lint.yml
│       ├── scripts/
│       │   └── close_and_reopen_pr.js
│       └── test.yml
├── .gitignore
├── .readthedocs.yml
├── LICENSE
├── MANIFEST.in
├── README.ja.rst
├── README.rst
├── discord/
│   ├── __init__.py
│   ├── __main__.py
│   ├── _types.py
│   ├── abc.py
│   ├── activity.py
│   ├── app_commands/
│   │   ├── __init__.py
│   │   ├── checks.py
│   │   ├── commands.py
│   │   ├── errors.py
│   │   ├── installs.py
│   │   ├── models.py
│   │   ├── namespace.py
│   │   ├── transformers.py
│   │   ├── translator.py
│   │   └── tree.py
│   ├── appinfo.py
│   ├── asset.py
│   ├── audit_logs.py
│   ├── automod.py
│   ├── backoff.py
│   ├── bin/
│   │   └── COPYING
│   ├── channel.py
│   ├── client.py
│   ├── collectible.py
│   ├── colour.py
│   ├── components.py
│   ├── context_managers.py
│   ├── embeds.py
│   ├── emoji.py
│   ├── enums.py
│   ├── errors.py
│   ├── ext/
│   │   ├── commands/
│   │   │   ├── __init__.py
│   │   │   ├── _types.py
│   │   │   ├── bot.py
│   │   │   ├── cog.py
│   │   │   ├── context.py
│   │   │   ├── converter.py
│   │   │   ├── cooldowns.py
│   │   │   ├── core.py
│   │   │   ├── errors.py
│   │   │   ├── flags.py
│   │   │   ├── help.py
│   │   │   ├── hybrid.py
│   │   │   ├── parameters.py
│   │   │   └── view.py
│   │   └── tasks/
│   │       └── __init__.py
│   ├── file.py
│   ├── flags.py
│   ├── gateway.py
│   ├── guild.py
│   ├── http.py
│   ├── integrations.py
│   ├── interactions.py
│   ├── invite.py
│   ├── member.py
│   ├── mentions.py
│   ├── message.py
│   ├── mixins.py
│   ├── object.py
│   ├── oggparse.py
│   ├── onboarding.py
│   ├── opus.py
│   ├── partial_emoji.py
│   ├── permissions.py
│   ├── player.py
│   ├── poll.py
│   ├── presences.py
│   ├── primary_guild.py
│   ├── py.typed
│   ├── raw_models.py
│   ├── reaction.py
│   ├── role.py
│   ├── scheduled_event.py
│   ├── shard.py
│   ├── sku.py
│   ├── soundboard.py
│   ├── stage_instance.py
│   ├── state.py
│   ├── sticker.py
│   ├── subscription.py
│   ├── team.py
│   ├── template.py
│   ├── threads.py
│   ├── types/
│   │   ├── __init__.py
│   │   ├── activity.py
│   │   ├── appinfo.py
│   │   ├── audit_log.py
│   │   ├── automod.py
│   │   ├── channel.py
│   │   ├── command.py
│   │   ├── components.py
│   │   ├── embed.py
│   │   ├── emoji.py
│   │   ├── gateway.py
│   │   ├── guild.py
│   │   ├── integration.py
│   │   ├── interactions.py
│   │   ├── invite.py
│   │   ├── member.py
│   │   ├── message.py
│   │   ├── onboarding.py
│   │   ├── poll.py
│   │   ├── role.py
│   │   ├── scheduled_event.py
│   │   ├── sku.py
│   │   ├── snowflake.py
│   │   ├── soundboard.py
│   │   ├── sticker.py
│   │   ├── subscription.py
│   │   ├── team.py
│   │   ├── template.py
│   │   ├── threads.py
│   │   ├── user.py
│   │   ├── voice.py
│   │   ├── webhook.py
│   │   ├── welcome_screen.py
│   │   └── widget.py
│   ├── ui/
│   │   ├── __init__.py
│   │   ├── action_row.py
│   │   ├── button.py
│   │   ├── checkbox.py
│   │   ├── container.py
│   │   ├── dynamic.py
│   │   ├── file.py
│   │   ├── file_upload.py
│   │   ├── item.py
│   │   ├── label.py
│   │   ├── media_gallery.py
│   │   ├── modal.py
│   │   ├── radio.py
│   │   ├── section.py
│   │   ├── select.py
│   │   ├── separator.py
│   │   ├── text_display.py
│   │   ├── text_input.py
│   │   ├── thumbnail.py
│   │   └── view.py
│   ├── user.py
│   ├── utils.py
│   ├── voice_client.py
│   ├── voice_state.py
│   ├── webhook/
│   │   ├── __init__.py
│   │   ├── async_.py
│   │   └── sync.py
│   ├── welcome_screen.py
│   └── widget.py
├── docs/
│   ├── Makefile
│   ├── _static/
│   │   ├── codeblocks.css
│   │   ├── copy.js
│   │   ├── custom.js
│   │   ├── icons.css
│   │   ├── scorer.js
│   │   ├── settings.js
│   │   ├── sidebar.js
│   │   └── style.css
│   ├── _templates/
│   │   ├── genindex.html
│   │   ├── gettext/
│   │   │   └── message.pot_t
│   │   ├── layout.html
│   │   └── relations.html
│   ├── api.rst
│   ├── conf.py
│   ├── crowdin.yml
│   ├── discord.rst
│   ├── ext/
│   │   ├── commands/
│   │   │   ├── api.rst
│   │   │   ├── cogs.rst
│   │   │   ├── commands.rst
│   │   │   ├── extensions.rst
│   │   │   └── index.rst
│   │   └── tasks/
│   │       └── index.rst
│   ├── extensions/
│   │   ├── attributetable.py
│   │   ├── builder.py
│   │   ├── colour_preview.py
│   │   ├── details.py
│   │   ├── exception_hierarchy.py
│   │   ├── nitpick_file_ignorer.py
│   │   └── resourcelinks.py
│   ├── faq.rst
│   ├── index.rst
│   ├── intents.rst
│   ├── interactions/
│   │   └── api.rst
│   ├── intro.rst
│   ├── locale/
│   │   └── ja/
│   │       └── LC_MESSAGES/
│   │           ├── api.po
│   │           ├── discord.po
│   │           ├── ext/
│   │           │   ├── commands/
│   │           │   │   ├── api.po
│   │           │   │   ├── cogs.po
│   │           │   │   ├── commands.po
│   │           │   │   ├── extensions.po
│   │           │   │   └── index.po
│   │           │   └── tasks/
│   │           │       └── index.po
│   │           ├── faq.po
│   │           ├── index.po
│   │           ├── intents.po
│   │           ├── interactions/
│   │           │   └── api.po
│   │           ├── intro.po
│   │           ├── logging.po
│   │           ├── migrating.po
│   │           ├── migrating_to_async.po
│   │           ├── migrating_to_v1.po
│   │           ├── quickstart.po
│   │           ├── sphinx.po
│   │           ├── version_guarantees.po
│   │           └── whats_new.po
│   ├── logging.rst
│   ├── make.bat
│   ├── migrating.rst
│   ├── migrating_to_async.rst
│   ├── migrating_to_v1.rst
│   ├── quickstart.rst
│   ├── version_guarantees.rst
│   └── whats_new.rst
├── examples/
│   ├── advanced_startup.py
│   ├── app_commands/
│   │   ├── basic.py
│   │   └── transformers.py
│   ├── background_task.py
│   ├── background_task_asyncio.py
│   ├── basic_bot.py
│   ├── basic_voice.py
│   ├── converters.py
│   ├── custom_context.py
│   ├── deleted.py
│   ├── edits.py
│   ├── guessing_game.py
│   ├── modals/
│   │   ├── basic.py
│   │   ├── label.py
│   │   └── report.py
│   ├── new_member.py
│   ├── reaction_roles.py
│   ├── reply.py
│   ├── secret.py
│   └── views/
│       ├── confirm.py
│       ├── counter.py
│       ├── dropdown.py
│       ├── dynamic_counter.py
│       ├── embed_like.py
│       ├── ephemeral.py
│       ├── layout.py
│       ├── link.py
│       ├── persistent.py
│       ├── settings.py
│       └── tic_tac_toe.py
├── pyproject.toml
├── requirements.txt
├── setup.py
└── tests/
    ├── test_annotated_annotation.py
    ├── test_app_commands_autocomplete.py
    ├── test_app_commands_description.py
    ├── test_app_commands_group.py
    ├── test_app_commands_invoke.py
    ├── test_colour.py
    ├── test_embed.py
    ├── test_ext_commands_cog.py
    ├── test_ext_commands_description.py
    ├── test_ext_tasks.py
    ├── test_files.py
    ├── test_permissions_all.py
    ├── test_ui_buttons.py
    ├── test_ui_modals.py
    ├── test_ui_selects.py
    └── test_utils.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .git-blame-ignore-revs
================================================
# Replace Black with Ruff, then format whole project.
44a44e938fb2bd0bb085d8aa4577abeb01653ad3


================================================
FILE: .github/CONTRIBUTING.md
================================================
## Contributing to discord.py

First off, thanks for taking the time to contribute. It makes the library substantially better. :+1:

The following is a set of guidelines for contributing to the repository. These are guidelines, not hard rules.

## This is too much to read! I want to ask a question!

Generally speaking questions are better suited in our resources below.

- The official support server: https://discord.gg/r3sSKJJ
- The Discord API server under #python_discord-py: https://discord.gg/discord-api
- [The FAQ in the documentation](https://discordpy.readthedocs.io/en/latest/faq.html)
- [StackOverflow's `discord.py` tag](https://stackoverflow.com/questions/tagged/discord.py)

Please try your best not to ask questions in our issue tracker. Most of them don't belong there unless they provide value to a larger audience.

## Good Bug Reports

Please be aware of the following things when filing bug reports.

1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed.
2. When filing a bug about exceptions or tracebacks, please include the *complete* traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information.
3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process but they are enumerated here as well:
    - A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms.
    - Guidance on **how to reproduce the issue**. Ideally, this should have a small code sample that allows us to run and see the issue for ourselves to debug. **Please make sure that the token is not displayed**. If you cannot provide a code snippet, then let us know what the steps were, how often it happens, etc.
    - Tell us **what you expected to happen**. That way we can meet that expectation.
    - Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say *how* it failed, do you get an exception? Does it hang? How are the expectations different from reality?
    - Tell us **information about your environment**. What version of discord.py are you using? How was it installed? What operating system are you running on? These are valuable questions and information that we use.

If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed.

## Submitting a Pull Request

Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 125.

### AI Contributions

This repository does not accept any AI contributions at all. Using tools like Claude Code, Copilot, Gemini, ChatGPT, OpenAI Codex, etc. are simply blanket banned. AI contributions are typically nonsensical and just take up very valuable review time and thus are banned. Pull requests that are made with AI tools will be instantly closed without review, no matter how small the changeset is.

### Git Commit Guidelines

- Use present tense (e.g. "Add feature" not "Added feature")
- Limit all lines to 72 characters or less.
- Reference issues or pull requests outside of the first line.
    - Please use the shorthand `#123` and not the full URL.
- Commits regarding the commands extension must be prefixed with `[commands]`

If you do not meet any of these guidelines, don't fret. Chances are they will be fixed upon rebasing but please do try to meet them to remove some of the workload.


================================================
FILE: .github/FUNDING.yml
================================================
open_collective: discordpy


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug Report
description: Report broken or incorrect behaviour
labels: unconfirmed bug
body:
  - type: markdown
    attributes:
      value: >
        Thanks for taking the time to fill out a bug.
        If you want real-time support, consider joining our Discord at https://discord.gg/r3sSKJJ instead.

        Please note that this form is for bugs only!
  - type: input
    attributes:
      label: Summary
      description: A simple summary of your bug report
    validations:
      required: true
  - type: textarea
    attributes:
      label: Reproduction Steps
      description: >
         What you did to make it happen.
    validations:
      required: true
  - type: textarea
    attributes:
      label: Minimal Reproducible Code
      description: >
        A short snippet of code that showcases the bug.
      render: python
  - type: textarea
    attributes:
      label: Expected Results
      description: >
        What did you expect to happen?
    validations:
      required: true
  - type: textarea
    attributes:
      label: Actual Results
      description: >
        What actually happened?
    validations:
      required: true
  - type: input
    attributes:
      label: Intents
      description: >
        What intents are you using for your bot?
        This is the `discord.Intents` class you pass to the client.
    validations:
      required: true
  - type: textarea
    attributes:
      label: System Information
      description: >
        Run `python -m discord -v` and paste this information below.

        This command required v1.1.0 or higher of the library. If this errors out then show some basic
        information involving your system such as operating system and Python version.
    validations:
      required: true
  - type: checkboxes
    attributes:
      label: Checklist
      description: >
        Let's make sure you've properly done due diligence when reporting this issue!
      options:
        - label: I have searched the open issues for duplicates.
          required: true
        - label: I have shown the entire traceback, if possible.
          required: true
        - label: I have removed my token from display, if visible.
          required: true
  - type: textarea
    attributes:
      label: Additional Context
      description: If there is anything else to say, please do so here.


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: Ask a question
    about: Ask questions and discuss with other users of the library.
    url: https://github.com/Rapptz/discord.py/discussions
  - name: Discord Server
    about: Use our official Discord server to ask for help and questions as well.
    url: https://discord.gg/r3sSKJJ


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature Request
description: Suggest a feature for this library
labels: feature request
body:
  - type: input
    attributes:
      label: Summary
      description: >
        A short summary of what your feature request is.
    validations:
      required: true
  - type: dropdown
    attributes:
      multiple: false
      label: What is the feature request for?
      options:
        - The core library
        - discord.ext.commands
        - discord.ext.tasks
        - The documentation
    validations:
      required: true
  - type: textarea
    attributes:
      label: The Problem
      description: >
        What problem is your feature trying to solve?
        What becomes easier or possible when this feature is implemented?
    validations:
      required: true
  - type: textarea
    attributes:
      label: The Ideal Solution
      description: >
        What is your ideal solution to the problem?
        What would you like this feature to do?
    validations:
      required: true
  - type: textarea
    attributes:
      label: The Current Solution
      description: >
        What is the current solution to the problem, if any?
    validations:
      required: false
  - type: textarea
    attributes:
      label: Additional Context
      description: If there is anything else to say, please do so here.


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
## Summary

<!-- What is this pull request for? Does it fix any issues? -->

## Checklist

<!-- Put an x inside [ ] to check it, like so: [x] -->

- [ ] If code changes were made then they have been tested.
    - [ ] I have updated the documentation to reflect the changes.
- [ ] This PR fixes an issue.
- [ ] This PR adds something new (e.g. new method or parameters).
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is **not** a code change (e.g. documentation, README, ...)


================================================
FILE: .github/workflows/build.yml
================================================
name: build

on:
  push:
  pull_request:
    types: [ opened, reopened, synchronize ]

jobs:
  dists-and-docs:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [ '3.8', '3.x' ]
        language: [ 'en', 'ja' ]

    name: dists & docs (${{ matrix.python-version }}/${{ matrix.language }})
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up CPython ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip setuptools wheel
          pip install -U -r requirements.txt

      - name: Build distributions
        run: |
          python ./setup.py sdist bdist_wheel

      # - name: Upload artifacts
      #   uses: actions/upload-artifact@v2
      #   with:
      #     name: distributions
      #     path: dist/*

      - name: Install package
        run: |
          pip install -e .[docs,speed,voice]

      - name: Build docs
        shell: bash
        run: |
          cd docs
          sphinx-build -b html -D language=${DOCS_LANGUAGE} -j auto -a -n -T -W --keep-going . _build/html
        env:
          DOCS_LANGUAGE: ${{ matrix.language }}

      # - name: Upload docs
      #   uses: actions/upload-artifact@v2
      #   if: always()
      #   with:
      #     name: docs-${{ matrix.language }}
      #     path: docs/_build/html/*


================================================
FILE: .github/workflows/crowdin_download.yml
================================================
name: crowdin download

on:
  schedule:
    - cron: '0 18 * * 1'
  workflow_dispatch:

jobs:
  check-environment:
    runs-on: ubuntu-latest
    environment: Crowdin
    outputs:
      available: ${{ steps.check.outputs.available }}
    steps:
      - id: check
        if: env.CROWDIN_API_KEY != null
        run: |
          echo "available=true" >> $GITHUB_OUTPUT
        env:
          CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}

  download:
    runs-on: ubuntu-latest
    needs: [ check-environment ]
    # secrets cannot be accessed inside an `if` so this needs to be checked in separate job
    if: needs.check-environment.outputs.available == 'true'
    environment: Crowdin
    name: download
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: master

      - name: Install system dependencies
        run: |
          wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
          echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list.d/crowdin.list
          sudo apt-get update -qq
          sudo apt-get install -y crowdin3

      - name: Download translations
        shell: bash
        run: |
          cd docs
          crowdin download --all
        env:
          CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}

      - name: Create pull request
        id: cpr_crowdin
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: Crowdin translations download
          title: "[Crowdin] Updated translation files"
          body: |
            Created by the [Crowdin download workflow](.github/workflows/crowdin_download.yml).
          branch: "auto/crowdin"
          author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

      - name: Close and reopen the PR with different token to trigger CI
        uses: actions/github-script@v3
        env:
          PR_NUMBER: ${{ steps.cpr_crowdin.outputs.pull-request-number }}
          PR_OPERATION: ${{ steps.cpr_crowdin.outputs.pull-request-operation }}
        with:
          github-token: ${{ secrets.GH_REPO_SCOPED_TOKEN }}
          script: |
            const script = require(
              `${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/close_and_reopen_pr.js`
            );
            console.log(script({github, context}));


================================================
FILE: .github/workflows/crowdin_upload.yml
================================================
name: crowdin upload

on:
  workflow_dispatch:

jobs:
  upload:
    runs-on: ubuntu-latest
    environment: Crowdin
    name: upload
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up CPython 3.x
        uses: actions/setup-python@v4
        with:
          python-version: 3.x

      - name: Install system dependencies
        run: |
          wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
          echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list.d/crowdin.list
          sudo apt-get update -qq
          sudo apt-get install -y crowdin3

      - name: Install Python dependencies
        run: |
          python -m pip install --upgrade pip setuptools wheel
          pip install -e .[docs,speed,voice]

      - name: Build gettext
        run: |
          cd docs
          make gettext

      - name: Upload sources
        shell: bash
        run: |
          cd docs
          crowdin upload
        env:
          CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}


================================================
FILE: .github/workflows/lint.yml
================================================
name: lint

on:
  push:
  pull_request:
    types: [ opened, reopened, synchronize ]

jobs:
  check:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [ '3.8', '3.x' ]

    name: check ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up CPython ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        id: install-deps
        run: |
          python -m pip install --upgrade pip setuptools wheel ruff==0.12 requests "typing_extensions>=4.3,<5"
          pip install -U -r requirements.txt

      - name: Setup node.js
        uses: actions/setup-node@v3
        with:
          node-version: '16'

      - name: Run Pyright
        uses: jakebailey/pyright-action@v1
        with:
          version: '1.1.394'
          warnings: false
          no-comments: ${{ matrix.python-version != '3.x' }}

      - name: Run ruff
        if: ${{ always() && steps.install-deps.outcome == 'success' }}
        run: |
          ruff format --check discord examples


================================================
FILE: .github/workflows/scripts/close_and_reopen_pr.js
================================================
module.exports = (async function ({github, context}) {
    const pr_number = process.env.PR_NUMBER;
    const pr_operation = process.env.PR_OPERATION;

    if (!['created', 'updated'].includes(pr_operation)) {
        console.log('PR was not created as there were no changes.')
        return;
    }

    for (const state of ['closed', 'open']) {
        // Wait a moment for GitHub to process the previous action..
        await new Promise(r => setTimeout(r, 5000));

        // Close the PR
        github.issues.update({
            issue_number: pr_number,
            owner: context.repo.owner,
            repo: context.repo.repo,
            state
        });
    }
})


================================================
FILE: .github/workflows/test.yml
================================================
name: test

on:
  push:
  pull_request:
    types: [ opened, reopened, synchronize ]

jobs:
  pytest:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [ '3.8', '3.x' ]

    name: pytest ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up CPython ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          python -m pip install -e .[test]

      - name: Run tests
        shell: bash
        run: |
          PYTHONPATH="$(pwd)" pytest -vs --cov=discord --cov-report term-missing:skip-covered


================================================
FILE: .gitignore
================================================
*.json
*.py[cod]
*.log
*.egg-info
venv
.venv
docs/_build
docs/crowdin.py
*.buildinfo
*.mp3
*.m4a
*.wav
*.png
*.jpg
*.flac
*.mo
/.coverage
build/*
uv.lock*
pylock*.toml

================================================
FILE: .readthedocs.yml
================================================
version: 2
formats: []

build:
  os: "ubuntu-22.04"
  tools:
    python: "3.8"

sphinx:
  configuration: docs/conf.py
  fail_on_warning: false
  builder: html

python:
  install:
    - method: pip
      path: .
      extra_requirements:
        - docs


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


================================================
FILE: MANIFEST.in
================================================
include README.rst
include LICENSE
include requirements.txt
include discord/bin/*
include discord/py.typed


================================================
FILE: README.ja.rst
================================================
discord.py
==========

.. image:: https://discord.com/api/guilds/336642139381301249/embed.png
   :target: https://discord.gg/nXzj3dg
   :alt: Discordサーバーの招待
.. image:: https://img.shields.io/pypi/v/discord.py.svg
   :target: https://pypi.python.org/pypi/discord.py
   :alt: PyPIのバージョン情報
.. image:: https://img.shields.io/pypi/pyversions/discord.py.svg
   :target: https://pypi.python.org/pypi/discord.py
   :alt: PyPIのサポートしているPythonのバージョン

discord.py は機能豊富かつモダンで使いやすい、非同期処理にも対応したDiscord用のAPIラッパーです。

主な特徴
-------------

- ``async`` と ``await`` を使ったモダンなPythonらしいAPI。
- 適切なレート制限処理
- メモリと速度の両方を最適化。

インストール
-------------

**Python 3.8 以降のバージョンが必須です**

完全な音声サポートなしでライブラリをインストールする場合は次のコマンドを実行してください:

.. code:: sh

    # Linux/macOS
    python3 -m pip install -U discord.py

    # Windows
    py -3 -m pip install -U discord.py

音声サポートが必要なら、次のコマンドを実行しましょう:

.. code:: sh

    # Linux/macOS
    python3 -m pip install -U discord.py[voice]

    # Windows
    py -3 -m pip install -U discord.py[voice]


開発版をインストールしたいのならば、次の手順に従ってください:

.. code:: sh

    $ git clone https://github.com/Rapptz/discord.py
    $ cd discord.py
    $ python3 -m pip install -U .[voice]


オプションパッケージ
~~~~~~~~~~~~~~~~~~~~~~

* PyNaCl (音声サポート用)

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

* libffi-dev (システムによっては ``libffi-devel``)
* python-dev (例えばPython 3.8用の ``python3.8-dev``)

簡単な例
--------------

.. code:: py

    import discord

    class MyClient(discord.Client):
        async def on_ready(self):
            print('Logged on as', self.user)

        async def on_message(self, message):
            # don't respond to ourselves
            if message.author == self.user:
                return

            if message.content == 'ping':
                await message.channel.send('pong')

    intents = discord.Intents.default()
    intents.message_content = True
    client = MyClient(intents=intents)
    client.run('token')

Botの例
~~~~~~~~~~~~~

.. code:: py

    import discord
    from discord.ext import commands

    intents = discord.Intents.default()
    intents.message_content = True
    bot = commands.Bot(command_prefix='>', intents=intents)

    @bot.command()
    async def ping(ctx):
        await ctx.send('pong')

    bot.run('token')

examplesディレクトリに更に多くのサンプルがあります。

リンク
------

- `ドキュメント <https://discordpy.readthedocs.io/ja/latest/index.html>`_
- `公式Discordサーバー <https://discord.gg/nXzj3dg>`_
- `Discord API <https://discord.gg/discord-api>`_


================================================
FILE: README.rst
================================================
discord.py
==========

.. image:: https://discord.com/api/guilds/336642139381301249/embed.png
   :target: https://discord.gg/r3sSKJJ
   :alt: Discord server invite
.. image:: https://img.shields.io/pypi/v/discord.py.svg
   :target: https://pypi.python.org/pypi/discord.py
   :alt: PyPI version info
.. image:: https://img.shields.io/pypi/pyversions/discord.py.svg
   :target: https://pypi.python.org/pypi/discord.py
   :alt: PyPI supported Python versions

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

Key Features
-------------

- Modern Pythonic API using ``async`` and ``await``.
- Proper rate limit handling.
- Optimised in both speed and memory.

Installing
----------

**Python 3.8 or higher is required**

To install the library without full voice support, you can just run the following command:

.. note::

    A `Virtual Environment <https://docs.python.org/3/library/venv.html>`__ is recommended to install
    the library, especially on Linux where the system Python is externally managed and restricts which
    packages you can install on it.


.. code:: sh

    # Linux/macOS
    python3 -m pip install -U discord.py

    # Windows
    py -3 -m pip install -U discord.py

Otherwise to get voice support you should run the following command:

.. code:: sh

    # Linux/macOS
    python3 -m pip install -U "discord.py[voice]"

    # Windows
    py -3 -m pip install -U discord.py[voice]


To install the development version, do the following:

.. code:: sh

    $ git clone https://github.com/Rapptz/discord.py
    $ cd discord.py
    $ python3 -m pip install -U .[voice]


Optional Packages
~~~~~~~~~~~~~~~~~~

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

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

* libffi-dev (or ``libffi-devel`` on some systems)
* python-dev (e.g. ``python3.8-dev`` for Python 3.8)

Quick Example
--------------

.. code:: py

    import discord

    class MyClient(discord.Client):
        async def on_ready(self):
            print('Logged on as', self.user)

        async def on_message(self, message):
            # don't respond to ourselves
            if message.author == self.user:
                return

            if message.content == 'ping':
                await message.channel.send('pong')

    intents = discord.Intents.default()
    intents.message_content = True
    client = MyClient(intents=intents)
    client.run('token')

Bot Example
~~~~~~~~~~~~~

.. code:: py

    import discord
    from discord.ext import commands

    intents = discord.Intents.default()
    intents.message_content = True
    bot = commands.Bot(command_prefix='>', intents=intents)

    @bot.command()
    async def ping(ctx):
        await ctx.send('pong')

    bot.run('token')

You can find more examples in the examples directory.

Links
------

- `Documentation <https://discordpy.readthedocs.io/en/latest/index.html>`_
- `Official Discord Server <https://discord.gg/r3sSKJJ>`_
- `Discord API <https://discord.gg/discord-api>`_


================================================
FILE: discord/__init__.py
================================================
"""
Discord API Wrapper
~~~~~~~~~~~~~~~~~~~

A basic wrapper for the Discord API.

:copyright: (c) 2015-present Rapptz
:license: MIT, see LICENSE for more details.

"""

__title__ = 'discord'
__author__ = 'Rapptz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015-present Rapptz'
__version__ = '2.8.0a'

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

import logging
from typing import NamedTuple, Literal

from .client import *
from .appinfo import *
from .user import *
from .emoji import *
from .partial_emoji import *
from .activity import *
from .channel import *
from .guild import *
from .flags import *
from .member import *
from .message import *
from .asset import *
from .errors import *
from .permissions import *
from .role import *
from .file import *
from .colour import *
from .integrations import *
from .invite import *
from .template import *
from .welcome_screen import *
from .sku import *
from .widget import *
from .object import *
from .reaction import *
from . import (
    utils as utils,
    opus as opus,
    abc as abc,
    ui as ui,
    app_commands as app_commands,
)
from .enums import *
from .embeds import *
from .mentions import *
from .shard import *
from .player import *
from .webhook import *
from .voice_client import *
from .audit_logs import *
from .raw_models import *
from .team import *
from .sticker import *
from .stage_instance import *
from .scheduled_event import *
from .interactions import *
from .components import *
from .threads import *
from .automod import *
from .poll import *
from .soundboard import *
from .subscription import *
from .presences import *
from .primary_guild import *
from .onboarding import *
from .collectible import *


class VersionInfo(NamedTuple):
    major: int
    minor: int
    micro: int
    releaselevel: Literal['alpha', 'beta', 'candidate', 'final']
    serial: int


version_info: VersionInfo = VersionInfo(major=2, minor=8, micro=0, releaselevel='alpha', serial=0)

logging.getLogger(__name__).addHandler(logging.NullHandler())

# This is a backwards compatibility hack and should be removed in v3
# Essentially forcing the exception to have different base classes
# In the future, this should only inherit from ClientException
if len(MissingApplicationID.__bases__) == 1:
    MissingApplicationID.__bases__ = (app_commands.AppCommandError, ClientException)

del logging, NamedTuple, Literal, VersionInfo


================================================
FILE: discord/__main__.py
================================================
"""
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations

from typing import Optional, Tuple, Dict

import argparse
import sys
from pathlib import Path, PurePath, PureWindowsPath

import discord
import importlib.metadata
import aiohttp
import platform


def show_version() -> None:
    entries = []

    entries.append('- Python v{0.major}.{0.minor}.{0.micro}-{0.releaselevel}'.format(sys.version_info))
    version_info = discord.version_info
    entries.append('- discord.py v{0.major}.{0.minor}.{0.micro}-{0.releaselevel}'.format(version_info))
    if version_info.releaselevel != 'final':
        version = importlib.metadata.version('discord.py')
        if version:
            entries.append(f'    - discord.py metadata: v{version}')

    entries.append(f'- aiohttp v{aiohttp.__version__}')

    try:
        import davey  # type: ignore
    except ImportError:
        entries.append('- davey not found')
    else:
        entries.append(f'- davey v{davey.__version__}')

    uname = platform.uname()
    entries.append('- system info: {0.system} {0.release} {0.version}'.format(uname))
    print('\n'.join(entries))


def core(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
    if args.version:
        show_version()
    else:
        parser.print_help()


_bot_template = """#!/usr/bin/env python3

from discord.ext import commands
import discord
import config

class Bot(commands.{base}):
    def __init__(self, intents: discord.Intents, **kwargs):
        super().__init__(command_prefix=commands.when_mentioned_or('{prefix}'), intents=intents, **kwargs)

    async def setup_hook(self):
        for cog in config.cogs:
            try:
                await self.load_extension(cog)
            except Exception as exc:
                print(f'Could not load extension {{cog}} due to {{exc.__class__.__name__}}: {{exc}}')

    async def on_ready(self):
        print(f'Logged on as {{self.user}} (ID: {{self.user.id}})')


intents = discord.Intents.default()
intents.message_content = True
bot = Bot(intents=intents)

# write general commands here

bot.run(config.token)
"""

_gitignore_template = """# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Our configuration files
config.py
"""

_cog_template = '''from discord.ext import commands
import discord

class {name}(commands.Cog{attrs}):
    """The description for {name} goes here."""

    def __init__(self, bot):
        self.bot = bot
{extra}
async def setup(bot):
    await bot.add_cog({name}(bot))
'''

_cog_extras = """
    async def cog_load(self):
        # loading logic goes here
        pass

    async def cog_unload(self):
        # clean up logic goes here
        pass

    async def cog_check(self, ctx):
        # checks that apply to every command in here
        return True

    async def bot_check(self, ctx):
        # checks that apply to every command to the bot
        return True

    async def bot_check_once(self, ctx):
        # check that apply to every command but is guaranteed to be called only once
        return True

    async def cog_command_error(self, ctx, error):
        # error handling to every command in here
        pass

    async def cog_app_command_error(self, interaction, error):
        # error handling to every application command in here
        pass

    async def cog_before_invoke(self, ctx):
        # called before a command is called here
        pass

    async def cog_after_invoke(self, ctx):
        # called after a command is called here
        pass

"""


# certain file names and directory names are forbidden
# see: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx
# although some of this doesn't apply to Linux, we might as well be consistent
_base_table: Dict[str, Optional[str]] = {
    '<': '-',
    '>': '-',
    ':': '-',
    '"': '-',
    # '/': '-', these are fine
    # '\\': '-',
    '|': '-',
    '?': '-',
    '*': '-',
}

# NUL (0) and 1-31 are disallowed
_base_table.update((chr(i), None) for i in range(32))

_translation_table = str.maketrans(_base_table)


def to_path(parser: argparse.ArgumentParser, name: str, *, replace_spaces: bool = False) -> Path:
    if isinstance(name, Path):
        return name

    if sys.platform == 'win32':
        forbidden = (
            'CON',
            'PRN',
            'AUX',
            'NUL',
            'COM1',
            'COM2',
            'COM3',
            'COM4',
            'COM5',
            'COM6',
            'COM7',
            'COM8',
            'COM9',
            'LPT1',
            'LPT2',
            'LPT3',
            'LPT4',
            'LPT5',
            'LPT6',
            'LPT7',
            'LPT8',
            'LPT9',
        )
        if len(name) <= 4 and name.upper() in forbidden:
            parser.error('invalid directory name given, use a different one')
    path = PurePath(name)
    if isinstance(path, PureWindowsPath) and path.drive:
        drive, rest = path.parts[0], path.parts[1:]
        transformed = tuple(map(lambda p: p.translate(_translation_table), rest))
        name = drive + '\\'.join(transformed)

    else:
        name = name.translate(_translation_table)
    if replace_spaces:
        name = name.replace(' ', '-')
    return Path(name)


def newbot(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
    new_directory = to_path(parser, args.directory) / to_path(parser, args.name)

    # as a note exist_ok for Path is a 3.5+ only feature
    # since we already checked above that we're >3.5
    try:
        new_directory.mkdir(exist_ok=True, parents=True)
    except OSError as exc:
        parser.error(f'could not create our bot directory ({exc})')

    cogs = new_directory / 'cogs'

    try:
        cogs.mkdir(exist_ok=True)
        init = cogs / '__init__.py'
        init.touch()
    except OSError as exc:
        print(f'warning: could not create cogs directory ({exc})')

    try:
        with open(str(new_directory / 'config.py'), 'w', encoding='utf-8') as fp:
            fp.write('token = "place your token here"\ncogs = []\n')
    except OSError as exc:
        parser.error(f'could not create config file ({exc})')

    try:
        with open(str(new_directory / 'bot.py'), 'w', encoding='utf-8') as fp:
            base = 'Bot' if not args.sharded else 'AutoShardedBot'
            fp.write(_bot_template.format(base=base, prefix=args.prefix))
    except OSError as exc:
        parser.error(f'could not create bot file ({exc})')

    if not args.no_git:
        try:
            with open(str(new_directory / '.gitignore'), 'w', encoding='utf-8') as fp:
                fp.write(_gitignore_template)
        except OSError as exc:
            print(f'warning: could not create .gitignore file ({exc})')

    print('successfully made bot at', new_directory)


def newcog(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
    cog_dir = to_path(parser, args.directory)
    try:
        cog_dir.mkdir(exist_ok=True)
    except OSError as exc:
        print(f'warning: could not create cogs directory ({exc})')

    directory = cog_dir / to_path(parser, args.name)
    directory = directory.with_suffix('.py')
    try:
        with open(str(directory), 'w', encoding='utf-8') as fp:
            attrs = ''
            extra = _cog_extras if args.full else ''
            if args.class_name:
                name = args.class_name
            else:
                name = str(directory.stem)
                if '-' in name or '_' in name:
                    translation = str.maketrans('-_', '  ')
                    name = name.translate(translation).title().replace(' ', '')
                else:
                    name = name.title()

            if args.display_name:
                attrs += f', name="{args.display_name}"'
            if args.hide_commands:
                attrs += ', command_attrs=dict(hidden=True)'
            fp.write(_cog_template.format(name=name, extra=extra, attrs=attrs))
    except OSError as exc:
        parser.error(f'could not create cog file ({exc})')
    else:
        print('successfully made cog at', directory)


def add_newbot_args(subparser: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
    parser = subparser.add_parser('newbot', help='creates a command bot project quickly')
    parser.set_defaults(func=newbot)

    parser.add_argument('name', help='the bot project name')
    parser.add_argument('directory', help='the directory to place it in (default: .)', nargs='?', default=Path.cwd())
    parser.add_argument('--prefix', help='the bot prefix (default: $)', default='$', metavar='<prefix>')
    parser.add_argument('--sharded', help='whether to use AutoShardedBot', action='store_true')
    parser.add_argument('--no-git', help='do not create a .gitignore file', action='store_true', dest='no_git')


def add_newcog_args(subparser: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
    parser = subparser.add_parser('newcog', help='creates a new cog template quickly')
    parser.set_defaults(func=newcog)

    parser.add_argument('name', help='the cog name')
    parser.add_argument('directory', help='the directory to place it in (default: cogs)', nargs='?', default=Path('cogs'))
    parser.add_argument('--class-name', help='the class name of the cog (default: <name>)', dest='class_name')
    parser.add_argument('--display-name', help='the cog name (default: <name>)')
    parser.add_argument('--hide-commands', help='whether to hide all commands in the cog', action='store_true')
    parser.add_argument('--full', help='add all special methods as well', action='store_true')


def parse_args() -> Tuple[argparse.ArgumentParser, argparse.Namespace]:
    parser = argparse.ArgumentParser(prog='discord', description='Tools for helping with discord.py')
    parser.add_argument('-v', '--version', action='store_true', help='shows the library version')
    parser.set_defaults(func=core)

    subparser = parser.add_subparsers(dest='subcommand', title='subcommands')
    add_newbot_args(subparser)
    add_newcog_args(subparser)
    return parser, parser.parse_args()


def main() -> None:
    parser, args = parse_args()
    args.func(parser, args)


if __name__ == '__main__':
    main()


================================================
FILE: discord/_types.py
================================================
"""
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations
from typing import TypeVar, TYPE_CHECKING

if TYPE_CHECKING:
    from typing_extensions import TypeVar
    from .client import Client

    ClientT = TypeVar('ClientT', bound=Client, covariant=True, default=Client)
else:
    ClientT = TypeVar('ClientT', bound='Client', covariant=True)


================================================
FILE: discord/abc.py
================================================
"""
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations

import copy
import time
import secrets
import asyncio
from datetime import datetime
from typing import (
    Any,
    AsyncIterator,
    Callable,
    Dict,
    Generator,
    Iterable,
    List,
    Literal,
    Optional,
    TYPE_CHECKING,
    Protocol,
    Sequence,
    Tuple,
    TypeVar,
    Union,
    overload,
    runtime_checkable,
)

from .object import OLDEST_OBJECT, Object
from .context_managers import Typing
from .enums import ChannelType, InviteTarget
from .errors import ClientException, NotFound
from .mentions import AllowedMentions
from .permissions import PermissionOverwrite, Permissions
from .role import Role
from .invite import Invite
from .file import File
from .http import handle_message_parameters
from .voice_client import VoiceClient, VoiceProtocol
from .sticker import GuildSticker, StickerItem
from . import utils
from .flags import InviteFlags
import warnings

__all__ = (
    'Snowflake',
    'User',
    'PrivateChannel',
    'GuildChannel',
    'Messageable',
    'Connectable',
)

T = TypeVar('T', bound=VoiceProtocol)

if TYPE_CHECKING:
    from typing_extensions import Self, Unpack

    from .client import Client
    from .user import ClientUser
    from .asset import Asset
    from .state import ConnectionState
    from .guild import Guild
    from .member import Member
    from .channel import CategoryChannel
    from .embeds import Embed
    from .message import Message, MessageReference, PartialMessage
    from .channel import (
        TextChannel,
        DMChannel,
        GroupChannel,
        PartialMessageable,
        VocalGuildChannel,
        VoiceChannel,
        StageChannel,
    )
    from .poll import Poll
    from .threads import Thread
    from .ui.view import BaseView, View, LayoutView
    from .types.channel import (
        PermissionOverwrite as PermissionOverwritePayload,
        Channel as ChannelPayload,
        GuildChannel as GuildChannelPayload,
        OverwriteType,
    )
    from .types.guild import (
        ChannelPositionUpdate,
    )
    from .types.snowflake import (
        SnowflakeList,
    )
    from .permissions import _PermissionOverwriteKwargs

    PartialMessageableChannel = Union[TextChannel, VoiceChannel, StageChannel, Thread, DMChannel, PartialMessageable]
    MessageableChannel = Union[PartialMessageableChannel, GroupChannel]
    SnowflakeTime = Union['Snowflake', datetime]

    class PinnedMessage(Message):
        pinned_at: datetime
        pinned: Literal[True]


MISSING = utils.MISSING


class _Undefined:
    def __repr__(self) -> str:
        return 'see-below'


_undefined: Any = _Undefined()


class _PinsIterator:
    def __init__(self, iterator: AsyncIterator[PinnedMessage]) -> None:
        self.__iterator: AsyncIterator[PinnedMessage] = iterator

    def __await__(self) -> Generator[Any, None, List[PinnedMessage]]:
        warnings.warn(
            '`await <channel>.pins()` is deprecated; use `async for message in <channel>.pins()` instead.',
            DeprecationWarning,
            stacklevel=2,
        )

        async def gather() -> List[PinnedMessage]:
            return [msg async for msg in self.__iterator]

        return gather().__await__()

    def __aiter__(self) -> AsyncIterator[PinnedMessage]:
        return self.__iterator


async def _single_delete_strategy(messages: Iterable[Message], *, reason: Optional[str] = None):
    for m in messages:
        try:
            await m.delete()
        except NotFound as exc:
            if exc.code == 10008:
                continue  # bulk deletion ignores not found messages, single deletion does not.
            # several other race conditions with deletion should fail without continuing,
            # such as the channel being deleted and not found.
            raise


async def _purge_helper(
    channel: Union[Thread, TextChannel, VocalGuildChannel],
    *,
    limit: Optional[int] = 100,
    check: Callable[[Message], bool] = MISSING,
    before: Optional[SnowflakeTime] = None,
    after: Optional[SnowflakeTime] = None,
    around: Optional[SnowflakeTime] = None,
    oldest_first: Optional[bool] = None,
    bulk: bool = True,
    reason: Optional[str] = None,
) -> List[Message]:
    if check is MISSING:
        check = lambda m: True

    iterator = channel.history(limit=limit, before=before, after=after, oldest_first=oldest_first, around=around)
    ret: List[Message] = []
    count = 0

    minimum_time = int((time.time() - 14 * 24 * 60 * 60) * 1000.0 - 1420070400000) << 22
    strategy = channel.delete_messages if bulk else _single_delete_strategy

    async for message in iterator:
        if count == 100:
            to_delete = ret[-100:]
            await strategy(to_delete, reason=reason)
            count = 0
            await asyncio.sleep(1)

        if not message.type.is_deletable():
            continue

        if not check(message):
            continue

        if message.id < minimum_time:
            # older than 14 days old
            if count == 1:
                await ret[-1].delete()
            elif count >= 2:
                to_delete = ret[-count:]
                await strategy(to_delete, reason=reason)

            count = 0
            strategy = _single_delete_strategy

        count += 1
        ret.append(message)

    # Some messages remaining to poll
    if count >= 2:
        # more than 2 messages -> bulk delete
        to_delete = ret[-count:]
        await strategy(to_delete, reason=reason)
    elif count == 1:
        # delete a single message
        await ret[-1].delete()

    return ret


@runtime_checkable
class Snowflake(Protocol):
    """An ABC that details the common operations on a Discord model.

    Almost all :ref:`Discord models <discord_api_models>` meet this
    abstract base class.

    If you want to create a snowflake on your own, consider using
    :class:`.Object`.

    Attributes
    -----------
    id: :class:`int`
        The model's unique ID.
    """

    id: int


@runtime_checkable
class User(Snowflake, Protocol):
    """An ABC that details the common operations on a Discord user.

    The following implement this ABC:

    - :class:`~discord.User`
    - :class:`~discord.ClientUser`
    - :class:`~discord.Member`

    This ABC must also implement :class:`~discord.abc.Snowflake`.

    Attributes
    -----------
    name: :class:`str`
        The user's username.
    discriminator: :class:`str`
        The user's discriminator. This is a legacy concept that is no longer used.
    global_name: Optional[:class:`str`]
        The user's global nickname.
    bot: :class:`bool`
        If the user is a bot account.
    system: :class:`bool`
        If the user is a system account.
    """

    name: str
    discriminator: str
    global_name: Optional[str]
    bot: bool
    system: bool

    @property
    def display_name(self) -> str:
        """:class:`str`: Returns the user's display name."""
        raise NotImplementedError

    @property
    def mention(self) -> str:
        """:class:`str`: Returns a string that allows you to mention the given user."""
        raise NotImplementedError

    @property
    def avatar(self) -> Optional[Asset]:
        """Optional[:class:`~discord.Asset`]: Returns an Asset that represents the user's avatar, if present."""
        raise NotImplementedError

    @property
    def avatar_decoration(self) -> Optional[Asset]:
        """Optional[:class:`~discord.Asset`]: Returns an Asset that represents the user's avatar decoration, if present.

        .. versionadded:: 2.4
        """
        raise NotImplementedError

    @property
    def avatar_decoration_sku_id(self) -> Optional[int]:
        """Optional[:class:`int`]: Returns an integer that represents the user's avatar decoration SKU ID, if present.

        .. versionadded:: 2.4
        """
        raise NotImplementedError

    @property
    def default_avatar(self) -> Asset:
        """:class:`~discord.Asset`: Returns the default avatar for a given user."""
        raise NotImplementedError

    @property
    def display_avatar(self) -> Asset:
        """:class:`~discord.Asset`: Returns the user's display avatar.

        For regular users this is just their default avatar or uploaded avatar.

        .. versionadded:: 2.0
        """
        raise NotImplementedError

    def mentioned_in(self, message: Message) -> bool:
        """Checks if the user is mentioned in the specified message.

        Parameters
        -----------
        message: :class:`~discord.Message`
            The message to check if you're mentioned in.

        Returns
        -------
        :class:`bool`
            Indicates if the user is mentioned in the message.
        """
        raise NotImplementedError


class PrivateChannel:
    """An ABC that details the common operations on a private Discord channel.

    The following implement this ABC:

    - :class:`~discord.DMChannel`
    - :class:`~discord.GroupChannel`

    This ABC must also implement :class:`~discord.abc.Snowflake`.

    Attributes
    -----------
    me: :class:`~discord.ClientUser`
        The user presenting yourself.
    """

    __slots__ = ()

    id: int
    me: ClientUser


class _Overwrites:
    __slots__ = ('id', 'allow', 'deny', 'type')

    ROLE = 0
    MEMBER = 1

    def __init__(self, data: PermissionOverwritePayload) -> None:
        self.id: int = int(data['id'])
        self.allow: int = int(data.get('allow', 0))
        self.deny: int = int(data.get('deny', 0))
        self.type: OverwriteType = data['type']

    def _asdict(self) -> PermissionOverwritePayload:
        return {
            'id': self.id,
            'allow': str(self.allow),
            'deny': str(self.deny),
            'type': self.type,
        }

    def is_role(self) -> bool:
        return self.type == 0

    def is_member(self) -> bool:
        return self.type == 1


class GuildChannel:
    """An ABC that details the common operations on a Discord guild channel.

    The following implement this ABC:

    - :class:`~discord.TextChannel`
    - :class:`~discord.VoiceChannel`
    - :class:`~discord.CategoryChannel`
    - :class:`~discord.StageChannel`
    - :class:`~discord.ForumChannel`

    This ABC must also implement :class:`~discord.abc.Snowflake`.

    Attributes
    -----------
    name: :class:`str`
        The channel name.
    guild: :class:`~discord.Guild`
        The guild the channel belongs to.
    position: :class:`int`
        The position in the channel list. This is a number that starts at 0.
        e.g. the top channel is position 0.
    """

    __slots__ = ()

    id: int
    name: str
    guild: Guild
    type: ChannelType
    position: int
    category_id: Optional[int]
    _state: ConnectionState
    _overwrites: List[_Overwrites]

    if TYPE_CHECKING:

        def __init__(self, *, state: ConnectionState, guild: Guild, data: GuildChannelPayload): ...

    def __str__(self) -> str:
        return self.name

    @property
    def _sorting_bucket(self) -> int:
        raise NotImplementedError

    def _update(self, guild: Guild, data: Dict[str, Any]) -> None:
        raise NotImplementedError

    async def _move(
        self,
        position: int,
        parent_id: Optional[Any] = None,
        lock_permissions: bool = False,
        *,
        reason: Optional[str],
    ) -> None:
        if position < 0:
            raise ValueError('Channel position cannot be less than 0.')

        http = self._state.http
        bucket = self._sorting_bucket
        channels: List[GuildChannel] = [c for c in self.guild.channels if c._sorting_bucket == bucket]

        channels.sort(key=lambda c: c.position)

        try:
            # remove ourselves from the channel list
            channels.remove(self)
        except ValueError:
            # not there somehow lol
            return
        else:
            index = next((i for i, c in enumerate(channels) if c.position >= position), len(channels))
            # add ourselves at our designated position
            channels.insert(index, self)

        payload = []
        for index, c in enumerate(channels):
            d: Dict[str, Any] = {'id': c.id, 'position': index}
            if parent_id is not _undefined and c.id == self.id:
                d.update(parent_id=parent_id, lock_permissions=lock_permissions)
            payload.append(d)

        await http.bulk_channel_update(self.guild.id, payload, reason=reason)

    async def _edit(self, options: Dict[str, Any], reason: Optional[str]) -> Optional[ChannelPayload]:
        try:
            parent = options.pop('category')
        except KeyError:
            parent_id = _undefined
        else:
            parent_id = parent and parent.id

        try:
            options['rate_limit_per_user'] = options.pop('slowmode_delay')
        except KeyError:
            pass

        try:
            options['default_thread_rate_limit_per_user'] = options.pop('default_thread_slowmode_delay')
        except KeyError:
            pass

        try:
            rtc_region = options.pop('rtc_region')
        except KeyError:
            pass
        else:
            options['rtc_region'] = None if rtc_region is None else str(rtc_region)

        try:
            video_quality_mode = options.pop('video_quality_mode')
        except KeyError:
            pass
        else:
            options['video_quality_mode'] = int(video_quality_mode)

        lock_permissions = options.pop('sync_permissions', False)

        try:
            position = options.pop('position')
        except KeyError:
            if parent_id is not _undefined:
                if lock_permissions:
                    category = self.guild.get_channel(parent_id)
                    if category:
                        options['permission_overwrites'] = [c._asdict() for c in category._overwrites]
                options['parent_id'] = parent_id
            elif lock_permissions and self.category_id is not None:
                # if we're syncing permissions on a pre-existing channel category without changing it
                # we need to update the permissions to point to the pre-existing category
                category = self.guild.get_channel(self.category_id)
                if category:
                    options['permission_overwrites'] = [c._asdict() for c in category._overwrites]
        else:
            await self._move(position, parent_id=parent_id, lock_permissions=lock_permissions, reason=reason)

        overwrites = options.get('overwrites', None)
        if overwrites is not None:
            perms = []
            for target, perm in overwrites.items():
                if not isinstance(perm, PermissionOverwrite):
                    raise TypeError(f'Expected PermissionOverwrite received {perm.__class__.__name__}')

                allow, deny = perm.pair()
                payload = {
                    'allow': allow.value,
                    'deny': deny.value,
                    'id': target.id,
                }

                if isinstance(target, Role):
                    payload['type'] = _Overwrites.ROLE
                elif isinstance(target, Object):
                    payload['type'] = _Overwrites.ROLE if target.type is Role else _Overwrites.MEMBER
                else:
                    payload['type'] = _Overwrites.MEMBER

                perms.append(payload)
            options['permission_overwrites'] = perms

        try:
            ch_type = options['type']
        except KeyError:
            pass
        else:
            if not isinstance(ch_type, ChannelType):
                raise TypeError('type field must be of type ChannelType')
            options['type'] = ch_type.value

        try:
            status = options.pop('status')
        except KeyError:
            pass
        else:
            await self._state.http.edit_voice_channel_status(status, channel_id=self.id, reason=reason)

        if options:
            return await self._state.http.edit_channel(self.id, reason=reason, **options)

    def _fill_overwrites(self, data: GuildChannelPayload) -> None:
        self._overwrites = []
        everyone_index = 0
        everyone_id = self.guild.id

        for index, overridden in enumerate(data.get('permission_overwrites', [])):
            overwrite = _Overwrites(overridden)
            self._overwrites.append(overwrite)

            if overwrite.type == _Overwrites.MEMBER:
                continue

            if overwrite.id == everyone_id:
                # the @everyone role is not guaranteed to be the first one
                # in the list of permission overwrites, however the permission
                # resolution code kind of requires that it is the first one in
                # the list since it is special. So we need the index so we can
                # swap it to be the first one.
                everyone_index = index

        # do the swap
        tmp = self._overwrites
        if tmp:
            tmp[everyone_index], tmp[0] = tmp[0], tmp[everyone_index]

    @property
    def changed_roles(self) -> List[Role]:
        """List[:class:`~discord.Role`]: Returns a list of roles that have been overridden from
        their default values in the :attr:`~discord.Guild.roles` attribute."""
        ret = []
        g = self.guild
        for overwrite in filter(lambda o: o.is_role(), self._overwrites):
            role = g.get_role(overwrite.id)
            if role is None:
                continue

            role = copy.copy(role)
            role.permissions.handle_overwrite(overwrite.allow, overwrite.deny)
            ret.append(role)
        return ret

    @property
    def mention(self) -> str:
        """:class:`str`: The string that allows you to mention the channel."""
        return f'<#{self.id}>'

    @property
    def jump_url(self) -> str:
        """:class:`str`: Returns a URL that allows the client to jump to the channel.

        .. versionadded:: 2.0
        """
        return f'https://discord.com/channels/{self.guild.id}/{self.id}'

    @property
    def created_at(self) -> datetime:
        """:class:`datetime.datetime`: Returns the channel's creation time in UTC."""
        return utils.snowflake_time(self.id)

    def overwrites_for(self, obj: Union[Role, User, Object]) -> PermissionOverwrite:
        """Returns the channel-specific overwrites for a member or a role.

        Parameters
        -----------
        obj: Union[:class:`~discord.Role`, :class:`~discord.abc.User`, :class:`~discord.Object`]
            The role or user denoting whose overwrite to get.

        Returns
        ---------
        :class:`~discord.PermissionOverwrite`
            The permission overwrites for this object.
        """

        if isinstance(obj, User):
            predicate = lambda p: p.is_member()
        elif isinstance(obj, Role):
            predicate = lambda p: p.is_role()
        else:
            predicate = lambda p: True

        for overwrite in filter(predicate, self._overwrites):
            if overwrite.id == obj.id:
                allow = Permissions(overwrite.allow)
                deny = Permissions(overwrite.deny)
                return PermissionOverwrite.from_pair(allow, deny)

        return PermissionOverwrite()

    @property
    def overwrites(self) -> Dict[Union[Role, Member, Object], PermissionOverwrite]:
        """Returns all of the channel's overwrites.

        This is returned as a dictionary where the key contains the target which
        can be either a :class:`~discord.Role` or a :class:`~discord.Member` and the value is the
        overwrite as a :class:`~discord.PermissionOverwrite`.

        .. versionchanged:: 2.0
            Overwrites can now be type-aware :class:`~discord.Object` in case of cache lookup failure

        Returns
        --------
        Dict[Union[:class:`~discord.Role`, :class:`~discord.Member`, :class:`~discord.Object`], :class:`~discord.PermissionOverwrite`]
            The channel's permission overwrites.
        """
        ret = {}
        for ow in self._overwrites:
            allow = Permissions(ow.allow)
            deny = Permissions(ow.deny)
            overwrite = PermissionOverwrite.from_pair(allow, deny)
            target = None

            if ow.is_role():
                target = self.guild.get_role(ow.id)
            elif ow.is_member():
                target = self.guild.get_member(ow.id)

            if target is None:
                target_type = Role if ow.is_role() else User
                target = Object(id=ow.id, type=target_type)  # type: ignore

            ret[target] = overwrite
        return ret

    @property
    def category(self) -> Optional[CategoryChannel]:
        """Optional[:class:`~discord.CategoryChannel`]: The category this channel belongs to.

        If there is no category then this is ``None``.
        """
        return self.guild.get_channel(self.category_id)  # type: ignore # These are coerced into CategoryChannel

    @property
    def permissions_synced(self) -> bool:
        """:class:`bool`: Whether or not the permissions for this channel are synced with the
        category it belongs to.

        If there is no category then this is ``False``.

        .. versionadded:: 1.3
        """
        if self.category_id is None:
            return False

        category = self.guild.get_channel(self.category_id)
        return bool(category and category.overwrites == self.overwrites)

    def _apply_implicit_permissions(self, base: Permissions) -> None:
        # if you can't send a message in a channel then you can't have certain
        # permissions as well
        if not base.send_messages:
            base.send_tts_messages = False
            base.mention_everyone = False
            base.embed_links = False
            base.attach_files = False

        # if you can't read a channel then you have no permissions there
        if not base.read_messages:
            denied = Permissions.all_channel()
            base.value &= ~denied.value

    def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
        """Handles permission resolution for the :class:`~discord.Member`
        or :class:`~discord.Role`.

        This function takes into consideration the following cases:

        - Guild owner
        - Guild roles
        - Channel overrides
        - Member overrides
        - Implicit permissions
        - Member timeout
        - User installed app

        If a :class:`~discord.Role` is passed, then it checks the permissions
        someone with that role would have, which is essentially:

        - The default role permissions
        - The permissions of the role used as a parameter
        - The default role permission overwrites
        - The permission overwrites of the role used as a parameter

        .. versionchanged:: 2.0
            The object passed in can now be a role object.

        .. versionchanged:: 2.0
            ``obj`` parameter is now positional-only.

        .. versionchanged:: 2.4
            User installed apps are now taken into account.
            The permissions returned for a user installed app mirrors the
            permissions Discord returns in :attr:`~discord.Interaction.app_permissions`,
            though it is recommended to use that attribute instead.

        Parameters
        ----------
        obj: Union[:class:`~discord.Member`, :class:`~discord.Role`]
            The object to resolve permissions for. This could be either
            a member or a role. If it's a role then member overwrites
            are not computed.

        Returns
        -------
        :class:`~discord.Permissions`
            The resolved permissions for the member or role.
        """

        # The current cases can be explained as:
        # Guild owner get all permissions -- no questions asked. Otherwise...
        # The @everyone role gets the first application.
        # After that, the applied roles that the user has in the channel
        # (or otherwise) are then OR'd together.
        # After the role permissions are resolved, the member permissions
        # have to take into effect.
        # After all that is done.. you have to do the following:

        # If manage permissions is True, then all permissions are set to True.

        # The operation first takes into consideration the denied
        # and then the allowed.

        if self.guild.owner_id == obj.id:
            return Permissions.all()

        default = self.guild.default_role
        if default is None:
            if self._state.self_id == obj.id:
                return Permissions._user_installed_permissions(in_guild=True)
            else:
                return Permissions.none()

        base = Permissions(default.permissions.value)

        # Handle the role case first
        if isinstance(obj, Role):
            base.value |= obj._permissions

            if base.administrator:
                return Permissions.all()

            # Apply @everyone allow/deny first since it's special
            try:
                maybe_everyone = self._overwrites[0]
                if maybe_everyone.id == self.guild.id:
                    base.handle_overwrite(allow=maybe_everyone.allow, deny=maybe_everyone.deny)
            except IndexError:
                pass

            if obj.is_default():
                return base

            overwrite = utils.find(lambda ow: ow.type == _Overwrites.ROLE and ow.id == obj.id, self._overwrites)
            if overwrite is not None:
                base.handle_overwrite(overwrite.allow, overwrite.deny)

            return base

        roles = obj._roles
        get_role = self.guild.get_role

        # Apply guild roles that the member has.
        for role_id in roles:
            role = get_role(role_id)
            if role is not None:
                base.value |= role._permissions

        # Guild-wide Administrator -> True for everything
        # Bypass all channel-specific overrides
        if base.administrator:
            return Permissions.all()

        # Apply @everyone allow/deny first since it's special
        try:
            maybe_everyone = self._overwrites[0]
            if maybe_everyone.id == self.guild.id:
                base.handle_overwrite(allow=maybe_everyone.allow, deny=maybe_everyone.deny)
                remaining_overwrites = self._overwrites[1:]
            else:
                remaining_overwrites = self._overwrites
        except IndexError:
            remaining_overwrites = self._overwrites

        denies = 0
        allows = 0

        # Apply channel specific role permission overwrites
        for overwrite in remaining_overwrites:
            if overwrite.is_role() and roles.has(overwrite.id):
                denies |= overwrite.deny
                allows |= overwrite.allow

        base.handle_overwrite(allow=allows, deny=denies)

        # Apply member specific permission overwrites
        for overwrite in remaining_overwrites:
            if overwrite.is_member() and overwrite.id == obj.id:
                base.handle_overwrite(allow=overwrite.allow, deny=overwrite.deny)
                break

        if obj.is_timed_out():
            # Timeout leads to every permission except VIEW_CHANNEL and READ_MESSAGE_HISTORY
            # being explicitly denied
            # N.B.: This *must* come last, because it's a conclusive mask
            base.value &= Permissions._timeout_mask()

        return base

    async def delete(self, *, reason: Optional[str] = None) -> None:
        """|coro|

        Deletes the channel.

        You must have :attr:`~discord.Permissions.manage_channels` to do this.

        Parameters
        -----------
        reason: Optional[:class:`str`]
            The reason for deleting this channel.
            Shows up on the audit log.

        Raises
        -------
        ~discord.Forbidden
            You do not have proper permissions to delete the channel.
        ~discord.NotFound
            The channel was not found or was already deleted.
        ~discord.HTTPException
            Deleting the channel failed.
        """
        await self._state.http.delete_channel(self.id, reason=reason)

    @overload
    async def set_permissions(
        self,
        target: Union[Member, Role],
        *,
        overwrite: Optional[Union[PermissionOverwrite, _Undefined]] = ...,
        reason: Optional[str] = ...,
    ) -> None: ...

    @overload
    async def set_permissions(
        self,
        target: Union[Member, Role],
        *,
        reason: Optional[str] = ...,
        **permissions: Unpack[_PermissionOverwriteKwargs],
    ) -> None: ...

    async def set_permissions(
        self,
        target: Union[Member, Role],
        *,
        overwrite: Any = _undefined,
        reason: Optional[str] = None,
        **permissions: Unpack[_PermissionOverwriteKwargs],
    ) -> None:
        r"""|coro|

        Sets the channel specific permission overwrites for a target in the
        channel.

        The ``target`` parameter should either be a :class:`~discord.Member` or a
        :class:`~discord.Role` that belongs to guild.

        The ``overwrite`` parameter, if given, must either be ``None`` or
        :class:`~discord.PermissionOverwrite`. For convenience, you can pass in
        keyword arguments denoting :class:`~discord.Permissions` attributes. If this is
        done, then you cannot mix the keyword arguments with the ``overwrite``
        parameter.

        If the ``overwrite`` parameter is ``None``, then the permission
        overwrites are deleted.

        You must have :attr:`~discord.Permissions.manage_roles` to do this.

        .. note::

            This method *replaces* the old overwrites with the ones given.

        Examples
        ----------

        Setting allow and deny: ::

            await message.channel.set_permissions(message.author, read_messages=True,
                                                                  send_messages=False)

        Deleting overwrites ::

            await channel.set_permissions(member, overwrite=None)

        Using :class:`~discord.PermissionOverwrite` ::

            overwrite = discord.PermissionOverwrite()
            overwrite.send_messages = False
            overwrite.read_messages = True
            await channel.set_permissions(member, overwrite=overwrite)

        .. versionchanged:: 2.0
            This function will now raise :exc:`TypeError` instead of
            ``InvalidArgument``.


        Parameters
        -----------
        target: Union[:class:`~discord.Member`, :class:`~discord.Role`]
            The member or role to overwrite permissions for.
        overwrite: Optional[:class:`~discord.PermissionOverwrite`]
            The permissions to allow and deny to the target, or ``None`` to
            delete the overwrite.
        \*\*permissions
            A keyword argument list of permissions to set for ease of use.
            Cannot be mixed with ``overwrite``.
        reason: Optional[:class:`str`]
            The reason for doing this action. Shows up on the audit log.

        Raises
        -------
        ~discord.Forbidden
            You do not have permissions to edit channel specific permissions.
        ~discord.HTTPException
            Editing channel specific permissions failed.
        ~discord.NotFound
            The role or member being edited is not part of the guild.
        TypeError
            The ``overwrite`` parameter was invalid or the target type was not
            :class:`~discord.Role` or :class:`~discord.Member`.
        ValueError
            The ``overwrite`` parameter and ``positions`` parameters were both
            unset.
        """

        http = self._state.http

        if isinstance(target, User):
            perm_type = _Overwrites.MEMBER
        elif isinstance(target, Role):
            perm_type = _Overwrites.ROLE
        else:
            raise ValueError('target parameter must be either Member or Role')

        if overwrite is _undefined:
            if len(permissions) == 0:
                raise ValueError('No overwrite provided.')
            try:
                overwrite = PermissionOverwrite(**permissions)
            except (ValueError, TypeError):
                raise TypeError('Invalid permissions given to keyword arguments.')
        else:
            if len(permissions) > 0:
                raise TypeError('Cannot mix overwrite and keyword arguments.')

        if overwrite is None:
            await http.delete_channel_permissions(self.id, target.id, reason=reason)
        elif isinstance(overwrite, PermissionOverwrite):
            (allow, deny) = overwrite.pair()
            await http.edit_channel_permissions(
                self.id, target.id, str(allow.value), str(deny.value), perm_type, reason=reason
            )
        else:
            raise TypeError('Invalid overwrite type provided.')

    async def _clone_impl(
        self,
        base_attrs: Dict[str, Any],
        *,
        name: Optional[str] = None,
        category: Optional[CategoryChannel] = None,
        reason: Optional[str] = None,
    ) -> Self:
        base_attrs['permission_overwrites'] = [x._asdict() for x in self._overwrites]
        base_attrs['parent_id'] = self.category_id
        base_attrs['name'] = name or self.name
        if category is not None:
            base_attrs['parent_id'] = category.id

        guild_id = self.guild.id
        cls = self.__class__
        data = await self._state.http.create_channel(guild_id, self.type.value, reason=reason, **base_attrs)
        obj = cls(state=self._state, guild=self.guild, data=data)

        # temporarily add it to the cache
        self.guild._channels[obj.id] = obj  # type: ignore # obj is a GuildChannel
        return obj

    async def clone(
        self,
        *,
        name: Optional[str] = None,
        category: Optional[CategoryChannel] = None,
        reason: Optional[str] = None,
    ) -> Self:
        """|coro|

        Clones this channel. This creates a channel with the same properties
        as this channel.

        You must have :attr:`~discord.Permissions.manage_channels` to do this.

        .. versionadded:: 1.1

        Parameters
        ------------
        name: Optional[:class:`str`]
            The name of the new channel. If not provided, defaults to this
            channel name.
        category: Optional[:class:`~discord.CategoryChannel`]
            The category the new channel belongs to.
            This parameter is ignored if cloning a category channel.

            .. versionadded:: 2.5
        reason: Optional[:class:`str`]
            The reason for cloning this channel. Shows up on the audit log.

        Raises
        -------
        ~discord.Forbidden
            You do not have the proper permissions to create this channel.
        ~discord.HTTPException
            Creating the channel failed.

        Returns
        --------
        :class:`.abc.GuildChannel`
            The channel that was created.
        """
        raise NotImplementedError

    @overload
    async def move(
        self,
        *,
        beginning: bool,
        offset: int = MISSING,
        category: Optional[Snowflake] = MISSING,
        sync_permissions: bool = MISSING,
        reason: Optional[str] = MISSING,
    ) -> None: ...

    @overload
    async def move(
        self,
        *,
        end: bool,
        offset: int = MISSING,
        category: Optional[Snowflake] = MISSING,
        sync_permissions: bool = MISSING,
        reason: str = MISSING,
    ) -> None: ...

    @overload
    async def move(
        self,
        *,
        before: Snowflake,
        offset: int = MISSING,
        category: Optional[Snowflake] = MISSING,
        sync_permissions: bool = MISSING,
        reason: str = MISSING,
    ) -> None: ...

    @overload
    async def move(
        self,
        *,
        after: Snowflake,
        offset: int = MISSING,
        category: Optional[Snowflake] = MISSING,
        sync_permissions: bool = MISSING,
        reason: str = MISSING,
    ) -> None: ...

    async def move(self, **kwargs: Any) -> None:
        """|coro|

        A rich interface to help move a channel relative to other channels.

        If exact position movement is required, ``edit`` should be used instead.

        You must have :attr:`~discord.Permissions.manage_channels` to do this.

        .. note::

            Voice channels will always be sorted below text channels.
            This is a Discord limitation.

        .. versionadded:: 1.7

        .. versionchanged:: 2.0
            This function will now raise :exc:`TypeError` or
            :exc:`ValueError` instead of ``InvalidArgument``.

        Parameters
        ------------
        beginning: :class:`bool`
            Whether to move the channel to the beginning of the
            channel list (or category if given).
            This is mutually exclusive with ``end``, ``before``, and ``after``.
        end: :class:`bool`
            Whether to move the channel to the end of the
            channel list (or category if given).
            This is mutually exclusive with ``beginning``, ``before``, and ``after``.
        before: :class:`~discord.abc.Snowflake`
            Whether to move the channel before the given channel.
            This is mutually exclusive with ``beginning``, ``end``, and ``after``.
        after: :class:`~discord.abc.Snowflake`
            Whether to move the channel after the given channel.
            This is mutually exclusive with ``beginning``, ``end``, and ``before``.
        offset: :class:`int`
            The number of channels to offset the move by. For example,
            an offset of ``2`` with ``beginning=True`` would move
            it 2 after the beginning. A positive number moves it below
            while a negative number moves it above. Note that this
            number is relative and computed after the ``beginning``,
            ``end``, ``before``, and ``after`` parameters.
        category: Optional[:class:`~discord.abc.Snowflake`]
            The category to move this channel under.
            If ``None`` is given then it moves it out of the category.
            This parameter is ignored if moving a category channel.
        sync_permissions: :class:`bool`
            Whether to sync the permissions with the category (if given).
        reason: :class:`str`
            The reason for the move.

        Raises
        -------
        ValueError
            An invalid position was given.
        TypeError
            A bad mix of arguments were passed.
        Forbidden
            You do not have permissions to move the channel.
        HTTPException
            Moving the channel failed.
        """

        if not kwargs:
            return

        beginning, end = kwargs.get('beginning'), kwargs.get('end')
        before, after = kwargs.get('before'), kwargs.get('after')
        offset = kwargs.get('offset', 0)
        if sum(bool(a) for a in (beginning, end, before, after)) > 1:
            raise TypeError('Only one of [before, after, end, beginning] can be used.')

        bucket = self._sorting_bucket
        parent_id = kwargs.get('category', MISSING)
        # fmt: off
        channels: List[GuildChannel]
        if parent_id not in (MISSING, None):
            parent_id = parent_id.id
            channels = [
                ch
                for ch in self.guild.channels
                if ch._sorting_bucket == bucket
                and ch.category_id == parent_id
            ]
        else:
            channels = [
                ch
                for ch in self.guild.channels
                if ch._sorting_bucket == bucket
                and ch.category_id == self.category_id
            ]
        # fmt: on

        channels.sort(key=lambda c: (c.position, c.id))

        try:
            # Try to remove ourselves from the channel list
            channels.remove(self)
        except ValueError:
            # If we're not there then it's probably due to not being in the category
            pass

        index = None
        if beginning:
            index = 0
        elif end:
            index = len(channels)
        elif before:
            index = next((i for i, c in enumerate(channels) if c.id == before.id), None)
        elif after:
            index = next((i + 1 for i, c in enumerate(channels) if c.id == after.id), None)

        if index is None:
            raise ValueError('Could not resolve appropriate move position')

        channels.insert(max((index + offset), 0), self)
        payload: List[ChannelPositionUpdate] = []
        lock_permissions = kwargs.get('sync_permissions', False)
        reason = kwargs.get('reason')
        for index, channel in enumerate(channels):
            d: ChannelPositionUpdate = {'id': channel.id, 'position': index}
            if parent_id is not MISSING and channel.id == self.id:
                d.update(parent_id=parent_id, lock_permissions=lock_permissions)
            payload.append(d)

        await self._state.http.bulk_channel_update(self.guild.id, payload, reason=reason)

    async def create_invite(
        self,
        *,
        reason: Optional[str] = None,
        max_age: int = 0,
        max_uses: int = 0,
        temporary: bool = False,
        unique: bool = True,
        target_type: Optional[InviteTarget] = None,
        target_user: Optional[User] = None,
        target_application_id: Optional[int] = None,
        guest: bool = False,
    ) -> Invite:
        """|coro|

        Creates an instant invite from a text or voice channel.

        You must have :attr:`~discord.Permissions.create_instant_invite` to do this.

        Parameters
        ------------
        max_age: :class:`int`
            How long the invite should last in seconds. If it's 0 then the invite
            doesn't expire. Defaults to ``0``.
        max_uses: :class:`int`
            How many uses the invite could be used for. If it's 0 then there
            are unlimited uses. Defaults to ``0``.
        temporary: :class:`bool`
            Denotes that the invite grants temporary membership
            (i.e. they get kicked after they disconnect). Defaults to ``False``.
        unique: :class:`bool`
            Indicates if a unique invite URL should be created. Defaults to True.
            If this is set to ``False`` then it will return a previously created
            invite.
        reason: Optional[:class:`str`]
            The reason for creating this invite. Shows up on the audit log.
        target_type: Optional[:class:`.InviteTarget`]
            The type of target for the voice channel invite, if any.

            .. versionadded:: 2.0

        target_user: Optional[:class:`User`]
            The user whose stream to display for this invite, required if ``target_type`` is :attr:`.InviteTarget.stream`. The user must be streaming in the channel.

            .. versionadded:: 2.0

        target_application_id:: Optional[:class:`int`]
            The id of the embedded application for the invite, required if ``target_type`` is :attr:`.InviteTarget.embedded_application`.

            .. versionadded:: 2.0
        guest: :class:`bool`
            Whether the invite is a guest invite.

            .. versionadded:: 2.6

        Raises
        -------
        ~discord.HTTPException
            Invite creation failed.

        ~discord.NotFound
            The channel that was passed is a category or an invalid channel.

        Returns
        --------
        :class:`~discord.Invite`
            The invite that was created.
        """
        if target_type is InviteTarget.unknown:
            raise ValueError('Cannot create invite with an unknown target type')

        flags: Optional[InviteFlags] = None
        if guest:
            flags = InviteFlags._from_value(0)
            flags.guest = True

        data = await self._state.http.create_invite(
            self.id,
            reason=reason,
            max_age=max_age,
            max_uses=max_uses,
            temporary=temporary,
            unique=unique,
            target_type=target_type.value if target_type else None,
            target_user_id=target_user.id if target_user else None,
            target_application_id=target_application_id,
            flags=flags.value if flags else None,
        )
        return Invite.from_incomplete(data=data, state=self._state)

    async def invites(self) -> List[Invite]:
        """|coro|

        Returns a list of all active instant invites from this channel.

        You must have :attr:`~discord.Permissions.manage_channels` to get this information.

        Raises
        -------
        ~discord.Forbidden
            You do not have proper permissions to get the information.
        ~discord.HTTPException
            An error occurred while fetching the information.

        Returns
        -------
        List[:class:`~discord.Invite`]
            The list of invites that are currently active.
        """

        state = self._state
        data = await state.http.invites_from_channel(self.id)
        guild = self.guild
        return [Invite(state=state, data=invite, channel=self, guild=guild) for invite in data]


class Messageable:
    """An ABC that details the common operations on a model that can send messages.

    The following classes implement this ABC:

    - :class:`~discord.TextChannel`
    - :class:`~discord.VoiceChannel`
    - :class:`~discord.StageChannel`
    - :class:`~discord.DMChannel`
    - :class:`~discord.GroupChannel`
    - :class:`~discord.PartialMessageable`
    - :class:`~discord.User`
    - :class:`~discord.Member`
    - :class:`~discord.ext.commands.Context`
    - :class:`~discord.Thread`
    """

    __slots__ = ()
    _state: ConnectionState

    async def _get_channel(self) -> MessageableChannel:
        raise NotImplementedError

    @overload
    async def send(
        self,
        *,
        file: File = ...,
        delete_after: float = ...,
        nonce: Union[str, int] = ...,
        allowed_mentions: AllowedMentions = ...,
        reference: Union[Message, MessageReference, PartialMessage] = ...,
        mention_author: bool = ...,
        view: LayoutView,
        suppress_embeds: bool = ...,
        silent: bool = ...,
    ) -> Message: ...

    @overload
    async def send(
        self,
        *,
        files: Sequence[File] = ...,
        delete_after: float = ...,
        nonce: Union[str, int] = ...,
        allowed_mentions: AllowedMentions = ...,
        reference: Union[Message, MessageReference, PartialMessage] = ...,
        mention_author: bool = ...,
        view: LayoutView,
        suppress_embeds: bool = ...,
        silent: bool = ...,
    ) -> Message: ...

    @overload
    async def send(
        self,
        content: Optional[str] = ...,
        *,
        tts: bool = ...,
        embed: Embed = ...,
        file: File = ...,
        stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
        delete_after: float = ...,
        nonce: Union[str, int] = ...,
        allowed_mentions: AllowedMentions = ...,
        reference: Union[Message, MessageReference, PartialMessage] = ...,
        mention_author: bool = ...,
        view: View = ...,
        suppress_embeds: bool = ...,
        silent: bool = ...,
        poll: Poll = ...,
    ) -> Message: ...

    @overload
    async def send(
        self,
        content: Optional[str] = ...,
        *,
        tts: bool = ...,
        embed: Embed = ...,
        files: Sequence[File] = ...,
        stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
        delete_after: float = ...,
        nonce: Union[str, int] = ...,
        allowed_mentions: AllowedMentions = ...,
        reference: Union[Message, MessageReference, PartialMessage] = ...,
        mention_author: bool = ...,
        view: View = ...,
        suppress_embeds: bool = ...,
        silent: bool = ...,
        poll: Poll = ...,
    ) -> Message: ...

    @overload
    async def send(
        self,
        content: Optional[str] = ...,
        *,
        tts: bool = ...,
        embeds: Sequence[Embed] = ...,
        file: File = ...,
        stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
        delete_after: float = ...,
        nonce: Union[str, int] = ...,
        allowed_mentions: AllowedMentions = ...,
        reference: Union[Message, MessageReference, PartialMessage] = ...,
        mention_author: bool = ...,
        view: View = ...,
        suppress_embeds: bool = ...,
        silent: bool = ...,
        poll: Poll = ...,
    ) -> Message: ...

    @overload
    async def send(
        self,
        content: Optional[str] = ...,
        *,
        tts: bool = ...,
        embeds: Sequence[Embed] = ...,
        files: Sequence[File] = ...,
        stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
        delete_after: float = ...,
        nonce: Union[str, int] = ...,
        allowed_mentions: AllowedMentions = ...,
        reference: Union[Message, MessageReference, PartialMessage] = ...,
        mention_author: bool = ...,
        view: View = ...,
        suppress_embeds: bool = ...,
        silent: bool = ...,
        poll: Poll = ...,
    ) -> Message: ...

    async def send(
        self,
        content: Optional[str] = None,
        *,
        tts: bool = False,
        embed: Optional[Embed] = None,
        embeds: Optional[Sequence[Embed]] = None,
        file: Optional[File] = None,
        files: Optional[Sequence[File]] = None,
        stickers: Optional[Sequence[Union[GuildSticker, StickerItem]]] = None,
        delete_after: Optional[float] = None,
        nonce: Optional[Union[str, int]] = None,
        allowed_mentions: Optional[AllowedMentions] = None,
        reference: Optional[Union[Message, MessageReference, PartialMessage]] = None,
        mention_author: Optional[bool] = None,
        view: Optional[BaseView] = None,
        suppress_embeds: bool = False,
        silent: bool = False,
        poll: Optional[Poll] = None,
    ) -> Message:
        """|coro|

        Sends a message to the destination with the content given.

        The content must be a type that can convert to a string through ``str(content)``.
        If the content is set to ``None`` (the default), then the ``embed`` parameter must
        be provided.

        To upload a single file, the ``file`` parameter should be used with a
        single :class:`~discord.File` object. To upload multiple files, the ``files``
        parameter should be used with a :class:`list` of :class:`~discord.File` objects.
        **Specifying both parameters will lead to an exception**.

        To upload a single embed, the ``embed`` parameter should be used with a
        single :class:`~discord.Embed` object. To upload multiple embeds, the ``embeds``
        parameter should be used with a :class:`list` of :class:`~discord.Embed` objects.
        **Specifying both parameters will lead to an exception**.

        .. versionchanged:: 2.0
            This function will now raise :exc:`TypeError` or
            :exc:`ValueError` instead of ``InvalidArgument``.

        Parameters
        ------------
        content: Optional[:class:`str`]
            The content of the message to send.
        tts: :class:`bool`
            Indicates if the message should be sent using text-to-speech.
        embed: :class:`~discord.Embed`
            The rich embed for the content.
        embeds: List[:class:`~discord.Embed`]
            A list of embeds to upload. Must be a maximum of 10.

            .. versionadded:: 2.0
        file: :class:`~discord.File`
            The file to upload.
        files: List[:class:`~discord.File`]
            A list of files to upload. Must be a maximum of 10.
        nonce: :class:`int`
            The nonce to use for sending this message. If the message was successfully sent,
            then the message will have a nonce with this value.
        delete_after: :class:`float`
            If provided, the number of seconds to wait in the background
            before deleting the message we just sent. If the deletion fails,
            then it is silently ignored.
        allowed_mentions: :class:`~discord.AllowedMentions`
            Controls the mentions being processed in this message. If this is
            passed, then the object is merged with :attr:`~discord.Client.allowed_mentions`.
            The merging behaviour only overrides attributes that have been explicitly passed
            to the object, otherwise it uses the attributes set in :attr:`~discord.Client.allowed_mentions`.
            If no object is passed at all then the defaults given by :attr:`~discord.Client.allowed_mentions`
            are used instead.

            .. versionadded:: 1.4

        reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
            A reference to the :class:`~discord.Message` to which you are referencing, this can be created using
            :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`.
            In the event of a replying reference, you can control whether this mentions the author of the referenced
            message using the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
            setting ``mention_author``.

            .. versionadded:: 1.6

        mention_author: Optional[:class:`bool`]
            If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``.

            .. versionadded:: 1.6
        view: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`]
            A Discord UI View to add to the message.

            .. versionadded:: 2.0
        stickers: Sequence[Union[:class:`~discord.GuildSticker`, :class:`~discord.StickerItem`]]
            A list of stickers to upload. Must be a maximum of 3.

            .. versionadded:: 2.0
        suppress_embeds: :class:`bool`
            Whether to suppress embeds for the message. This sends the message without any embeds if set to ``True``.

            .. versionadded:: 2.0
        silent: :class:`bool`
            Whether to suppress push and desktop notifications for the message. This will increment the mention counter
            in the UI, but will not actually send a notification.

            .. versionadded:: 2.2
        poll: :class:`~discord.Poll`
            The poll to send with this message.

            .. versionadded:: 2.4

        Raises
        --------
        ~discord.HTTPException
            Sending the message failed.
        ~discord.Forbidden
            You do not have the proper permissions to send the message.
        ~discord.NotFound
            You sent a message with the same nonce as one that has been explicitly
            deleted shortly earlier.
        ValueError
            The ``files`` or ``embeds`` list is not of the appropriate size.
        TypeError
            You specified both ``file`` and ``files``,
            or you specified both ``embed`` and ``embeds``,
            or the ``reference`` object is not a :class:`~discord.Message`,
            :class:`~discord.MessageReference` or :class:`~discord.PartialMessage`.

        Returns
        ---------
        :class:`~discord.Message`
            The message that was sent.
        """

        channel = await self._get_channel()
        state = self._state
        content = str(content) if content is not None else None
        previous_allowed_mention = state.allowed_mentions

        if stickers is not None:
            sticker_ids: SnowflakeList = [sticker.id for sticker in stickers]
        else:
            sticker_ids = MISSING

        if reference is not None:
            try:
                reference_dict = reference.to_message_reference_dict()
            except AttributeError:
                raise TypeError('reference parameter must be Message, MessageReference, or PartialMessage') from None
        else:
            reference_dict = MISSING

        if view and not hasattr(view, '__discord_ui_view__'):
            raise TypeError(f'view parameter must be View not {view.__class__.__name__}')

        if suppress_embeds or silent:
            from .message import MessageFlags  # circular import

            flags = MessageFlags._from_value(0)
            flags.suppress_embeds = suppress_embeds
            flags.suppress_notifications = silent
        else:
            flags = MISSING

        if nonce is None:
            nonce = secrets.randbits(64)

        with handle_message_parameters(
            content=content,
            tts=tts,
            file=file if file is not None else MISSING,
            files=files if files is not None else MISSING,
            embed=embed if embed is not None else MISSING,
            embeds=embeds if embeds is not None else MISSING,
            nonce=nonce,
            allowed_mentions=allowed_mentions,
            message_reference=reference_dict,
            previous_allowed_mentions=previous_allowed_mention,
            mention_author=mention_author,
            stickers=sticker_ids,
            view=view,
            flags=flags,
            poll=poll,
        ) as params:
            data = await state.http.send_message(channel.id, params=params)

        ret = state.create_message(channel=channel, data=data)
        if view and not view.is_finished() and view.is_dispatchable():
            state.store_view(view, ret.id)

        if poll:
            poll._update(ret)

        if delete_after is not None:
            await ret.delete(delay=delete_after)
        return ret

    def typing(self) -> Typing:
        """Returns an asynchronous context manager that allows you to send a typing indicator to
        the destination for an indefinite period of time, or 10 seconds if the context manager
        is called using ``await``.

        Example Usage: ::

            async with channel.typing():
                # simulate something heavy
                await asyncio.sleep(20)

            await channel.send('Done!')

        Example Usage: ::

            await channel.typing()
            # Do some computational magic for about 10 seconds
            await channel.send('Done!')

        .. versionchanged:: 2.0
            This no longer works with the ``with`` syntax, ``async with`` must be used instead.

        .. versionchanged:: 2.0
            Added functionality to ``await`` the context manager to send a typing indicator for 10 seconds.
        """
        return Typing(self)

    async def fetch_message(self, id: int, /) -> Message:
        """|coro|

        Retrieves a single :class:`~discord.Message` from the destination.

        Parameters
        ------------
        id: :class:`int`
            The message ID to look for.

        Raises
        --------
        ~discord.NotFound
            The specified message was not found.
        ~discord.Forbidden
            You do not have the permissions required to get a message.
        ~discord.HTTPException
            Retrieving the message failed.

        Returns
        --------
        :class:`~discord.Message`
            The message asked for.
        """

        channel = await self._get_channel()
        data = await self._state.http.get_message(channel.id, id)
        return self._state.create_message(channel=channel, data=data)

    async def __pins(
        self,
        *,
        limit: Optional[int] = 50,
        before: Optional[SnowflakeTime] = None,
        oldest_first: bool = False,
    ) -> AsyncIterator[PinnedMessage]:
        channel = await self._get_channel()
        state = self._state
        max_limit: int = 50

        time: Optional[str] = (
            (before if isinstance(before, datetime) else utils.snowflake_time(before.id)).isoformat()
            if before is not None
            else None
        )

        while True:
            retrieve = max_limit if limit is None else min(limit, max_limit)
            if retrieve < 1:
                break

            data = await self._state.http.pins_from(
                channel_id=channel.id,
                limit=retrieve,
                before=time,
            )

            items = data and data['items']
            if items:
                if limit is not None:
                    limit -= len(items)

                time = items[-1]['pinned_at']

            # Terminate loop on next iteration; there's no data left after this
            if len(items) < max_limit or not data['has_more']:
                limit = 0

            if oldest_first:
                items = reversed(items)

            count = 0
            for count, m in enumerate(items, start=1):
                message: Message = state.create_message(channel=channel, data=m['message'])
                message._pinned_at = utils.parse_time(m['pinned_at'])
                yield message  # pyright: ignore[reportReturnType]

            if count < max_limit:
                break

    def pins(
        self,
        *,
        limit: Optional[int] = 50,
        before: Optional[SnowflakeTime] = None,
        oldest_first: bool = False,
    ) -> _PinsIterator:
        """Retrieves an :term:`asynchronous iterator` of the pinned messages in the channel.

        You must have :attr:`~discord.Permissions.view_channel` and
        :attr:`~discord.Permissions.read_message_history` in order to use this.

        .. versionchanged:: 2.6

            Due to a change in Discord's API, this now returns a paginated iterator instead of a list.

            For backwards compatibility, you can still retrieve a list of pinned messages by
            using ``await`` on the returned object. This is however deprecated.

        .. note::

            Due to a limitation with the Discord API, the :class:`.Message`
            object returned by this method does not contain complete
            :attr:`.Message.reactions` data.

        Examples
        ---------

        Usage ::

            counter = 0
            async for message in channel.pins(limit=250):
                counter += 1

        Flattening into a list: ::

            messages = [message async for message in channel.pins(limit=50)]
            # messages is now a list of Message...

        All parameters are optional.

        Parameters
        -----------
        limit: Optional[int]
            The number of pinned messages to retrieve. If ``None``, it retrieves
            every pinned message in the channel. Note, however, that this would
            make it a slow operation.
            Defaults to ``50``.

            .. versionadded:: 2.6
        before: Optional[Union[:class:`datetime.datetime`, :class:`.abc.Snowflake`]]
            Retrieve pinned messages before this time or snowflake.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.

            .. versionadded:: 2.6
        oldest_first: :class:`bool`
            If set to ``True``, return messages in oldest pin->newest pin order.
            Defaults to ``False``.

            .. versionadded:: 2.6

        Raises
        -------
        ~discord.Forbidden
            You do not have the permission to retrieve pinned messages.
        ~discord.HTTPException
            Retrieving the pinned messages failed.

        Yields
        -------
        :class:`~discord.Message`
            The pinned message with :attr:`.Message.pinned_at` set.
        """
        return _PinsIterator(self.__pins(limit=limit, before=before, oldest_first=oldest_first))

    async def history(
        self,
        *,
        limit: Optional[int] = 100,
        before: Optional[SnowflakeTime] = None,
        after: Optional[SnowflakeTime] = None,
        around: Optional[SnowflakeTime] = None,
        oldest_first: Optional[bool] = None,
    ) -> AsyncIterator[Message]:
        """Returns an :term:`asynchronous iterator` that enables receiving the destination's message history.

        You must have :attr:`~discord.Permissions.read_message_history` to do this.

        Examples
        ---------

        Usage ::

            counter = 0
            async for message in channel.history(limit=200):
                if message.author == client.user:
                    counter += 1

        Flattening into a list: ::

            messages = [message async for message in channel.history(limit=123)]
            # messages is now a list of Message...

        All parameters are optional.

        Parameters
        -----------
        limit: Optional[:class:`int`]
            The number of messages to retrieve.
            If ``None``, retrieves every message in the channel. Note, however,
            that this would make it a slow operation.
        before: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve messages before this date or message.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.
        after: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve messages after this date or message.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.
        around: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve messages around this date or message.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.
            When using this argument, the maximum limit is 101. Note that if the limit is an
            even number then this will return at most limit + 1 messages.
        oldest_first: Optional[:class:`bool`]
            If set to ``True``, return messages in oldest->newest order. Defaults to ``True`` if
            ``after`` is specified, otherwise ``False``.

        Raises
        ------
        ~discord.Forbidden
            You do not have permissions to get channel message history.
        ~discord.HTTPException
            The request to get message history failed.

        Yields
        -------
        :class:`~discord.Message`
            The message with the message data parsed.
        """

        async def _around_strategy(retrieve: int, around: Optional[Snowflake], limit: Optional[int]):
            if not around:
                return [], None, 0

            around_id = around.id if around else None
            data = await self._state.http.logs_from(channel.id, retrieve, around=around_id)

            return data, None, 0

        async def _after_strategy(retrieve: int, after: Optional[Snowflake], limit: Optional[int]):
            after_id = after.id if after else None
            data = await self._state.http.logs_from(channel.id, retrieve, after=after_id)

            if data:
                if limit is not None:
                    limit -= len(data)

                after = Object(id=int(data[0]['id']))

            return data, after, limit

        async def _before_strategy(retrieve: int, before: Optional[Snowflake], limit: Optional[int]):
            before_id = before.id if before else None
            data = await self._state.http.logs_from(channel.id, retrieve, before=before_id)

            if data:
                if limit is not None:
                    limit -= len(data)

                before = Object(id=int(data[-1]['id']))

            return data, before, limit

        if isinstance(before, datetime):
            before = Object(id=utils.time_snowflake(before, high=False))
        if isinstance(after, datetime):
            after = Object(id=utils.time_snowflake(after, high=True))
        if isinstance(around, datetime):
            around = Object(id=utils.time_snowflake(around))

        if oldest_first is None:
            reverse = after is not None
        else:
            reverse = oldest_first

        after = after or OLDEST_OBJECT
        predicate = None

        if around:
            if limit is None:
                raise ValueError('history does not support around with limit=None')
            if limit > 101:
                raise ValueError('history max limit 101 when specifying around parameter')

            # Strange Discord quirk
            limit = 100 if limit == 101 else limit

            strategy, state = _around_strategy, around

            if before and after:
                predicate = lambda m: after.id < int(m['id']) < before.id
            elif before:
                predicate = lambda m: int(m['id']) < before.id
            elif after:
                predicate = lambda m: after.id < int(m['id'])
        elif reverse:
            strategy, state = _after_strategy, after
            if before:
                predicate = lambda m: int(m['id']) < before.id
        else:
            strategy, state = _before_strategy, before
            if after and after != OLDEST_OBJECT:
                predicate = lambda m: int(m['id']) > after.id

        channel = await self._get_channel()

        while True:
            retrieve = 100 if limit is None else min(limit, 100)
            if retrieve < 1:
                return

            data, state, limit = await strategy(retrieve, state, limit)

            if reverse:
                data = reversed(data)
            if predicate:
                data = filter(predicate, data)

            count = 0

            for count, raw_message in enumerate(data, 1):
                yield self._state.create_message(channel=channel, data=raw_message)

            if count < 100:
                # There's no data left after this
                break


class Connectable(Protocol):
    """An ABC that details the common operations on a channel that can
    connect to a voice server.

    The following implement this ABC:

    - :class:`~discord.VoiceChannel`
    - :class:`~discord.StageChannel`
    """

    __slots__ = ()
    _state: ConnectionState

    def _get_voice_client_key(self) -> Tuple[int, str]:
        raise NotImplementedError

    def _get_voice_state_pair(self) -> Tuple[int, int]:
        raise NotImplementedError

    async def connect(
        self,
        *,
        timeout: float = 30.0,
        reconnect: bool = True,
        cls: Callable[[Client, Connectable], T] = VoiceClient,
        self_deaf: bool = False,
        self_mute: bool = False,
    ) -> T:
        """|coro|

        Connects to voice and creates a :class:`~discord.VoiceClient` to establish
        your connection to the voice server.

        This requires :attr:`~discord.Intents.voice_states`.

        Parameters
        -----------
        timeout: :class:`float`
            The timeout in seconds to wait the connection to complete.
        reconnect: :class:`bool`
            Whether the bot should automatically attempt
            a reconnect if a part of the handshake fails
            or the gateway goes down.
        cls: Type[:class:`~discord.VoiceProtocol`]
            A type that subclasses :class:`~discord.VoiceProtocol` to connect with.
            Defaults to :class:`~discord.VoiceClient`.
        self_mute: :class:`bool`
            Indicates if the client should be self-muted.

            .. versionadded:: 2.0
        self_deaf: :class:`bool`
            Indicates if the client should be self-deafened.

            .. versionadded:: 2.0

        Raises
        -------
        asyncio.TimeoutError
            Could not connect to the voice channel in time.
        ~discord.ClientException
            You are already connected to a voice channel.
        ~discord.opus.OpusNotLoaded
            The opus library has not been loaded.

        Returns
        --------
        :class:`~discord.VoiceProtocol`
            A voice client that is fully connected to the voice server.
        """

        key_id, _ = self._get_voice_client_key()
        state = self._state

        if state._get_voice_client(key_id):
            raise ClientException('Already connected to a voice channel.')

        client = state._get_client()
        voice: T = cls(client, self)

        if not isinstance(voice, VoiceProtocol):
            raise TypeError('Type must meet VoiceProtocol abstract base class.')

        state._add_voice_client(key_id, voice)

        try:
            await voice.connect(timeout=timeout, reconnect=reconnect, self_deaf=self_deaf, self_mute=self_mute)
        except asyncio.TimeoutError:
            try:
                await voice.disconnect(force=True)
            except Exception:
                # we don't care if disconnect failed because connection failed
                pass
            raise  # re-raise

        return voice


================================================
FILE: discord/activity.py
================================================
"""
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations

import datetime
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union, overload

from .asset import Asset
from .enums import ActivityType, StatusDisplayType, try_enum
from .colour import Colour
from .partial_emoji import PartialEmoji
from .utils import _get_as_snowflake

__all__ = (
    'BaseActivity',
    'Activity',
    'Streaming',
    'Game',
    'Spotify',
    'CustomActivity',
)

"""If curious, this is the current schema for an activity.

It's fairly long so I will document it here:

All keys are optional.

state: str (max: 128),
details: str (max: 128)
timestamps: dict
    start: int (min: 1)
    end: int (min: 1)
assets: dict
    large_image: str (max: 32)
    large_text: str (max: 128)
    small_image: str (max: 32)
    small_text: str (max: 128)
party: dict
    id: str (max: 128),
    size: List[int] (max-length: 2)
        elem: int (min: 1)
secrets: dict
    match: str (max: 128)
    join: str (max: 128)
    spectate: str (max: 128)
instance: bool
application_id: str
name: str (max: 128)
url: str
type: int
sync_id: str
session_id: str
flags: int
buttons: list[str (max: 32)]

There are also activity flags which are mostly uninteresting for the library atm.

t.ActivityFlags = {
    INSTANCE: 1,
    JOIN: 2,
    SPECTATE: 4,
    JOIN_REQUEST: 8,
    SYNC: 16,
    PLAY: 32
}
"""

if TYPE_CHECKING:
    from .types.activity import (
        Activity as ActivityPayload,
        ActivityTimestamps,
        ActivityParty,
        ActivityAssets,
    )

    from .state import ConnectionState


class BaseActivity:
    """The base activity that all user-settable activities inherit from.
    A user-settable activity is one that can be used in :meth:`Client.change_presence`.

    The following types currently count as user-settable:

    - :class:`Activity`
    - :class:`Game`
    - :class:`Streaming`
    - :class:`CustomActivity`

    Note that although these types are considered user-settable by the library,
    Discord typically ignores certain combinations of activity depending on
    what is currently set. This behaviour may change in the future so there are
    no guarantees on whether Discord will actually let you set these types.

    .. versionadded:: 1.3
    """

    __slots__ = ('_created_at',)

    def __init__(self, **kwargs: Any) -> None:
        self._created_at: Optional[float] = kwargs.pop('created_at', None)

    @property
    def created_at(self) -> Optional[datetime.datetime]:
        """Optional[:class:`datetime.datetime`]: When the user started doing this activity in UTC.

        .. versionadded:: 1.3
        """
        if self._created_at is not None:
            return datetime.datetime.fromtimestamp(self._created_at / 1000, tz=datetime.timezone.utc)

    def to_dict(self) -> ActivityPayload:
        raise NotImplementedError


class Activity(BaseActivity):
    """Represents an activity in Discord.

    This could be an activity such as streaming, playing, listening
    or watching.

    For memory optimisation purposes, some activities are offered in slimmed
    down versions:

    - :class:`Game`
    - :class:`Streaming`

    Attributes
    ------------
    application_id: Optional[:class:`int`]
        The application ID of the game.
    name: Optional[:class:`str`]
        The name of the activity.
    url: Optional[:class:`str`]
        A stream URL that the activity could be doing.
    type: :class:`ActivityType`
        The type of activity currently being done.
    state: Optional[:class:`str`]
        The user's current state. For example, "In Game".
    details: Optional[:class:`str`]
        The detail of the user's current activity.
    platform: Optional[:class:`str`]
        The user's current platform.

        .. versionadded:: 2.4
    timestamps: :class:`dict`
        A dictionary of timestamps. It contains the following optional keys:

        - ``start``: Corresponds to when the user started doing the
          activity in milliseconds since Unix epoch.
        - ``end``: Corresponds to when the user will finish doing the
          activity in milliseconds since Unix epoch.

    assets: :class:`dict`
        A dictionary representing the images and their hover text of an activity.
        It contains the following optional keys:

        - ``large_image``: A string representing the ID for the large image asset.
        - ``large_text``: A string representing the text when hovering over the large image asset.
        - ``large_url``: A string representing the URL of the large image asset.
        - ``small_image``: A string representing the ID for the small image asset.
        - ``small_text``: A string representing the text when hovering over the small image asset.
        - ``small_url``: A string representing the URL of the small image asset.

    party: :class:`dict`
        A dictionary representing the activity party. It contains the following optional keys:

        - ``id``: A string representing the party ID.
        - ``size``: A list of up to two integer elements denoting (current_size, maximum_size).
    buttons: List[:class:`str`]
        A list of strings representing the labels of custom buttons shown in a rich presence.

        .. versionadded:: 2.0

    emoji: Optional[:class:`PartialEmoji`]
        The emoji that belongs to this activity.
    details_url: Optional[:class:`str`]
        A URL that is linked to when clicking on the details text of the activity.

        .. versionadded:: 2.6
    state_url: Optional[:class:`str`]
        A URL that is linked to when clicking on the state text of the activity.

        .. versionadded:: 2.6
    status_display_type: Optional[:class:`StatusDisplayType`]
        Determines which field from the user's status text is displayed
        in the members list.

        .. versionadded:: 2.6
    """

    __slots__ = (
        'state',
        'details',
        'timestamps',
        'platform',
        'assets',
        'party',
        'flags',
        'sync_id',
        'session_id',
        'type',
        'name',
        'url',
        'application_id',
        'emoji',
        'buttons',
        'state_url',
        'details_url',
        'status_display_type',
    )

    def __init__(self, **kwargs: Any) -> None:
        super().__init__(**kwargs)
        self.state: Optional[str] = kwargs.pop('state', None)
        self.details: Optional[str] = kwargs.pop('details', None)
        self.timestamps: ActivityTimestamps = kwargs.pop('timestamps', {})
        self.platform: Optional[str] = kwargs.pop('platform', None)
        self.assets: ActivityAssets = kwargs.pop('assets', {})
        self.party: ActivityParty = kwargs.pop('party', {})
        self.application_id: Optional[int] = _get_as_snowflake(kwargs, 'application_id')
        self.name: Optional[str] = kwargs.pop('name', None)
        self.url: Optional[str] = kwargs.pop('url', None)
        self.flags: int = kwargs.pop('flags', 0)
        self.sync_id: Optional[str] = kwargs.pop('sync_id', None)
        self.session_id: Optional[str] = kwargs.pop('session_id', None)
        self.buttons: List[str] = kwargs.pop('buttons', [])

        activity_type = kwargs.pop('type', -1)
        self.type: ActivityType = (
            activity_type if isinstance(activity_type, ActivityType) else try_enum(ActivityType, activity_type)
        )

        emoji = kwargs.pop('emoji', None)
        self.emoji: Optional[PartialEmoji] = PartialEmoji.from_dict(emoji) if emoji is not None else None

        self.state_url: Optional[str] = kwargs.pop('state_url', None)
        self.details_url: Optional[str] = kwargs.pop('details_url', None)

        status_display_type = kwargs.pop('status_display_type', None)
        self.status_display_type: Optional[StatusDisplayType] = (
            status_display_type
            if isinstance(status_display_type, StatusDisplayType)
            else try_enum(StatusDisplayType, status_display_type)
            if status_display_type is not None
            else None
        )

    def __repr__(self) -> str:
        attrs = (
            ('type', self.type),
            ('name', self.name),
            ('url', self.url),
            ('platform', self.platform),
            ('details', self.details),
            ('application_id', self.application_id),
            ('session_id', self.session_id),
            ('emoji', self.emoji),
        )
        inner = ' '.join('%s=%r' % t for t in attrs)
        return f'<Activity {inner}>'

    def to_dict(self) -> Dict[str, Any]:
        ret: Dict[str, Any] = {}
        for attr in self.__slots__:
            value = getattr(self, attr, None)
            if value is None:
                continue

            if isinstance(value, dict) and len(value) == 0:
                continue

            ret[attr] = value
        ret['type'] = int(self.type)
        if self.emoji:
            ret['emoji'] = self.emoji.to_dict()
        if self.status_display_type:
            ret['status_display_type'] = int(self.status_display_type.value)
        return ret

    @property
    def start(self) -> Optional[datetime.datetime]:
        """Optional[:class:`datetime.datetime`]: When the user started doing this activity in UTC, if applicable."""
        try:
            timestamp = self.timestamps['start'] / 1000  # pyright: ignore[reportTypedDictNotRequiredAccess]
        except KeyError:
            return None
        else:
            return datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc)

    @property
    def end(self) -> Optional[datetime.datetime]:
        """Optional[:class:`datetime.datetime`]: When the user will stop doing this activity in UTC, if applicable."""
        try:
            timestamp = self.timestamps['end'] / 1000  # pyright: ignore[reportTypedDictNotRequiredAccess]
        except KeyError:
            return None
        else:
            return datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc)

    @property
    def large_image_url(self) -> Optional[str]:
        """Optional[:class:`str`]: Returns a URL pointing to the large image asset of this activity, if applicable."""
        try:
            large_image = self.assets['large_image']  # pyright: ignore[reportTypedDictNotRequiredAccess]
        except KeyError:
            return None
        else:
            return self._image_url(large_image)

    @property
    def small_image_url(self) -> Optional[str]:
        """Optional[:class:`str`]: Returns a URL pointing to the small image asset of this activity, if applicable."""
        try:
            small_image = self.assets['small_image']  # pyright: ignore[reportTypedDictNotRequiredAccess]
        except KeyError:
            return None
        else:
            return self._image_url(small_image)

    def _image_url(self, image: str) -> Optional[str]:
        if image.startswith('mp:'):
            return f'https://media.discordapp.net/{image[3:]}'
        elif self.application_id is not None:
            return Asset.BASE + f'/app-assets/{self.application_id}/{image}.png'

    @property
    def large_image_text(self) -> Optional[str]:
        """Optional[:class:`str`]: Returns the large image asset hover text of this activity, if applicable."""
        return self.assets.get('large_text', None)

    @property
    def small_image_text(self) -> Optional[str]:
        """Optional[:class:`str`]: Returns the small image asset hover text of this activity, if applicable."""
        return self.assets.get('small_text', None)


class Game(BaseActivity):
    """A slimmed down version of :class:`Activity` that represents a Discord game.

    This is typically displayed via **Playing** on the official Discord client.

    .. container:: operations

        .. describe:: x == y

            Checks if two games are equal.

        .. describe:: x != y

            Checks if two games are not equal.

        .. describe:: hash(x)

            Returns the game's hash.

        .. describe:: str(x)

            Returns the game's name.

    Parameters
    -----------
    name: :class:`str`
        The game's name.

    Attributes
    -----------
    name: :class:`str`
        The game's name.
    platform: Optional[:class:`str`]
        Where the user is playing from (ie. PS5, Xbox).

        .. versionadded:: 2.4

    assets: :class:`dict`
        A dictionary representing the images and their hover text of a game.
        It contains the following optional keys:

        - ``large_image``: A string representing the ID for the large image asset.
        - ``large_text``: A string representing the text when hovering over the large image asset.
        - ``small_image``: A string representing the ID for the small image asset.
        - ``small_text``: A string representing the text when hovering over the small image asset.

        .. versionadded:: 2.4
    """

    __slots__ = ('name', '_end', '_start', 'platform', 'assets')

    def __init__(self, name: str, **extra: Any) -> None:
        super().__init__(**extra)
        self.name: str = name
        self.platform: Optional[str] = extra.get('platform')
        self.assets: ActivityAssets = extra.get('assets', {}) or {}

        try:
            timestamps: ActivityTimestamps = extra['timestamps']
        except KeyError:
            self._start = 0
            self._end = 0
        else:
            self._start = timestamps.get('start', 0)
            self._end = timestamps.get('end', 0)

    @property
    def type(self) -> ActivityType:
        """:class:`ActivityType`: Returns the game's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.playing`.
        """
        return ActivityType.playing

    @property
    def start(self) -> Optional[datetime.datetime]:
        """Optional[:class:`datetime.datetime`]: When the user started playing this game in UTC, if applicable."""
        if self._start:
            return datetime.datetime.fromtimestamp(self._start / 1000, tz=datetime.timezone.utc)
        return None

    @property
    def end(self) -> Optional[datetime.datetime]:
        """Optional[:class:`datetime.datetime`]: When the user will stop playing this game in UTC, if applicable."""
        if self._end:
            return datetime.datetime.fromtimestamp(self._end / 1000, tz=datetime.timezone.utc)
        return None

    def __str__(self) -> str:
        return str(self.name)

    def __repr__(self) -> str:
        return f'<Game name={self.name!r} platform={self.platform!r}>'

    def to_dict(self) -> Dict[str, Any]:
        timestamps: Dict[str, Any] = {}
        if self._start:
            timestamps['start'] = self._start

        if self._end:
            timestamps['end'] = self._end

        return {
            'type': ActivityType.playing.value,
            'name': str(self.name),
            'timestamps': timestamps,
            'platform': str(self.platform) if self.platform else None,
            'assets': self.assets,
        }

    def __eq__(self, other: object) -> bool:
        return isinstance(other, Game) and other.name == self.name

    def __ne__(self, other: object) -> bool:
        return not self.__eq__(other)

    def __hash__(self) -> int:
        return hash(self.name)


class Streaming(BaseActivity):
    """A slimmed down version of :class:`Activity` that represents a Discord streaming status.

    This is typically displayed via **Streaming** on the official Discord client.

    .. container:: operations

        .. describe:: x == y

            Checks if two streams are equal.

        .. describe:: x != y

            Checks if two streams are not equal.

        .. describe:: hash(x)

            Returns the stream's hash.

        .. describe:: str(x)

            Returns the stream's name.

    Attributes
    -----------
    platform: Optional[:class:`str`]
        Where the user is streaming from (ie. YouTube, Twitch).

        .. versionadded:: 1.3

    name: Optional[:class:`str`]
        The stream's name.
    details: Optional[:class:`str`]
        An alias for :attr:`name`
    game: Optional[:class:`str`]
        The game being streamed.

        .. versionadded:: 1.3

    url: :class:`str`
        The stream's URL.
    assets: :class:`dict`
        A dictionary comprising of similar keys than those in :attr:`Activity.assets`.
    """

    __slots__ = ('platform', 'name', 'game', 'url', 'details', 'assets')

    def __init__(self, *, name: Optional[str], url: str, **extra: Any) -> None:
        super().__init__(**extra)
        self.platform: Optional[str] = name
        self.name: Optional[str] = extra.pop('details', name)
        self.game: Optional[str] = extra.pop('state', None)
        self.url: str = url
        self.details: Optional[str] = extra.pop('details', self.name)  # compatibility
        self.assets: ActivityAssets = extra.pop('assets', {})

    @property
    def type(self) -> ActivityType:
        """:class:`ActivityType`: Returns the game's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.streaming`.
        """
        return ActivityType.streaming

    def __str__(self) -> str:
        return str(self.name)

    def __repr__(self) -> str:
        return f'<Streaming name={self.name!r} platform={self.platform!r}>'

    @property
    def twitch_name(self) -> Optional[str]:
        """Optional[:class:`str`]: If provided, the twitch name of the user streaming.

        This corresponds to the ``large_image`` key of the :attr:`Streaming.assets`
        dictionary if it starts with ``twitch:``. Typically set by the Discord client.
        """

        try:
            name = self.assets['large_image']  # pyright: ignore[reportTypedDictNotRequiredAccess]
        except KeyError:
            return None
        else:
            return name[7:] if name[:7] == 'twitch:' else None

    def to_dict(self) -> Dict[str, Any]:
        ret: Dict[str, Any] = {
            'type': ActivityType.streaming.value,
            'name': str(self.name),
            'url': str(self.url),
            'assets': self.assets,
        }
        if self.details:
            ret['details'] = self.details
        return ret

    def __eq__(self, other: object) -> bool:
        return isinstance(other, Streaming) and other.name == self.name and other.url == self.url

    def __ne__(self, other: object) -> bool:
        return not self.__eq__(other)

    def __hash__(self) -> int:
        return hash(self.name)


class Spotify:
    """Represents a Spotify listening activity from Discord. This is a special case of
    :class:`Activity` that makes it easier to work with the Spotify integration.

    .. container:: operations

        .. describe:: x == y

            Checks if two activities are equal.

        .. describe:: x != y

            Checks if two activities are not equal.

        .. describe:: hash(x)

            Returns the activity's hash.

        .. describe:: str(x)

            Returns the string 'Spotify'.
    """

    __slots__ = ('_state', '_details', '_timestamps', '_assets', '_party', '_sync_id', '_session_id', '_created_at')

    def __init__(self, **data: Any) -> None:
        self._state: str = data.pop('state', '')
        self._details: str = data.pop('details', '')
        self._timestamps: ActivityTimestamps = data.pop('timestamps', {})
        self._assets: ActivityAssets = data.pop('assets', {})
        self._party: ActivityParty = data.pop('party', {})
        self._sync_id: str = data.pop('sync_id', '')
        self._session_id: Optional[str] = data.pop('session_id')
        self._created_at: Optional[float] = data.pop('created_at', None)

    @property
    def type(self) -> ActivityType:
        """:class:`ActivityType`: Returns the activity's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.listening`.
        """
        return ActivityType.listening

    @property
    def created_at(self) -> Optional[datetime.datetime]:
        """Optional[:class:`datetime.datetime`]: When the user started listening in UTC.

        .. versionadded:: 1.3
        """
        if self._created_at is not None:
            return datetime.datetime.fromtimestamp(self._created_at / 1000, tz=datetime.timezone.utc)

    @property
    def colour(self) -> Colour:
        """:class:`Colour`: Returns the Spotify integration colour, as a :class:`Colour`.

        There is an alias for this named :attr:`color`"""
        return Colour(0x1DB954)

    @property
    def color(self) -> Colour:
        """:class:`Colour`: Returns the Spotify integration colour, as a :class:`Colour`.

        There is an alias for this named :attr:`colour`"""
        return self.colour

    def to_dict(self) -> Dict[str, Any]:
        return {
            'flags': 48,  # SYNC | PLAY
            'name': 'Spotify',
            'assets': self._assets,
            'party': self._party,
            'sync_id': self._sync_id,
            'session_id': self._session_id,
            'timestamps': self._timestamps,
            'details': self._details,
            'state': self._state,
        }

    @property
    def name(self) -> str:
        """:class:`str`: The activity's name. This will always return "Spotify"."""
        return 'Spotify'

    def __eq__(self, other: object) -> bool:
        return (
            isinstance(other, Spotify)
            and other._session_id == self._session_id
            and other._sync_id == self._sync_id
            and other.start == self.start
        )

    def __ne__(self, other: object) -> bool:
        return not self.__eq__(other)

    def __hash__(self) -> int:
        return hash(self._session_id)

    def __str__(self) -> str:
        return 'Spotify'

    def __repr__(self) -> str:
        return f'<Spotify title={self.title!r} artist={self.artist!r} track_id={self.track_id!r}>'

    @property
    def title(self) -> str:
        """:class:`str`: The title of the song being played."""
        return self._details

    @property
    def artists(self) -> List[str]:
        """List[:class:`str`]: The artists of the song being played."""
        return self._state.split('; ')

    @property
    def artist(self) -> str:
        """:class:`str`: The artist of the song being played.

        This does not attempt to split the artist information into
        multiple artists. Useful if there's only a single artist.
        """
        return self._state

    @property
    def album(self) -> str:
        """:class:`str`: The album that the song being played belongs to."""
        return self._assets.get('large_text', '')

    @property
    def album_cover_url(self) -> str:
        """:class:`str`: The album cover image URL from Spotify's CDN."""
        large_image = self._assets.get('large_image', '')
        if large_image[:8] != 'spotify:':
            return ''
        album_image_id = large_image[8:]
        return 'https://i.scdn.co/image/' + album_image_id

    @property
    def track_id(self) -> str:
        """:class:`str`: The track ID used by Spotify to identify this song."""
        return self._sync_id

    @property
    def track_url(self) -> str:
        """:class:`str`: The track URL to listen on Spotify.

        .. versionadded:: 2.0
        """
        return f'https://open.spotify.com/track/{self.track_id}'

    @property
    def start(self) -> datetime.datetime:
        """:class:`datetime.datetime`: When the user started playing this song in UTC."""
        # the start key will be present here
        return datetime.datetime.fromtimestamp(self._timestamps['start'] / 1000, tz=datetime.timezone.utc)  # type: ignore

    @property
    def end(self) -> datetime.datetime:
        """:class:`datetime.datetime`: When the user will stop playing this song in UTC."""
        # the end key will be present here
        return datetime.datetime.fromtimestamp(self._timestamps['end'] / 1000, tz=datetime.timezone.utc)  # type: ignore

    @property
    def duration(self) -> datetime.timedelta:
        """:class:`datetime.timedelta`: The duration of the song being played."""
        return self.end - self.start

    @property
    def party_id(self) -> str:
        """:class:`str`: The party ID of the listening party."""
        return self._party.get('id', '')


class CustomActivity(BaseActivity):
    """Represents a custom activity from Discord.

    .. container:: operations

        .. describe:: x == y

            Checks if two activities are equal.

        .. describe:: x != y

            Checks if two activities are not equal.

        .. describe:: hash(x)

            Returns the activity's hash.

        .. describe:: str(x)

            Returns the custom status text.

    .. versionadded:: 1.3

    Attributes
    -----------
    name: Optional[:class:`str`]
        The custom activity's name.
    emoji: Optional[:class:`PartialEmoji`]
        The emoji to pass to the activity, if any.
    """

    __slots__ = ('name', 'emoji', 'state')

    def __init__(
        self, name: Optional[str], *, emoji: Optional[Union[PartialEmoji, Dict[str, Any], str]] = None, **extra: Any
    ) -> None:
        super().__init__(**extra)
        self.name: Optional[str] = name
        self.state: Optional[str] = extra.pop('state', name)
        if self.name == 'Custom Status':
            self.name = self.state

        self.emoji: Optional[PartialEmoji]
        if emoji is None:
            self.emoji = emoji
        elif isinstance(emoji, dict):
            self.emoji = PartialEmoji.from_dict(emoji)
        elif isinstance(emoji, str):
            self.emoji = PartialEmoji(name=emoji)
        elif isinstance(emoji, PartialEmoji):
            self.emoji = emoji
        else:
            raise TypeError(f'Expected str, PartialEmoji, or None, received {type(emoji)!r} instead.')

    @property
    def type(self) -> ActivityType:
        """:class:`ActivityType`: Returns the activity's type. This is for compatibility with :class:`Activity`.

        It always returns :attr:`ActivityType.custom`.
        """
        return ActivityType.custom

    def to_dict(self) -> Dict[str, Any]:
        if self.name == self.state:
            o = {
                'type': ActivityType.custom.value,
                'state': self.name,
                'name': 'Custom Status',
            }
        else:
            o = {
                'type': ActivityType.custom.value,
                'name': self.name,
            }

        if self.emoji:
            o['emoji'] = self.emoji.to_dict()
        return o

    def __eq__(self, other: object) -> bool:
        return isinstance(other, CustomActivity) and other.name == self.name and other.emoji == self.emoji

    def __ne__(self, other: object) -> bool:
        return not self.__eq__(other)

    def __hash__(self) -> int:
        return hash((self.name, str(self.emoji)))

    def __str__(self) -> str:
        if self.emoji:
            if self.name:
                return f'{self.emoji} {self.name}'
            return str(self.emoji)
        else:
            return str(self.name)

    def __repr__(self) -> str:
        return f'<CustomActivity name={self.name!r} emoji={self.emoji!r}>'


ActivityTypes = Union[Activity, Game, CustomActivity, Streaming, Spotify]


@overload
def create_activity(data: ActivityPayload, state: ConnectionState) -> ActivityTypes: ...


@overload
def create_activity(data: None, state: ConnectionState) -> None: ...


def create_activity(data: Optional[ActivityPayload], state: ConnectionState) -> Optional[ActivityTypes]:
    if not data:
        return None

    game_type = try_enum(ActivityType, data.get('type', -1))
    if game_type is ActivityType.playing:
        if 'application_id' in data or 'session_id' in data:
            return Activity(**data)
        return Game(**data)
    elif game_type is ActivityType.custom:
        try:
            name = data.pop('name')  # type: ignore
        except KeyError:
            ret = Activity(**data)
        else:
            # we removed the name key from data already
            ret = CustomActivity(name=name, **data)  # type: ignore
    elif game_type is ActivityType.streaming:
        if 'url' in data:
            # the url won't be None here
            return Streaming(**data)  # type: ignore
        return Activity(**data)
    elif game_type is ActivityType.listening and 'sync_id' in data and 'session_id' in data:
        return Spotify(**data)
    else:
        ret = Activity(**data)

    if isinstance(ret.emoji, PartialEmoji):
        ret.emoji._state = state
    return ret


================================================
FILE: discord/app_commands/__init__.py
================================================
"""
discord.app_commands
~~~~~~~~~~~~~~~~~~~~~

Application commands support for the Discord API

:copyright: (c) 2015-present Rapptz
:license: MIT, see LICENSE for more details.

"""

from .commands import *
from .errors import *
from .models import *
from .tree import *
from .namespace import *
from .transformers import *
from .translator import *
from .installs import *
from . import checks as checks
from .checks import Cooldown as Cooldown


================================================
FILE: discord/app_commands/checks.py
================================================
"""
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations

from typing import (
    Any,
    Coroutine,
    Dict,
    Hashable,
    Union,
    Callable,
    TypeVar,
    Optional,
    TYPE_CHECKING,
)

import time

from .commands import check
from .errors import (
    NoPrivateMessage,
    MissingRole,
    MissingAnyRole,
    MissingPermissions,
    BotMissingPermissions,
    CommandOnCooldown,
)

from ..user import User
from ..permissions import Permissions
from ..utils import get as utils_get, MISSING, maybe_coroutine

T = TypeVar('T')

if TYPE_CHECKING:
    from typing_extensions import Self, Unpack
    from ..interactions import Interaction
    from ..permissions import _PermissionsKwargs

    CooldownFunction = Union[
        Callable[[Interaction[Any]], Coroutine[Any, Any, T]],
        Callable[[Interaction[Any]], T],
    ]

__all__ = (
    'has_role',
    'has_any_role',
    'has_permissions',
    'bot_has_permissions',
    'cooldown',
    'dynamic_cooldown',
)


class Cooldown:
    """Represents a cooldown for a command.

    .. versionadded:: 2.0

    Attributes
    -----------
    rate: :class:`float`
        The total number of tokens available per :attr:`per` seconds.
    per: :class:`float`
        The length of the cooldown period in seconds.
    """

    __slots__ = ('rate', 'per', '_window', '_tokens', '_last')

    def __init__(self, rate: float, per: float) -> None:
        self.rate: int = int(rate)
        self.per: float = float(per)
        self._window: float = 0.0
        self._tokens: int = self.rate
        self._last: float = 0.0

    def get_tokens(self, current: Optional[float] = None) -> int:
        """Returns the number of available tokens before rate limiting is applied.

        Parameters
        ------------
        current: Optional[:class:`float`]
            The time in seconds since Unix epoch to calculate tokens at.
            If not supplied then :func:`time.time()` is used.

        Returns
        --------
        :class:`int`
            The number of tokens available before the cooldown is to be applied.
        """
        if not current:
            current = time.time()

        # the calculated tokens should be non-negative
        tokens = max(self._tokens, 0)

        if current > self._window + self.per:
            tokens = self.rate
        return tokens

    def get_retry_after(self, current: Optional[float] = None) -> float:
        """Returns the time in seconds until the cooldown will be reset.

        Parameters
        -------------
        current: Optional[:class:`float`]
            The current time in seconds since Unix epoch.
            If not supplied, then :func:`time.time()` is used.

        Returns
        -------
        :class:`float`
            The number of seconds to wait before this cooldown will be reset.
        """
        current = current or time.time()
        tokens = self.get_tokens(current)

        if tokens == 0:
            return self.per - (current - self._window)

        return 0.0

    def update_rate_limit(self, current: Optional[float] = None, *, tokens: int = 1) -> Optional[float]:
        """Updates the cooldown rate limit.

        Parameters
        -------------
        current: Optional[:class:`float`]
            The time in seconds since Unix epoch to update the rate limit at.
            If not supplied, then :func:`time.time()` is used.
        tokens: :class:`int`
            The amount of tokens to deduct from the rate limit.

        Returns
        -------
        Optional[:class:`float`]
            The retry-after time in seconds if rate limited.
        """
        current = current or time.time()
        self._last = current

        self._tokens = self.get_tokens(current)

        # first token used means that we start a new rate limit window
        if self._tokens == self.rate:
            self._window = current

        # decrement tokens by specified number
        self._tokens -= tokens

        # check if we are rate limited and return retry-after
        if self._tokens < 0:
            return self.per - (current - self._window)

    def reset(self) -> None:
        """Reset the cooldown to its initial state."""
        self._tokens = self.rate
        self._last = 0.0

    def copy(self) -> Self:
        """Creates a copy of this cooldown.

        Returns
        --------
        :class:`Cooldown`
            A new instance of this cooldown.
        """
        return self.__class__(self.rate, self.per)

    def __repr__(self) -> str:
        return f'<Cooldown rate: {self.rate} per: {self.per} window: {self._window} tokens: {self._tokens}>'


def has_role(item: Union[int, str], /) -> Callable[[T], T]:
    """A :func:`~discord.app_commands.check` that is added that checks if the member invoking the
    command has the role specified via the name or ID specified.

    If a string is specified, you must give the exact name of the role, including
    caps and spelling.

    If an integer is specified, you must give the exact snowflake ID of the role.

    This check raises one of two special exceptions, :exc:`~discord.app_commands.MissingRole`
    if the user is missing a role, or :exc:`~discord.app_commands.NoPrivateMessage` if
    it is used in a private message. Both inherit from :exc:`~discord.app_commands.CheckFailure`.

    .. versionadded:: 2.0

    .. note::

        This is different from the permission system that Discord provides for application
        commands. This is done entirely locally in the program rather than being handled
        by Discord.

    Parameters
    -----------
    item: Union[:class:`int`, :class:`str`]
        The name or ID of the role to check.
    """

    def predicate(interaction: Interaction) -> bool:
        if isinstance(interaction.user, User):
            raise NoPrivateMessage()

        if isinstance(item, int):
            role = interaction.user.get_role(item)
        else:
            role = utils_get(interaction.user.roles, name=item)

        if role is None:
            raise MissingRole(item)
        return True

    return check(predicate)


def has_any_role(*items: Union[int, str]) -> Callable[[T], T]:
    r"""A :func:`~discord.app_commands.check` that is added that checks if the member
    invoking the command has **any** of the roles specified. This means that if they have
    one out of the three roles specified, then this check will return ``True``.

    Similar to :func:`has_role`\, the names or IDs passed in must be exact.

    This check raises one of two special exceptions, :exc:`~discord.app_commands.MissingAnyRole`
    if the user is missing all roles, or :exc:`~discord.app_commands.NoPrivateMessage` if
    it is used in a private message. Both inherit from :exc:`~discord.app_commands.CheckFailure`.

    .. versionadded:: 2.0

    .. note::

        This is different from the permission system that Discord provides for application
        commands. This is done entirely locally in the program rather than being handled
        by Discord.

    Parameters
    -----------
    items: List[Union[:class:`str`, :class:`int`]]
        An argument list of names or IDs to check that the member has roles wise.

    Example
    --------

    .. code-block:: python3

        @tree.command()
        @app_commands.checks.has_any_role('Library Devs', 'Moderators', 492212595072434186)
        async def cool(interaction: discord.Interaction):
            await interaction.response.send_message('You are cool indeed')
    """

    def predicate(interaction: Interaction) -> bool:
        if isinstance(interaction.user, User):
            raise NoPrivateMessage()

        if any(
            interaction.user.get_role(item) is not None
            if isinstance(item, int)
            else utils_get(interaction.user.roles, name=item) is not None
            for item in items
        ):
            return True
        raise MissingAnyRole(list(items))

    return check(predicate)


def has_permissions(**perms: Unpack[_PermissionsKwargs]) -> Callable[[T], T]:
    r"""A :func:`~discord.app_commands.check` that is added that checks if the member
    has all of the permissions necessary.

    Note that this check operates on the permissions given by
    :attr:`discord.Interaction.permissions`.

    The permissions passed in must be exactly like the properties shown under
    :class:`discord.Permissions`.

    This check raises a special exception, :exc:`~discord.app_commands.MissingPermissions`
    that is inherited from :exc:`~discord.app_commands.CheckFailure`.

    .. versionadded:: 2.0

    .. note::

        This is different from the permission system that Discord provides for application
        commands. This is done entirely locally in the program rather than being handled
        by Discord.

    Parameters
    ------------
    \*\*perms: :class:`bool`
        Keyword arguments denoting the permissions to check for.

    Example
    ---------

    .. code-block:: python3

        @tree.command()
        @app_commands.checks.has_permissions(manage_messages=True)
        async def test(interaction: discord.Interaction):
            await interaction.response.send_message('You can manage messages.')

    """

    invalid = perms.keys() - Permissions.VALID_FLAGS.keys()
    if invalid:
        raise TypeError(f'Invalid permission(s): {", ".join(invalid)}')

    def predicate(interaction: Interaction) -> bool:
        permissions = interaction.permissions

        missing = [perm for perm, value in perms.items() if getattr(permissions, perm) != value]

        if not missing:
            return True

        raise MissingPermissions(missing)

    return check(predicate)


def bot_has_permissions(**perms: Unpack[_PermissionsKwargs]) -> Callable[[T], T]:
    """Similar to :func:`has_permissions` except checks if the bot itself has
    the permissions listed. This relies on :attr:`discord.Interaction.app_permissions`.

    This check raises a special exception, :exc:`~discord.app_commands.BotMissingPermissions`
    that is inherited from :exc:`~discord.app_commands.CheckFailure`.

    .. versionadded:: 2.0
    """

    invalid = set(perms) - set(Permissions.VALID_FLAGS)
    if invalid:
        raise TypeError(f'Invalid permission(s): {", ".join(invalid)}')

    def predicate(interaction: Interaction) -> bool:
        permissions = interaction.app_permissions
        missing = [perm for perm, value in perms.items() if getattr(permissions, perm) != value]

        if not missing:
            return True

        raise BotMissingPermissions(missing)

    return check(predicate)


def _create_cooldown_decorator(
    key: CooldownFunction[Hashable], factory: CooldownFunction[Optional[Cooldown]]
) -> Callable[[T], T]:
    mapping: Dict[Any, Cooldown] = {}

    async def get_bucket(
        interaction: Interaction,
        *,
        mapping: Dict[Any, Cooldown] = mapping,
        key: CooldownFunction[Hashable] = key,
        factory: CooldownFunction[Optional[Cooldown]] = factory,
    ) -> Optional[Cooldown]:
        current = interaction.created_at.timestamp()
        dead_keys = [k for k, v in mapping.items() if current > v._last + v.per]
        for k in dead_keys:
            del mapping[k]

        k = await maybe_coroutine(key, interaction)
        if k not in mapping:
            bucket: Optional[Cooldown] = await maybe_coroutine(factory, interaction)
            if bucket is not None:
                mapping[k] = bucket
        else:
            bucket = mapping[k]

        return bucket

    async def predicate(interaction: Interaction) -> bool:
        bucket = await get_bucket(interaction)
        if bucket is None:
            return True

        retry_after = bucket.update_rate_limit(interaction.created_at.timestamp())
        if retry_after is None:
            return True

        raise CommandOnCooldown(bucket, retry_after)

    return check(predicate)


def cooldown(
    rate: float,
    per: float,
    *,
    key: Optional[CooldownFunction[Hashable]] = MISSING,
) -> Callable[[T], T]:
    """A decorator that adds a cooldown to a command.

    A cooldown allows a command to only be used a specific amount
    of times in a specific time frame. These cooldowns are based off
    of the ``key`` function provided. If a ``key`` is not provided
    then it defaults to a user-level cooldown. The ``key`` function
    must take a single parameter, the :class:`discord.Interaction` and
    return a value that is used as a key to the internal cooldown mapping.

    The ``key`` function can optionally be a coroutine.

    If a cooldown is triggered, then :exc:`~discord.app_commands.CommandOnCooldown` is
    raised to the error handlers.

    Examples
    ---------

    Setting a one per 5 seconds per member cooldown on a command:

    .. code-block:: python3

        @tree.command()
        @app_commands.checks.cooldown(1, 5.0, key=lambda i: (i.guild_id, i.user.id))
        async def test(interaction: discord.Interaction):
            await interaction.response.send_message('Hello')

        @test.error
        async def on_test_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
            if isinstance(error, app_commands.CommandOnCooldown):
                await interaction.response.send_message(str(error), ephemeral=True)

    Parameters
    ------------
    rate: :class:`int`
        The number of times a command can be used before triggering a cooldown.
    per: :class:`float`
        The amount of seconds to wait for a cooldown when it's been triggered.
    key: Optional[Callable[[:class:`discord.Interaction`], :class:`collections.abc.Hashable`]]
        A function that returns a key to the mapping denoting the type of cooldown.
        Can optionally be a coroutine. If not given then defaults to a user-level
        cooldown. If ``None`` is passed then it is interpreted as a "global" cooldown.
    """

    if key is MISSING:
        key_func = lambda interaction: interaction.user.id
    elif key is None:
        key_func = lambda i: None
    else:
        key_func = key

    factory = lambda interaction: Cooldown(rate, per)

    return _create_cooldown_decorator(key_func, factory)


def dynamic_cooldown(
    factory: CooldownFunction[Optional[Cooldown]],
    *,
    key: Optional[CooldownFunction[Hashable]] = MISSING,
) -> Callable[[T], T]:
    """A decorator that adds a dynamic cooldown to a command.

    A cooldown allows a command to only be used a specific amount
    of times in a specific time frame. These cooldowns are based off
    of the ``key`` function provided. If a ``key`` is not provided
    then it defaults to a user-level cooldown. The ``key`` function
    must take a single parameter, the :class:`discord.Interaction` and
    return a value that is used as a key to the internal cooldown mapping.

    If a ``factory`` function is given, it must be a function that
    accepts a single parameter of type :class:`discord.Interaction` and must
    return a :class:`~discord.app_commands.Cooldown` or ``None``.
    If ``None`` is returned then that cooldown is effectively bypassed.

    Both ``key`` and ``factory`` can optionally be coroutines.

    If a cooldown is triggered, then :exc:`~discord.app_commands.CommandOnCooldown` is
    raised to the error handlers.

    Examples
    ---------

    Setting a cooldown for everyone but the owner.

    .. code-block:: python3

        def cooldown_for_everyone_but_me(interaction: discord.Interaction) -> Optional[app_commands.Cooldown]:
            if interaction.user.id == 80088516616269824:
                return None
            return app_commands.Cooldown(1, 10.0)

        @tree.command()
        @app_commands.checks.dynamic_cooldown(cooldown_for_everyone_but_me)
        async def test(interaction: discord.Interaction):
            await interaction.response.send_message('Hello')

        @test.error
        async def on_test_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
            if isinstance(error, app_commands.CommandOnCooldown):
                await interaction.response.send_message(str(error), ephemeral=True)

    Parameters
    ------------
    factory: Optional[Callable[[:class:`discord.Interaction`], Optional[:class:`~discord.app_commands.Cooldown`]]]
        A function that takes an interaction and returns a cooldown that will apply to that interaction
        or ``None`` if the interaction should not have a cooldown.
    key: Optional[Callable[[:class:`discord.Interaction`], :class:`collections.abc.Hashable`]]
        A function that returns a key to the mapping denoting the type of cooldown.
        Can optionally be a coroutine. If not given then defaults to a user-level
        cooldown. If ``None`` is passed then it is interpreted as a "global" cooldown.
    """

    if key is MISSING:
        key_func = lambda interaction: interaction.user.id
    elif key is None:
        key_func = lambda i: None
    else:
        key_func = key

    return _create_cooldown_decorator(key_func, factory)


================================================
FILE: discord/app_commands/commands.py
================================================
"""
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations
import inspect

from typing import (
    Any,
    Callable,
    ClassVar,
    Coroutine,
    Dict,
    Generator,
    Generic,
    List,
    MutableMapping,
    Optional,
    Set,
    TYPE_CHECKING,
    Tuple,
    Type,
    TypeVar,
    Union,
    overload,
)

import re
from copy import copy as shallow_copy

from ..enums import AppCommandOptionType, AppCommandType, ChannelType, Locale
from .installs import AppCommandContext, AppInstallationType
from .models import Choice
from .transformers import annotation_to_parameter, CommandParameter, NoneType
from .errors import AppCommandError, CheckFailure, CommandInvokeError, CommandSignatureMismatch, CommandAlreadyRegistered
from .translator import TranslationContextLocation, TranslationContext, Translator, locale_str
from ..message import Message
from ..user import User
from ..member import Member
from ..permissions import Permissions
from ..utils import resolve_annotation, MISSING, is_inside_class, maybe_coroutine, async_all, _shorten, _to_kebab_case

if TYPE_CHECKING:
    from typing_extensions import ParamSpec, Concatenate, Unpack
    from ..interactions import Interaction
    from ..abc import Snowflake
    from .namespace import Namespace
    from .models import ChoiceT
    from .tree import CommandTree
    from .._types import ClientT

    # Generally, these two libraries are supposed to be separate from each other.
    # However, for type hinting purposes it's unfortunately necessary for one to
    # reference the other to prevent type checking errors in callbacks
    from discord.ext import commands
    from discord.permissions import _PermissionsKwargs

    ErrorFunc = Callable[[Interaction, AppCommandError], Coroutine[Any, Any, None]]

__all__ = (
    'Command',
    'ContextMenu',
    'Group',
    'Parameter',
    'context_menu',
    'command',
    'describe',
    'check',
    'rename',
    'choices',
    'autocomplete',
    'guilds',
    'guild_only',
    'dm_only',
    'private_channel_only',
    'allowed_contexts',
    'guild_install',
    'user_install',
    'allowed_installs',
    'default_permissions',
)

if TYPE_CHECKING:
    P = ParamSpec('P')
else:
    P = TypeVar('P')

T = TypeVar('T')
F = TypeVar('F', bound=Callable[..., Any])
GroupT = TypeVar('GroupT', bound='Binding')
Coro = Coroutine[Any, Any, T]
UnboundError = Callable[['Interaction[Any]', AppCommandError], Coro[Any]]
Error = Union[
    Callable[[GroupT, 'Interaction[Any]', AppCommandError], Coro[Any]],
    UnboundError,
]
Check = Callable[['Interaction[Any]'], Union[bool, Coro[bool]]]
Binding = Union['Group', 'commands.Cog']


if TYPE_CHECKING:
    CommandCallback = Union[
        Callable[Concatenate[GroupT, 'Interaction[Any]', P], Coro[T]],
        Callable[Concatenate['Interaction[Any]', P], Coro[T]],
    ]

    ContextMenuCallback = Union[
        # If groups end up support context menus these would be uncommented
        # Callable[[GroupT, 'Interaction', Member], Coro[Any]],
        # Callable[[GroupT, 'Interaction', User], Coro[Any]],
        # Callable[[GroupT, 'Interaction', Message], Coro[Any]],
        # Callable[[GroupT, 'Interaction', Union[Member, User]], Coro[Any]],
        Callable[['Interaction[Any]', Member], Coro[Any]],
        Callable[['Interaction[Any]', User], Coro[Any]],
        Callable[['Interaction[Any]', Message], Coro[Any]],
        Callable[['Interaction[Any]', Union[Member, User]], Coro[Any]],
    ]

    AutocompleteCallback = Union[
        Callable[[GroupT, 'Interaction[Any]', str], Coro[List[Choice[ChoiceT]]]],
        Callable[['Interaction[Any]', str], Coro[List[Choice[ChoiceT]]]],
    ]
else:
    CommandCallback = Callable[..., Coro[T]]
    ContextMenuCallback = Callable[..., Coro[T]]
    AutocompleteCallback = Callable[..., Coro[T]]


CheckInputParameter = Union['Command[Any, ..., Any]', 'ContextMenu', 'CommandCallback[Any, ..., Any]', ContextMenuCallback]

# The re module doesn't support \p{} so we have to list characters from Thai and Devanagari manually.
THAI_COMBINING = r'\u0e31-\u0e3a\u0e47-\u0e4e'
DEVANAGARI_COMBINING = r'\u0900-\u0903\u093a\u093b\u093c\u093e\u093f\u0940-\u094f\u0955\u0956\u0957\u0962\u0963'
VALID_SLASH_COMMAND_NAME = re.compile(r'^[-_\w' + THAI_COMBINING + DEVANAGARI_COMBINING + r']{1,32}$')

ARG_NAME_SUBREGEX = r'(?:\\?\*){0,2}(?P<name>\w+)'

ARG_DESCRIPTION_SUBREGEX = r'(?P<description>(?:.|\n)+?(?:\Z|\r?\n(?=[\S\r\n])))'

ARG_TYPE_SUBREGEX = r'(?:.+)'

GOOGLE_DOCSTRING_ARG_REGEX = re.compile(
    rf'^{ARG_NAME_SUBREGEX}[ \t]*(?:\({ARG_TYPE_SUBREGEX}\))?[ \t]*:[ \t]*{ARG_DESCRIPTION_SUBREGEX}',
    re.MULTILINE,
)

SPHINX_DOCSTRING_ARG_REGEX = re.compile(
    rf'^:param {ARG_NAME_SUBREGEX}:[ \t]+{ARG_DESCRIPTION_SUBREGEX}',
    re.MULTILINE,
)

NUMPY_DOCSTRING_ARG_REGEX = re.compile(
    rf'^{ARG_NAME_SUBREGEX}(?:[ \t]*:)?(?:[ \t]+{ARG_TYPE_SUBREGEX})?[ \t]*\r?\n[ \t]+{ARG_DESCRIPTION_SUBREGEX}',
    re.MULTILINE,
)


def _parse_args_from_docstring(func: Callable[..., Any], params: Dict[str, CommandParameter]) -> Dict[str, str]:
    docstring = inspect.getdoc(func)

    if docstring is None:
        return {}

    # Extract the arguments
    # Note: These are loose regexes, but they are good enough for our purposes
    # For Google-style, look only at the lines that are indented
    section_lines = inspect.cleandoc('\n'.join(line for line in docstring.splitlines() if line.startswith('  ')))
    docstring_styles = (
        GOOGLE_DOCSTRING_ARG_REGEX.finditer(section_lines),
        SPHINX_DOCSTRING_ARG_REGEX.finditer(docstring),
        NUMPY_DOCSTRING_ARG_REGEX.finditer(docstring),
    )

    return {
        m.group('name'): m.group('description') for matches in docstring_styles for m in matches if m.group('name') in params
    }


def validate_name(name: str) -> str:
    match = VALID_SLASH_COMMAND_NAME.match(name)
    if match is None:
        raise ValueError(
            f'{name!r} must be between 1-32 characters and contain only lower-case letters, numbers, hyphens, or underscores.'
        )

    # Ideally, name.islower() would work instead but since certain characters
    # are Lo (e.g. CJK) those don't pass the test. I'd use `casefold` instead as
    # well, but chances are the server-side check is probably something similar to
    # this code anyway.
    if name.lower() != name:
        raise ValueError(f'{name!r} must be all lower-case')
    return name


def validate_context_menu_name(name: str) -> str:
    if not name or len(name) > 32:
        raise ValueError('context menu names must be between 1-32 characters')
    return name


def validate_auto_complete_callback(
    callback: AutocompleteCallback[GroupT, ChoiceT],
) -> AutocompleteCallback[GroupT, ChoiceT]:
    # This function needs to ensure the following is true:
    # If self.foo is passed then don't pass command.binding to the callback
    # If Class.foo is passed then it is assumed command.binding has to be passed
    # If free_function_foo is passed then no binding should be passed at all
    # Passing command.binding is mandated by pass_command_binding

    binding = getattr(callback, '__self__', None)
    pass_command_binding = binding is None and is_inside_class(callback)

    # 'method' objects can't have dynamic attributes
    if binding is None:
        callback.pass_command_binding = pass_command_binding

    required_parameters = 2 + pass_command_binding
    params = inspect.signature(callback).parameters
    if len(params) != required_parameters:
        raise TypeError(f'autocomplete callback {callback.__qualname__!r} requires either 2 or 3 parameters to be passed')

    return callback


def _context_menu_annotation(annotation: Any, *, _none: type = NoneType) -> AppCommandType:
    if annotation is Message:
        return AppCommandType.message

    supported_types: Set[Any] = {Member, User}
    if annotation in supported_types:
        return AppCommandType.user

    # Check if there's an origin
    origin = getattr(annotation, '__origin__', None)
    if origin is not Union:
        # Only Union is supported so bail early
        msg = (
            f'unsupported type annotation {annotation!r}, must be either discord.Member, '
            'discord.User, discord.Message, or a typing.Union of discord.Member and discord.User'
        )
        raise TypeError(msg)

    # Only Union[Member, User] is supported
    if not all(arg in supported_types for arg in annotation.__args__):
        raise TypeError(f'unsupported types given inside {annotation!r}')

    return AppCommandType.user


def _populate_descriptions(params: Dict[str, CommandParameter], descriptions: Dict[str, Any]) -> None:
    for name, param in params.items():
        description = descriptions.pop(name, MISSING)
        if description is MISSING:
            param.description = '…'
            continue

        if not isinstance(description, (str, locale_str)):
            raise TypeError('description must be a string')

        if isinstance(description, str):
            param.description = _shorten(description)
        else:
            param.description = description

    if descriptions:
        first = next(iter(descriptions))
        raise TypeError(f'unknown parameter given: {first}')


def _populate_renames(params: Dict[str, CommandParameter], renames: Dict[str, Union[str, locale_str]]) -> None:
    rename_map: Dict[str, Union[str, locale_str]] = {}

    # original name to renamed name

    for name in params.keys():
        new_name = renames.pop(name, MISSING)

        if new_name is MISSING:
            rename_map[name] = name
            continue

        if name in rename_map:
            raise ValueError(f'{new_name} is already used')

        if isinstance(new_name, str):
            new_name = validate_name(new_name)
        else:
            validate_name(new_name.message)

        rename_map[name] = new_name
        params[name]._rename = new_name

    if renames:
        first = next(iter(renames))
        raise ValueError(f'unknown parameter given: {first}')


def _populate_choices(params: Dict[str, CommandParameter], all_choices: Dict[str, List[Choice]]) -> None:
    for name, param in params.items():
        choices = all_choices.pop(name, MISSING)
        if choices is MISSING:
            continue

        if not isinstance(choices, list):
            raise TypeError('choices must be a list of Choice')

        if not all(isinstance(choice, Choice) for choice in choices):
            raise TypeError('choices must be a list of Choice')

        if param.type not in (AppCommandOptionType.string, AppCommandOptionType.number, AppCommandOptionType.integer):
            raise TypeError('choices are only supported for integer, string, or number option types')

        if not all(param.type == choice._option_type for choice in choices):
            raise TypeError('choices must all have the same inner option type as the parameter choice type')

        param.choices = choices

    if all_choices:
        first = next(iter(all_choices))
        raise TypeError(f'unknown parameter given: {first}')


def _populate_autocomplete(params: Dict[str, CommandParameter], autocomplete: Dict[str, Any]) -> None:
    for name, param in params.items():
        callback = autocomplete.pop(name, MISSING)
        if callback is MISSING:
            continue

        if not inspect.iscoroutinefunction(callback):
            raise TypeError('autocomplete callback must be a coroutine function')

        if param.type not in (AppCommandOptionType.string, AppCommandOptionType.number, AppCommandOptionType.integer):
            raise TypeError('autocomplete is only supported for integer, string, or number option types')

        if param.is_choice_annotation():
            raise TypeError(
                'Choice annotation unsupported for autocomplete parameters, consider using a regular annotation instead'
            )

        param.autocomplete = validate_auto_complete_callback(callback)

    if autocomplete:
        first = next(iter(autocomplete))
        raise TypeError(f'unknown parameter given: {first}')


def _extract_parameters_from_callback(func: Callable[..., Any], globalns: Dict[str, Any]) -> Dict[str, CommandParameter]:
    params = inspect.signature(func).parameters
    cache = {}
    required_params = is_inside_class(func) + 1
    if len(params) < required_params:
        raise TypeError(f'callback {func.__qualname__!r} must have more than {required_params - 1} parameter(s)')

    iterator = iter(params.values())
    for _ in range(0, required_params):
        next(iterator)

    parameters: List[CommandParameter] = []
    for parameter in iterator:
        if parameter.annotation is parameter.empty:
            raise TypeError(f'parameter {parameter.name!r} is missing a type annotation in callback {func.__qualname__!r}')

        resolved = resolve_annotation(parameter.annotation, globalns, globalns, cache)
        param = annotation_to_parameter(resolved, parameter)
        parameters.append(param)

    values = sorted(parameters, key=lambda a: a.required, reverse=True)
    result = {v.name: v for v in values}

    descriptions = _parse_args_from_docstring(func, result)

    try:
        descriptions.update(func.__discord_app_commands_param_description__)
    except AttributeError:
        for param in values:
            if param.description is MISSING:
                param.description = '…'
    if descriptions:
        _populate_descriptions(result, descriptions)

    try:
        renames = func.__discord_app_commands_param_rename__
    except AttributeError:
        pass
    else:
        _populate_renames(result, renames.copy())

    try:
        choices = func.__discord_app_commands_param_choices__
    except AttributeError:
        pass
    else:
        _populate_choices(result, choices.copy())

    try:
        autocomplete = func.__discord_app_commands_param_autocomplete__
    except AttributeError:
        pass
    else:
        _populate_autocomplete(result, autocomplete.copy())

    return result


def _get_context_menu_parameter(func: ContextMenuCallback) -> Tuple[str, Any, AppCommandType]:
    params = inspect.signature(func).parameters
    if is_inside_class(func) and not hasattr(func, '__self__'):
        raise TypeError('context menus cannot be defined inside a class')

    if len(params) != 2:
        msg = (
            f'context menu callback {func.__qualname__!r} requires 2 parameters, '
            'the first one being the interaction and the other one explicitly '
            'annotated with either discord.Message, discord.User, discord.Member, '
            'or a typing.Union of discord.Member and discord.User'
        )
        raise TypeError(msg)

    iterator = iter(params.values())
    next(iterator)  # skip interaction
    parameter = next(iterator)
    if parameter.annotation is parameter.empty:
        msg = (
            f'second parameter of context menu callback {func.__qualname__!r} must be explicitly '
            'annotated with either discord.Message, discord.User, discord.Member, or '
            'a typing.Union of discord.Member and discord.User'
        )
        raise TypeError(msg)

    resolved = resolve_annotation(parameter.annotation, func.__globals__, func.__globals__, {})
    type = _context_menu_annotation(resolved)
    return (parameter.name, resolved, type)


def mark_overrideable(func: F) -> F:
    func.__discord_app_commands_base_function__ = None
    return func


class Parameter:
    """A class that contains the parameter information of a :class:`Command` callback.

    .. versionadded:: 2.0

    Attributes
    -----------
    name: :class:`str`
        The name of the parameter. This is the Python identifier for the parameter.
    display_name: :class:`str`
        The displayed name of the parameter on Discord.
    description: :class:`str`
        The description of the parameter.
    autocomplete: :class:`bool`
        Whether the parameter has an autocomplete handler.
    locale_name: Optional[:class:`locale_str`]
        The display name's locale string, if available.
    locale_description: Optional[:class:`locale_str`]
        The description's locale string, if available.
    required: :class:`bool`
        Whether the parameter is required
    choices: List[:class:`~discord.app_commands.Choice`]
        A list of choices this parameter takes, if any.
    type: :class:`~discord.AppCommandOptionType`
        The underlying type of this parameter.
    channel_types: List[:class:`~discord.ChannelType`]
        The channel types that are allowed for this parameter.
    min_value: Optional[Union[:class:`int`, :class:`float`]]
        The minimum supported value for this parameter.
    max_value: Optional[Union[:class:`int`, :class:`float`]]
        The maximum supported value for this parameter.
    default: Any
        The default value of the parameter, if given.
        If not given then this is :data:`~discord.utils.MISSING`.
    command: :class:`Command`
        The command this parameter is attached to.
    """

    def __init__(self, parent: CommandParameter, command: Command[Any, ..., Any]) -> None:
        self.__parent: CommandParameter = parent
        self.__command: Command[Any, ..., Any] = command

    @property
    def command(self) -> Command[Any, ..., Any]:
        return self.__command

    @property
    def name(self) -> str:
        return self.__parent.name

    @property
    def display_name(self) -> str:
        return self.__parent.display_name

    @property
    def required(self) -> bool:
        return self.__parent.required

    @property
    def description(self) -> str:
        return str(self.__parent.description)

    @property
    def locale_name(self) -> Optional[locale_str]:
        if isinstance(self.__parent._rename, locale_str):
            return self.__parent._rename
        return None

    @property
    def locale_description(self) -> Optional[locale_str]:
        if isinstance(self.__parent.description, locale_str):
            return self.__parent.description
        return None

    @property
    def autocomplete(self) -> bool:
        return self.__parent.autocomplete is not None

    @property
    def default(self) -> Any:
        return self.__parent.default

    @property
    def type(self) -> AppCommandOptionType:
        return self.__parent.type

    @property
    def choices(self) -> List[Choice[Union[int, float, str]]]:
        choices = self.__parent.choices
        if choices is MISSING:
            return []
        return choices.copy()

    @property
    def channel_types(self) -> List[ChannelType]:
        channel_types = self.__parent.channel_types
        if channel_types is MISSING:
            return []
        return channel_types.copy()

    @property
    def min_value(self) -> Optional[Union[int, float]]:
        return self.__parent.min_value

    @property
    def max_value(self) -> Optional[Union[int, float]]:
        return self.__parent.max_value


class Command(Generic[GroupT, P, T]):
    """A class that implements an application command.

    These are usually not created manually, instead they are created using
    one of the following decorators:

    - :func:`~discord.app_commands.command`
    - :meth:`Group.command <discord.app_commands.Group.command>`
    - :meth:`CommandTree.command <discord.app_commands.CommandTree.command>`

    .. versionadded:: 2.0

    Parameters
    -----------
    name: Union[:class:`str`, :class:`locale_str`]
        The name of the application command.
    description: Union[:class:`str`, :class:`locale_str`]
        The description of the application command. This shows up in the UI to describe
        the application command.
    callback: :ref:`coroutine <coroutine>`
        The coroutine that is executed when the command is called.
    auto_locale_strings: :class:`bool`
        If this is set to ``True``, then all translatable strings will implicitly
        be wrapped into :class:`locale_str` rather than :class:`str`. This could
        avoid some repetition and be more ergonomic for certain defaults such
        as default command names, command descriptions, and parameter names.
        Defaults to ``True``.
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.
        Defaults to ``False``.

        Due to a Discord limitation, this does not work on subcommands.
    parent: Optional[:class:`Group`]
        The parent application command. ``None`` if there isn't one.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.

    Attributes
    ------------
    name: :class:`str`
        The name of the application command.
    description: :class:`str`
        The description of the application command. This shows up in the UI to describe
        the application command.
    checks
        A list of predicates that take a :class:`~discord.Interaction` parameter
        to indicate whether the command callback should be executed. If an exception
        is necessary to be thrown to signal failure, then one inherited from
        :exc:`AppCommandError` should be used. If all the checks fail without
        propagating an exception, :exc:`CheckFailure` is raised.
    default_permissions: Optional[:class:`~discord.Permissions`]
        The default permissions that can execute this command on Discord. Note
        that server administrators can override this value in the client.
        Setting an empty permissions field will disallow anyone except server
        administrators from using the command in a guild.

        Due to a Discord limitation, this does not work on subcommands.
    guild_only: :class:`bool`
        Whether the command should only be usable in guild contexts.

        Due to a Discord limitation, this does not work on subcommands.
    allowed_contexts: Optional[:class:`~discord.app_commands.AppCommandContext`]
        The contexts that the command is allowed to be used in.
        Overrides ``guild_only`` if this is set.

        .. versionadded:: 2.4
    allowed_installs: Optional[:class:`~discord.app_commands.AppInstallationType`]
        The installation contexts that the command is allowed to be installed
        on.

        .. versionadded:: 2.4
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.

        Due to a Discord limitation, this does not work on subcommands.
    parent: Optional[:class:`Group`]
        The parent application command. ``None`` if there isn't one.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.
    """

    def __init__(
        self,
        *,
        name: Union[str, locale_str],
        description: Union[str, locale_str],
        callback: CommandCallback[GroupT, P, T],
        nsfw: bool = False,
        parent: Optional[Group] = None,
        guild_ids: Optional[List[int]] = None,
        allowed_contexts: Optional[AppCommandContext] = None,
        allowed_installs: Optional[AppInstallationType] = None,
        auto_locale_strings: bool = True,
        extras: Dict[Any, Any] = MISSING,
    ):
        name, locale = (name.message, name) if isinstance(name, locale_str) else (name, None)
        self.name: str = validate_name(name)
        self._locale_name: Optional[locale_str] = locale
        description, locale = (
            (description.message, description) if isinstance(description, locale_str) else (description, None)
        )
        self.description: str = description
        self._locale_description: Optional[locale_str] = locale
        self._attr: Optional[str] = None
        self._callback: CommandCallback[GroupT, P, T] = callback
        self.parent: Optional[Group] = parent
        self.binding: Optional[GroupT] = None
        self.on_error: Optional[Error[GroupT]] = None
        self.module: Optional[str] = callback.__module__

        # Unwrap __self__ for bound methods
        try:
            self.binding = callback.__self__
            self._callback = callback = callback.__func__
        except AttributeError:
            pass

        self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__)
        self.checks: List[Check] = getattr(callback, '__discord_app_commands_checks__', [])
        self._guild_ids: Optional[List[int]] = guild_ids
        if self._guild_ids is None:
            self._guild_ids = getattr(callback, '__discord_app_commands_default_guilds__', None)
        self.default_permissions: Optional[Permissions] = getattr(
            callback, '__discord_app_commands_default_permissions__', None
        )
        self.guild_only: bool = getattr(callback, '__discord_app_commands_guild_only__', False)
        self.allowed_contexts: Optional[AppCommandContext] = allowed_contexts or getattr(
            callback, '__discord_app_commands_contexts__', None
        )
        self.allowed_installs: Optional[AppInstallationType] = allowed_installs or getattr(
            callback, '__discord_app_commands_installation_types__', None
        )

        self.nsfw: bool = nsfw
        self.extras: Dict[Any, Any] = extras or {}

        if self._guild_ids is not None and self.parent is not None:
            raise ValueError('child commands cannot have default guilds set, consider setting them in the parent instead')

        if auto_locale_strings:
            self._convert_to_locale_strings()

    def _convert_to_locale_strings(self) -> None:
        if self._locale_name is None:
            self._locale_name = locale_str(self.name)
        if self._locale_description is None:
            self._locale_description = locale_str(self.description)

        for param in self._params.values():
            param._convert_to_locale_strings()

    def __set_name__(self, owner: Type[Any], name: str) -> None:
        self._attr = name

    @property
    def callback(self) -> CommandCallback[GroupT, P, T]:
        """:ref:`coroutine <coroutine>`: The coroutine that is executed when the command is called."""
        return self._callback

    def _copy_with(
        self,
        *,
        parent: Optional[Group],
        binding: GroupT,
        bindings: MutableMapping[GroupT, GroupT] = MISSING,
        set_on_binding: bool = True,
    ) -> Command:
        bindings = {} if bindings is MISSING else bindings

        copy = shallow_copy(self)
        copy._params = self._params.copy()
        copy.parent = parent
        copy.binding = bindings.get(self.binding) if self.binding is not None else binding

        if copy._attr and set_on_binding:
            setattr(copy.binding, copy._attr, copy)

        return copy

    async def get_translated_payload(self, tree: CommandTree[ClientT], translator: Translator) -> Dict[str, Any]:
        base = self.to_dict(tree)
        name_localizations: Dict[str, str] = {}
        description_localizations: Dict[str, str] = {}

        # Prevent creating these objects in a heavy loop
        name_context = TranslationContext(location=TranslationContextLocation.command_name, data=self)
        description_context = TranslationContext(location=TranslationContextLocation.command_description, data=self)

        for locale in Locale:
            if self._locale_name:
                translation = await translator._checked_translate(self._locale_name, locale, name_context)
                if translation is not None:
                    name_localizations[locale.value] = translation

            if self._locale_description:
                translation = await translator._checked_translate(self._locale_description, locale, description_context)
                if translation is not None:
                    description_localizations[locale.value] = translation

        base['name_localizations'] = name_localizations
        base['description_localizations'] = description_localizations
        base['options'] = [
            await param.get_translated_payload(translator, Parameter(param, self)) for param in self._params.values()
        ]
        return base

    def to_dict(self, tree: CommandTree[ClientT]) -> Dict[str, Any]:
        # If we have a parent then our type is a subcommand
        # Otherwise, the type falls back to the specific command type (e.g. slash command or context menu)
        option_type = AppCommandType.chat_input.value if self.parent is None else AppCommandOptionType.subcommand.value
        base: Dict[str, Any] = {
            'name': self.name,
            'description': self.description,
            'type': option_type,
            'options': [param.to_dict() for param in self._params.values()],
        }

        if self.parent is None:
            base['nsfw'] = self.nsfw
            base['dm_permission'] = not self.guild_only
            base['default_member_permissions'] = None if self.default_permissions is None else self.default_permissions.value
            base['contexts'] = tree.allowed_contexts._merge_to_array(self.allowed_contexts)
            base['integration_types'] = tree.allowed_installs._merge_to_array(self.allowed_installs)

        return base

    async def _invoke_error_handlers(self, interaction: Interaction, error: AppCommandError) -> None:
        # These type ignores are because the type checker can't narrow this type properly.
        if self.on_error is not None:
            if self.binding is not None:
                await self.on_error(self.binding, interaction, error)  # type: ignore
            else:
                await self.on_error(interaction, error)  # type: ignore

        parent = self.parent
        if parent is not None:
            await parent.on_error(interaction, error)

            if parent.parent is not None:
                await parent.parent.on_error(interaction, error)

        binding_error_handler = getattr(self.binding, '__discord_app_commands_error_handler__', None)
        if binding_error_handler is not None:
            await binding_error_handler(interaction, error)

    def _has_any_error_handlers(self) -> bool:
        if self.on_error is not None:
            return True

        parent = self.parent
        if parent is not None:
            # Check if the on_error is overridden
            if not hasattr(parent.on_error, '__discord_app_commands_base_function__'):
                return True

            if parent.parent is not None:
                if not hasattr(parent.parent.on_error, '__discord_app_commands_base_function__'):
                    return True

        # Check if we have a bound error handler
        if getattr(self.binding, '__discord_app_commands_error_handler__', None) is not None:
            return True

        return False

    async def _transform_arguments(self, interaction: Interaction, namespace: Namespace) -> Dict[str, Any]:
        values = namespace.__dict__
        transformed_values = {}

        for param in self._params.values():
            try:
                value = values[param.display_name]
            except KeyError:
                if not param.required:
                    transformed_values[param.name] = param.default
                else:
                    raise CommandSignatureMismatch(self) from None
            else:
                transformed_values[param.name] = await param.transform(interaction, value)

        return transformed_values

    async def _do_call(self, interaction: Interaction, params: Dict[str, Any]) -> T:
        # These type ignores are because the type checker doesn't quite understand the narrowing here
        # Likewise, it thinks we're missing positional arguments when there aren't any.
        try:
            if self.binding is not None:
                return await self._callback(self.binding, interaction, **params)  # type: ignore
            return await self._callback(interaction, **params)  # type: ignore
        except TypeError as e:
            # In order to detect mismatch from the provided signature and the Discord data,
            # there are many ways it can go wrong yet all of them eventually lead to a TypeError
            # from the Python compiler showcasing that the signature is incorrect. This lovely
            # piece of code essentially checks the last frame of the caller and checks if the
            # locals contains our `self` reference.
            #
            # This is because there is a possibility that a TypeError is raised within the body
            # of the function, and in that case the locals wouldn't contain a reference to
            # the command object under the name `self`.
            frame = inspect.trace()[-1].frame
            if frame.f_locals.get('self') is self:
                raise CommandSignatureMismatch(self) from None
            raise CommandInvokeError(self, e) from e
        except AppCommandError:
            raise
        except Exception as e:
            raise CommandInvokeError(self, e) from e

    async def _invoke_with_namespace(self, interaction: Interaction, namespace: Namespace) -> T:
        if not await self._check_can_run(interaction):
            raise CheckFailure(f'The check functions for command {self.name!r} failed.')

        transformed_values = await self._transform_arguments(interaction, namespace)
        return await self._do_call(interac
Download .txt
gitextract_zmbxq9eo/

├── .git-blame-ignore-revs
├── .github/
│   ├── CONTRIBUTING.md
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml
│   │   ├── config.yml
│   │   └── feature_request.yml
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       ├── build.yml
│       ├── crowdin_download.yml
│       ├── crowdin_upload.yml
│       ├── lint.yml
│       ├── scripts/
│       │   └── close_and_reopen_pr.js
│       └── test.yml
├── .gitignore
├── .readthedocs.yml
├── LICENSE
├── MANIFEST.in
├── README.ja.rst
├── README.rst
├── discord/
│   ├── __init__.py
│   ├── __main__.py
│   ├── _types.py
│   ├── abc.py
│   ├── activity.py
│   ├── app_commands/
│   │   ├── __init__.py
│   │   ├── checks.py
│   │   ├── commands.py
│   │   ├── errors.py
│   │   ├── installs.py
│   │   ├── models.py
│   │   ├── namespace.py
│   │   ├── transformers.py
│   │   ├── translator.py
│   │   └── tree.py
│   ├── appinfo.py
│   ├── asset.py
│   ├── audit_logs.py
│   ├── automod.py
│   ├── backoff.py
│   ├── bin/
│   │   └── COPYING
│   ├── channel.py
│   ├── client.py
│   ├── collectible.py
│   ├── colour.py
│   ├── components.py
│   ├── context_managers.py
│   ├── embeds.py
│   ├── emoji.py
│   ├── enums.py
│   ├── errors.py
│   ├── ext/
│   │   ├── commands/
│   │   │   ├── __init__.py
│   │   │   ├── _types.py
│   │   │   ├── bot.py
│   │   │   ├── cog.py
│   │   │   ├── context.py
│   │   │   ├── converter.py
│   │   │   ├── cooldowns.py
│   │   │   ├── core.py
│   │   │   ├── errors.py
│   │   │   ├── flags.py
│   │   │   ├── help.py
│   │   │   ├── hybrid.py
│   │   │   ├── parameters.py
│   │   │   └── view.py
│   │   └── tasks/
│   │       └── __init__.py
│   ├── file.py
│   ├── flags.py
│   ├── gateway.py
│   ├── guild.py
│   ├── http.py
│   ├── integrations.py
│   ├── interactions.py
│   ├── invite.py
│   ├── member.py
│   ├── mentions.py
│   ├── message.py
│   ├── mixins.py
│   ├── object.py
│   ├── oggparse.py
│   ├── onboarding.py
│   ├── opus.py
│   ├── partial_emoji.py
│   ├── permissions.py
│   ├── player.py
│   ├── poll.py
│   ├── presences.py
│   ├── primary_guild.py
│   ├── py.typed
│   ├── raw_models.py
│   ├── reaction.py
│   ├── role.py
│   ├── scheduled_event.py
│   ├── shard.py
│   ├── sku.py
│   ├── soundboard.py
│   ├── stage_instance.py
│   ├── state.py
│   ├── sticker.py
│   ├── subscription.py
│   ├── team.py
│   ├── template.py
│   ├── threads.py
│   ├── types/
│   │   ├── __init__.py
│   │   ├── activity.py
│   │   ├── appinfo.py
│   │   ├── audit_log.py
│   │   ├── automod.py
│   │   ├── channel.py
│   │   ├── command.py
│   │   ├── components.py
│   │   ├── embed.py
│   │   ├── emoji.py
│   │   ├── gateway.py
│   │   ├── guild.py
│   │   ├── integration.py
│   │   ├── interactions.py
│   │   ├── invite.py
│   │   ├── member.py
│   │   ├── message.py
│   │   ├── onboarding.py
│   │   ├── poll.py
│   │   ├── role.py
│   │   ├── scheduled_event.py
│   │   ├── sku.py
│   │   ├── snowflake.py
│   │   ├── soundboard.py
│   │   ├── sticker.py
│   │   ├── subscription.py
│   │   ├── team.py
│   │   ├── template.py
│   │   ├── threads.py
│   │   ├── user.py
│   │   ├── voice.py
│   │   ├── webhook.py
│   │   ├── welcome_screen.py
│   │   └── widget.py
│   ├── ui/
│   │   ├── __init__.py
│   │   ├── action_row.py
│   │   ├── button.py
│   │   ├── checkbox.py
│   │   ├── container.py
│   │   ├── dynamic.py
│   │   ├── file.py
│   │   ├── file_upload.py
│   │   ├── item.py
│   │   ├── label.py
│   │   ├── media_gallery.py
│   │   ├── modal.py
│   │   ├── radio.py
│   │   ├── section.py
│   │   ├── select.py
│   │   ├── separator.py
│   │   ├── text_display.py
│   │   ├── text_input.py
│   │   ├── thumbnail.py
│   │   └── view.py
│   ├── user.py
│   ├── utils.py
│   ├── voice_client.py
│   ├── voice_state.py
│   ├── webhook/
│   │   ├── __init__.py
│   │   ├── async_.py
│   │   └── sync.py
│   ├── welcome_screen.py
│   └── widget.py
├── docs/
│   ├── Makefile
│   ├── _static/
│   │   ├── codeblocks.css
│   │   ├── copy.js
│   │   ├── custom.js
│   │   ├── icons.css
│   │   ├── scorer.js
│   │   ├── settings.js
│   │   ├── sidebar.js
│   │   └── style.css
│   ├── _templates/
│   │   ├── genindex.html
│   │   ├── gettext/
│   │   │   └── message.pot_t
│   │   ├── layout.html
│   │   └── relations.html
│   ├── api.rst
│   ├── conf.py
│   ├── crowdin.yml
│   ├── discord.rst
│   ├── ext/
│   │   ├── commands/
│   │   │   ├── api.rst
│   │   │   ├── cogs.rst
│   │   │   ├── commands.rst
│   │   │   ├── extensions.rst
│   │   │   └── index.rst
│   │   └── tasks/
│   │       └── index.rst
│   ├── extensions/
│   │   ├── attributetable.py
│   │   ├── builder.py
│   │   ├── colour_preview.py
│   │   ├── details.py
│   │   ├── exception_hierarchy.py
│   │   ├── nitpick_file_ignorer.py
│   │   └── resourcelinks.py
│   ├── faq.rst
│   ├── index.rst
│   ├── intents.rst
│   ├── interactions/
│   │   └── api.rst
│   ├── intro.rst
│   ├── locale/
│   │   └── ja/
│   │       └── LC_MESSAGES/
│   │           ├── api.po
│   │           ├── discord.po
│   │           ├── ext/
│   │           │   ├── commands/
│   │           │   │   ├── api.po
│   │           │   │   ├── cogs.po
│   │           │   │   ├── commands.po
│   │           │   │   ├── extensions.po
│   │           │   │   └── index.po
│   │           │   └── tasks/
│   │           │       └── index.po
│   │           ├── faq.po
│   │           ├── index.po
│   │           ├── intents.po
│   │           ├── interactions/
│   │           │   └── api.po
│   │           ├── intro.po
│   │           ├── logging.po
│   │           ├── migrating.po
│   │           ├── migrating_to_async.po
│   │           ├── migrating_to_v1.po
│   │           ├── quickstart.po
│   │           ├── sphinx.po
│   │           ├── version_guarantees.po
│   │           └── whats_new.po
│   ├── logging.rst
│   ├── make.bat
│   ├── migrating.rst
│   ├── migrating_to_async.rst
│   ├── migrating_to_v1.rst
│   ├── quickstart.rst
│   ├── version_guarantees.rst
│   └── whats_new.rst
├── examples/
│   ├── advanced_startup.py
│   ├── app_commands/
│   │   ├── basic.py
│   │   └── transformers.py
│   ├── background_task.py
│   ├── background_task_asyncio.py
│   ├── basic_bot.py
│   ├── basic_voice.py
│   ├── converters.py
│   ├── custom_context.py
│   ├── deleted.py
│   ├── edits.py
│   ├── guessing_game.py
│   ├── modals/
│   │   ├── basic.py
│   │   ├── label.py
│   │   └── report.py
│   ├── new_member.py
│   ├── reaction_roles.py
│   ├── reply.py
│   ├── secret.py
│   └── views/
│       ├── confirm.py
│       ├── counter.py
│       ├── dropdown.py
│       ├── dynamic_counter.py
│       ├── embed_like.py
│       ├── ephemeral.py
│       ├── layout.py
│       ├── link.py
│       ├── persistent.py
│       ├── settings.py
│       └── tic_tac_toe.py
├── pyproject.toml
├── requirements.txt
├── setup.py
└── tests/
    ├── test_annotated_annotation.py
    ├── test_app_commands_autocomplete.py
    ├── test_app_commands_description.py
    ├── test_app_commands_group.py
    ├── test_app_commands_invoke.py
    ├── test_colour.py
    ├── test_embed.py
    ├── test_ext_commands_cog.py
    ├── test_ext_commands_description.py
    ├── test_ext_tasks.py
    ├── test_files.py
    ├── test_permissions_all.py
    ├── test_ui_buttons.py
    ├── test_ui_modals.py
    ├── test_ui_selects.py
    └── test_utils.py
Download .txt
Showing preview only (466K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (5690 symbols across 197 files)

FILE: discord/__init__.py
  class VersionInfo (line 81) | class VersionInfo(NamedTuple):

FILE: discord/__main__.py
  function show_version (line 39) | def show_version() -> None:
  function core (line 64) | def core(parser: argparse.ArgumentParser, args: argparse.Namespace) -> N...
  function to_path (line 205) | def to_path(parser: argparse.ArgumentParser, name: str, *, replace_space...
  function newbot (line 249) | def newbot(parser: argparse.ArgumentParser, args: argparse.Namespace) ->...
  function newcog (line 291) | def newcog(parser: argparse.ArgumentParser, args: argparse.Namespace) ->...
  function add_newbot_args (line 325) | def add_newbot_args(subparser: argparse._SubParsersAction[argparse.Argum...
  function add_newcog_args (line 336) | def add_newcog_args(subparser: argparse._SubParsersAction[argparse.Argum...
  function parse_args (line 348) | def parse_args() -> Tuple[argparse.ArgumentParser, argparse.Namespace]:
  function main (line 359) | def main() -> None:

FILE: discord/abc.py
  class PinnedMessage (line 121) | class PinnedMessage(Message):
  class _Undefined (line 129) | class _Undefined:
    method __repr__ (line 130) | def __repr__(self) -> str:
  class _PinsIterator (line 137) | class _PinsIterator:
    method __init__ (line 138) | def __init__(self, iterator: AsyncIterator[PinnedMessage]) -> None:
    method __await__ (line 141) | def __await__(self) -> Generator[Any, None, List[PinnedMessage]]:
    method __aiter__ (line 153) | def __aiter__(self) -> AsyncIterator[PinnedMessage]:
  function _single_delete_strategy (line 157) | async def _single_delete_strategy(messages: Iterable[Message], *, reason...
  function _purge_helper (line 169) | async def _purge_helper(
  class Snowflake (line 231) | class Snowflake(Protocol):
  class User (line 250) | class User(Snowflake, Protocol):
    method display_name (line 282) | def display_name(self) -> str:
    method mention (line 287) | def mention(self) -> str:
    method avatar (line 292) | def avatar(self) -> Optional[Asset]:
    method avatar_decoration (line 297) | def avatar_decoration(self) -> Optional[Asset]:
    method avatar_decoration_sku_id (line 305) | def avatar_decoration_sku_id(self) -> Optional[int]:
    method default_avatar (line 313) | def default_avatar(self) -> Asset:
    method display_avatar (line 318) | def display_avatar(self) -> Asset:
    method mentioned_in (line 327) | def mentioned_in(self, message: Message) -> bool:
  class PrivateChannel (line 343) | class PrivateChannel:
  class _Overwrites (line 365) | class _Overwrites:
    method __init__ (line 371) | def __init__(self, data: PermissionOverwritePayload) -> None:
    method _asdict (line 377) | def _asdict(self) -> PermissionOverwritePayload:
    method is_role (line 385) | def is_role(self) -> bool:
    method is_member (line 388) | def is_member(self) -> bool:
  class GuildChannel (line 392) | class GuildChannel:
    method __init__ (line 429) | def __init__(self, *, state: ConnectionState, guild: Guild, data: Guil...
    method __str__ (line 431) | def __str__(self) -> str:
    method _sorting_bucket (line 435) | def _sorting_bucket(self) -> int:
    method _update (line 438) | def _update(self, guild: Guild, data: Dict[str, Any]) -> None:
    method _move (line 441) | async def _move(
    method _edit (line 478) | async def _edit(self, options: Dict[str, Any], reason: Optional[str]) ...
    method _fill_overwrites (line 573) | def _fill_overwrites(self, data: GuildChannelPayload) -> None:
    method changed_roles (line 599) | def changed_roles(self) -> List[Role]:
    method mention (line 615) | def mention(self) -> str:
    method jump_url (line 620) | def jump_url(self) -> str:
    method created_at (line 628) | def created_at(self) -> datetime:
    method overwrites_for (line 632) | def overwrites_for(self, obj: Union[Role, User, Object]) -> Permission...
    method overwrites (line 662) | def overwrites(self) -> Dict[Union[Role, Member, Object], PermissionOv...
    method category (line 697) | def category(self) -> Optional[CategoryChannel]:
    method permissions_synced (line 705) | def permissions_synced(self) -> bool:
    method _apply_implicit_permissions (line 719) | def _apply_implicit_permissions(self, base: Permissions) -> None:
    method permissions_for (line 733) | def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
    method delete (line 880) | async def delete(self, *, reason: Optional[str] = None) -> None:
    method set_permissions (line 905) | async def set_permissions(
    method set_permissions (line 914) | async def set_permissions(
    method set_permissions (line 922) | async def set_permissions(
    method _clone_impl (line 1036) | async def _clone_impl(
    method clone (line 1059) | async def clone(
    method move (line 1103) | async def move(
    method move (line 1114) | async def move(
    method move (line 1125) | async def move(
    method move (line 1136) | async def move(
    method move (line 1146) | async def move(self, **kwargs: Any) -> None:
    method create_invite (line 1274) | async def create_invite(
    method invites (line 1364) | async def invites(self) -> List[Invite]:
  class Messageable (line 1390) | class Messageable:
    method _get_channel (line 1410) | async def _get_channel(self) -> MessageableChannel:
    method send (line 1414) | async def send(
    method send (line 1429) | async def send(
    method send (line 1444) | async def send(
    method send (line 1464) | async def send(
    method send (line 1484) | async def send(
    method send (line 1504) | async def send(
    method send (line 1523) | async def send(
    method typing (line 1719) | def typing(self) -> Typing:
    method fetch_message (line 1746) | async def fetch_message(self, id: int, /) -> Message:
    method __pins (line 1775) | async def __pins(
    method pins (line 1826) | def pins(
    method history (line 1902) | async def history(
  class Connectable (line 2067) | class Connectable(Protocol):
    method _get_voice_client_key (line 2080) | def _get_voice_client_key(self) -> Tuple[int, str]:
    method _get_voice_state_pair (line 2083) | def _get_voice_state_pair(self) -> Tuple[int, int]:
    method connect (line 2086) | async def connect(

FILE: discord/activity.py
  class BaseActivity (line 102) | class BaseActivity:
    method __init__ (line 123) | def __init__(self, **kwargs: Any) -> None:
    method created_at (line 127) | def created_at(self) -> Optional[datetime.datetime]:
    method to_dict (line 135) | def to_dict(self) -> ActivityPayload:
  class Activity (line 139) | class Activity(BaseActivity):
    method __init__ (line 236) | def __init__(self, **kwargs: Any) -> None:
    method __repr__ (line 272) | def __repr__(self) -> str:
    method to_dict (line 286) | def to_dict(self) -> Dict[str, Any]:
    method start (line 305) | def start(self) -> Optional[datetime.datetime]:
    method end (line 315) | def end(self) -> Optional[datetime.datetime]:
    method large_image_url (line 325) | def large_image_url(self) -> Optional[str]:
    method small_image_url (line 335) | def small_image_url(self) -> Optional[str]:
    method _image_url (line 344) | def _image_url(self, image: str) -> Optional[str]:
    method large_image_text (line 351) | def large_image_text(self) -> Optional[str]:
    method small_image_text (line 356) | def small_image_text(self) -> Optional[str]:
  class Game (line 361) | class Game(BaseActivity):
    method __init__ (line 412) | def __init__(self, name: str, **extra: Any) -> None:
    method type (line 428) | def type(self) -> ActivityType:
    method start (line 436) | def start(self) -> Optional[datetime.datetime]:
    method end (line 443) | def end(self) -> Optional[datetime.datetime]:
    method __str__ (line 449) | def __str__(self) -> str:
    method __repr__ (line 452) | def __repr__(self) -> str:
    method to_dict (line 455) | def to_dict(self) -> Dict[str, Any]:
    method __eq__ (line 471) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 474) | def __ne__(self, other: object) -> bool:
    method __hash__ (line 477) | def __hash__(self) -> int:
  class Streaming (line 481) | class Streaming(BaseActivity):
    method __init__ (line 528) | def __init__(self, *, name: Optional[str], url: str, **extra: Any) -> ...
    method type (line 538) | def type(self) -> ActivityType:
    method __str__ (line 545) | def __str__(self) -> str:
    method __repr__ (line 548) | def __repr__(self) -> str:
    method twitch_name (line 552) | def twitch_name(self) -> Optional[str]:
    method to_dict (line 566) | def to_dict(self) -> Dict[str, Any]:
    method __eq__ (line 577) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 580) | def __ne__(self, other: object) -> bool:
    method __hash__ (line 583) | def __hash__(self) -> int:
  class Spotify (line 587) | class Spotify:
    method __init__ (line 612) | def __init__(self, **data: Any) -> None:
    method type (line 623) | def type(self) -> ActivityType:
    method created_at (line 631) | def created_at(self) -> Optional[datetime.datetime]:
    method colour (line 640) | def colour(self) -> Colour:
    method color (line 647) | def color(self) -> Colour:
    method to_dict (line 653) | def to_dict(self) -> Dict[str, Any]:
    method name (line 667) | def name(self) -> str:
    method __eq__ (line 671) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 679) | def __ne__(self, other: object) -> bool:
    method __hash__ (line 682) | def __hash__(self) -> int:
    method __str__ (line 685) | def __str__(self) -> str:
    method __repr__ (line 688) | def __repr__(self) -> str:
    method title (line 692) | def title(self) -> str:
    method artists (line 697) | def artists(self) -> List[str]:
    method artist (line 702) | def artist(self) -> str:
    method album (line 711) | def album(self) -> str:
    method album_cover_url (line 716) | def album_cover_url(self) -> str:
    method track_id (line 725) | def track_id(self) -> str:
    method track_url (line 730) | def track_url(self) -> str:
    method start (line 738) | def start(self) -> datetime.datetime:
    method end (line 744) | def end(self) -> datetime.datetime:
    method duration (line 750) | def duration(self) -> datetime.timedelta:
    method party_id (line 755) | def party_id(self) -> str:
  class CustomActivity (line 760) | class CustomActivity(BaseActivity):
    method __init__ (line 793) | def __init__(
    method type (line 815) | def type(self) -> ActivityType:
    method to_dict (line 822) | def to_dict(self) -> Dict[str, Any]:
    method __eq__ (line 839) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 842) | def __ne__(self, other: object) -> bool:
    method __hash__ (line 845) | def __hash__(self) -> int:
    method __str__ (line 848) | def __str__(self) -> str:
    method __repr__ (line 856) | def __repr__(self) -> str:
  function create_activity (line 864) | def create_activity(data: ActivityPayload, state: ConnectionState) -> Ac...
  function create_activity (line 868) | def create_activity(data: None, state: ConnectionState) -> None: ...
  function create_activity (line 871) | def create_activity(data: Optional[ActivityPayload], state: ConnectionSt...

FILE: discord/app_commands/checks.py
  class Cooldown (line 77) | class Cooldown:
    method __init__ (line 92) | def __init__(self, rate: float, per: float) -> None:
    method get_tokens (line 99) | def get_tokens(self, current: Optional[float] = None) -> int:
    method get_retry_after (line 123) | def get_retry_after(self, current: Optional[float] = None) -> float:
    method update_rate_limit (line 145) | def update_rate_limit(self, current: Optional[float] = None, *, tokens...
    method reset (line 177) | def reset(self) -> None:
    method copy (line 182) | def copy(self) -> Self:
    method __repr__ (line 192) | def __repr__(self) -> str:
  function has_role (line 196) | def has_role(item: Union[int, str], /) -> Callable[[T], T]:
  function has_any_role (line 239) | def has_any_role(*items: Union[int, str]) -> Callable[[T], T]:
  function has_permissions (line 290) | def has_permissions(**perms: Unpack[_PermissionsKwargs]) -> Callable[[T]...
  function bot_has_permissions (line 345) | def bot_has_permissions(**perms: Unpack[_PermissionsKwargs]) -> Callable...
  function _create_cooldown_decorator (line 371) | def _create_cooldown_decorator(
  function cooldown (line 412) | def cooldown(
  function dynamic_cooldown (line 473) | def dynamic_cooldown(

FILE: discord/app_commands/commands.py
  function _parse_args_from_docstring (line 178) | def _parse_args_from_docstring(func: Callable[..., Any], params: Dict[st...
  function validate_name (line 199) | def validate_name(name: str) -> str:
  function validate_context_menu_name (line 215) | def validate_context_menu_name(name: str) -> str:
  function validate_auto_complete_callback (line 221) | def validate_auto_complete_callback(
  function _context_menu_annotation (line 245) | def _context_menu_annotation(annotation: Any, *, _none: type = NoneType)...
  function _populate_descriptions (line 270) | def _populate_descriptions(params: Dict[str, CommandParameter], descript...
  function _populate_renames (line 290) | def _populate_renames(params: Dict[str, CommandParameter], renames: Dict...
  function _populate_choices (line 318) | def _populate_choices(params: Dict[str, CommandParameter], all_choices: ...
  function _populate_autocomplete (line 343) | def _populate_autocomplete(params: Dict[str, CommandParameter], autocomp...
  function _extract_parameters_from_callback (line 367) | def _extract_parameters_from_callback(func: Callable[..., Any], globalns...
  function _get_context_menu_parameter (line 425) | def _get_context_menu_parameter(func: ContextMenuCallback) -> Tuple[str,...
  function mark_overrideable (line 455) | def mark_overrideable(func: F) -> F:
  class Parameter (line 460) | class Parameter:
    method __init__ (line 498) | def __init__(self, parent: CommandParameter, command: Command[Any, ......
    method command (line 503) | def command(self) -> Command[Any, ..., Any]:
    method name (line 507) | def name(self) -> str:
    method display_name (line 511) | def display_name(self) -> str:
    method required (line 515) | def required(self) -> bool:
    method description (line 519) | def description(self) -> str:
    method locale_name (line 523) | def locale_name(self) -> Optional[locale_str]:
    method locale_description (line 529) | def locale_description(self) -> Optional[locale_str]:
    method autocomplete (line 535) | def autocomplete(self) -> bool:
    method default (line 539) | def default(self) -> Any:
    method type (line 543) | def type(self) -> AppCommandOptionType:
    method choices (line 547) | def choices(self) -> List[Choice[Union[int, float, str]]]:
    method channel_types (line 554) | def channel_types(self) -> List[ChannelType]:
    method min_value (line 561) | def min_value(self) -> Optional[Union[int, float]]:
    method max_value (line 565) | def max_value(self) -> Optional[Union[int, float]]:
  class Command (line 569) | class Command(Generic[GroupT, P, T]):
    method __init__ (line 652) | def __init__(
    method _convert_to_locale_strings (line 713) | def _convert_to_locale_strings(self) -> None:
    method __set_name__ (line 722) | def __set_name__(self, owner: Type[Any], name: str) -> None:
    method callback (line 726) | def callback(self) -> CommandCallback[GroupT, P, T]:
    method _copy_with (line 730) | def _copy_with(
    method get_translated_payload (line 750) | async def get_translated_payload(self, tree: CommandTree[ClientT], tra...
    method to_dict (line 777) | def to_dict(self, tree: CommandTree[ClientT]) -> Dict[str, Any]:
    method _invoke_error_handlers (line 797) | async def _invoke_error_handlers(self, interaction: Interaction, error...
    method _has_any_error_handlers (line 816) | def _has_any_error_handlers(self) -> bool:
    method _transform_arguments (line 836) | async def _transform_arguments(self, interaction: Interaction, namespa...
    method _do_call (line 853) | async def _do_call(self, interaction: Interaction, params: Dict[str, A...
    method _invoke_with_namespace (line 879) | async def _invoke_with_namespace(self, interaction: Interaction, names...
    method _invoke_autocomplete (line 886) | async def _invoke_autocomplete(self, interaction: Interaction, name: s...
    method _get_internal_command (line 930) | def _get_internal_command(self, name: str) -> Optional[Union[Command, ...
    method parameters (line 934) | def parameters(self) -> List[Parameter]:
    method get_parameter (line 946) | def get_parameter(self, name: str) -> Optional[Parameter]:
    method root_parent (line 969) | def root_parent(self) -> Optional[Group]:
    method qualified_name (line 977) | def qualified_name(self) -> str:
    method _check_can_run (line 997) | async def _check_can_run(self, interaction: Interaction) -> bool:
    method error (line 1020) | def error(self, coro: Error[GroupT]) -> Error[GroupT]:
    method autocomplete (line 1046) | def autocomplete(
    method add_check (line 1122) | def add_check(self, func: Check, /) -> None:
    method remove_check (line 1135) | def remove_check(self, func: Check, /) -> None:
  class ContextMenu (line 1153) | class ContextMenu:
    method __init__ (line 1225) | def __init__(
    method callback (line 1276) | def callback(self) -> ContextMenuCallback:
    method qualified_name (line 1281) | def qualified_name(self) -> str:
    method get_translated_payload (line 1285) | async def get_translated_payload(self, tree: CommandTree[ClientT], tra...
    method to_dict (line 1298) | def to_dict(self, tree: CommandTree[ClientT]) -> Dict[str, Any]:
    method _check_can_run (line 1309) | async def _check_can_run(self, interaction: Interaction) -> bool:
    method _has_any_error_handlers (line 1316) | def _has_any_error_handlers(self) -> bool:
    method _invoke (line 1319) | async def _invoke(self, interaction: Interaction, arg: Any):
    method error (line 1330) | def error(self, coro: UnboundError) -> UnboundError:
    method add_check (line 1356) | def add_check(self, func: Check, /) -> None:
    method remove_check (line 1369) | def remove_check(self, func: Check, /) -> None:
  class Group (line 1387) | class Group:
    method __init_subclass__ (line 1498) | def __init_subclass__(
    method __init__ (line 1552) | def __init__(
    method _convert_to_locale_strings (line 1676) | def _convert_to_locale_strings(self) -> None:
    method __set_name__ (line 1684) | def __set_name__(self, owner: Type[Any], name: str) -> None:
    method _copy_with (line 1689) | def _copy_with(
    method get_translated_payload (line 1721) | async def get_translated_payload(self, tree: CommandTree[ClientT], tra...
    method to_dict (line 1745) | def to_dict(self, tree: CommandTree[ClientT]) -> Dict[str, Any]:
    method root_parent (line 1766) | def root_parent(self) -> Optional[Group]:
    method qualified_name (line 1771) | def qualified_name(self) -> str:
    method _get_internal_command (line 1782) | def _get_internal_command(self, name: str) -> Optional[Union[Command[A...
    method commands (line 1786) | def commands(self) -> List[Union[Command[Any, ..., Any], Group]]:
    method walk_commands (line 1790) | def walk_commands(self) -> Generator[Union[Command[Any, ..., Any], Gro...
    method on_error (line 1805) | async def on_error(self, interaction: Interaction[ClientT], error: App...
    method error (line 1824) | def error(self, coro: ErrorFunc) -> ErrorFunc:
    method interaction_check (line 1853) | async def interaction_check(self, interaction: Interaction[ClientT], /...
    method add_command (line 1884) | def add_command(self, command: Union[Command[Any, ..., Any], Group], /...
    method remove_command (line 1926) | def remove_command(self, name: str, /) -> Optional[Union[Command[Any, ...
    method get_command (line 1943) | def get_command(self, name: str, /) -> Optional[Union[Command[Any, ......
    method command (line 1959) | def command(
  function command (line 2019) | def command(
  function context_menu (line 2078) | def context_menu(
  function describe (line 2141) | def describe(**parameters: Union[str, locale_str]) -> Callable[[T], T]:
  function rename (line 2197) | def rename(**parameters: Union[str, locale_str]) -> Callable[[T], T]:
  function choices (line 2241) | def choices(**parameters: List[Choice[ChoiceT]]) -> Callable[[T], T]:
  function autocomplete (line 2311) | def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) ->...
  function guilds (line 2371) | def guilds(*guild_ids: Union[Snowflake, int]) -> Callable[[T], T]:
  function check (line 2432) | def check(predicate: Check) -> Callable[[T], T]:
  function guild_only (line 2493) | def guild_only(func: None = ...) -> Callable[[T], T]: ...
  function guild_only (line 2497) | def guild_only(func: T) -> T: ...
  function guild_only (line 2500) | def guild_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
  function private_channel_only (line 2546) | def private_channel_only(func: None = ...) -> Callable[[T], T]: ...
  function private_channel_only (line 2550) | def private_channel_only(func: T) -> T: ...
  function private_channel_only (line 2553) | def private_channel_only(func: Optional[T] = None) -> Union[T, Callable[...
  function dm_only (line 2599) | def dm_only(func: None = ...) -> Callable[[T], T]: ...
  function dm_only (line 2603) | def dm_only(func: T) -> T: ...
  function dm_only (line 2606) | def dm_only(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
  function allowed_contexts (line 2648) | def allowed_contexts(guilds: bool = MISSING, dms: bool = MISSING, privat...
  function guild_install (line 2694) | def guild_install(func: None = ...) -> Callable[[T], T]: ...
  function guild_install (line 2698) | def guild_install(func: T) -> T: ...
  function guild_install (line 2701) | def guild_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
  function user_install (line 2743) | def user_install(func: None = ...) -> Callable[[T], T]: ...
  function user_install (line 2747) | def user_install(func: T) -> T: ...
  function user_install (line 2750) | def user_install(func: Optional[T] = None) -> Union[T, Callable[[T], T]]:
  function allowed_installs (line 2791) | def allowed_installs(
  function default_permissions (line 2835) | def default_permissions(perms_obj: Optional[Permissions] = None, /, **pe...

FILE: discord/app_commands/errors.py
  class AppCommandError (line 63) | class AppCommandError(DiscordException):
  class CommandInvokeError (line 82) | class CommandInvokeError(AppCommandError):
    method __init__ (line 98) | def __init__(self, command: Union[Command[Any, ..., Any], ContextMenu]...
  class TransformerError (line 104) | class TransformerError(AppCommandError):
    method __init__ (line 128) | def __init__(self, value: Any, opt_type: AppCommandOptionType, transfo...
  class TranslationError (line 136) | class TranslationError(AppCommandError):
    method __init__ (line 158) | def __init__(
  class CheckFailure (line 180) | class CheckFailure(AppCommandError):
  class NoPrivateMessage (line 191) | class NoPrivateMessage(CheckFailure):
    method __init__ (line 199) | def __init__(self, message: Optional[str] = None) -> None:
  class MissingRole (line 203) | class MissingRole(CheckFailure):
    method __init__ (line 217) | def __init__(self, missing_role: Snowflake) -> None:
  class MissingAnyRole (line 223) | class MissingAnyRole(CheckFailure):
    method __init__ (line 238) | def __init__(self, missing_roles: SnowflakeList) -> None:
  class MissingPermissions (line 246) | class MissingPermissions(CheckFailure):
    method __init__ (line 260) | def __init__(self, missing_permissions: List[str], *args: Any) -> None:
  class BotMissingPermissions (line 269) | class BotMissingPermissions(CheckFailure):
    method __init__ (line 283) | def __init__(self, missing_permissions: List[str], *args: Any) -> None:
  class CommandOnCooldown (line 292) | class CommandOnCooldown(CheckFailure):
    method __init__ (line 307) | def __init__(self, cooldown: Cooldown, retry_after: float) -> None:
  class CommandAlreadyRegistered (line 313) | class CommandAlreadyRegistered(AppCommandError):
    method __init__ (line 329) | def __init__(self, name: str, guild_id: Optional[int]):
  class CommandNotFound (line 335) | class CommandNotFound(AppCommandError):
    method __init__ (line 353) | def __init__(self, name: str, parents: List[str], type: AppCommandType...
  class CommandLimitReached (line 360) | class CommandLimitReached(AppCommandError):
    method __init__ (line 378) | def __init__(self, guild_id: Optional[int], limit: int, type: AppComma...
  class CommandSignatureMismatch (line 393) | class CommandSignatureMismatch(AppCommandError):
    method __init__ (line 409) | def __init__(self, command: Union[Command[Any, ..., Any], ContextMenu,...
  function _get_command_error (line 420) | def _get_command_error(
  class CommandSyncFailure (line 487) | class CommandSyncFailure(AppCommandError, HTTPException):
    method __init__ (line 498) | def __init__(self, child: HTTPException, commands: List[CommandTypes])...

FILE: discord/app_commands/installs.py
  class AppInstallationType (line 38) | class AppInstallationType:
    method __init__ (line 56) | def __init__(self, *, guild: Optional[bool] = None, user: Optional[boo...
    method __repr__ (line 60) | def __repr__(self):
    method guild (line 64) | def guild(self) -> bool:
    method guild (line 69) | def guild(self, value: bool) -> None:
    method user (line 73) | def user(self) -> bool:
    method user (line 78) | def user(self, value: bool) -> None:
    method merge (line 81) | def merge(self, other: AppInstallationType) -> AppInstallationType:
    method _is_unset (line 88) | def _is_unset(self) -> bool:
    method _merge_to_array (line 91) | def _merge_to_array(self, other: Optional[AppInstallationType]) -> Opt...
    method _from_value (line 98) | def _from_value(cls, value: Sequence[InteractionInstallationType]) -> ...
    method to_array (line 107) | def to_array(self) -> List[InteractionInstallationType]:
  class AppCommandContext (line 116) | class AppCommandContext:
    method __init__ (line 137) | def __init__(
    method __repr__ (line 148) | def __repr__(self) -> str:
    method guild (line 152) | def guild(self) -> bool:
    method guild (line 157) | def guild(self, value: bool) -> None:
    method dm_channel (line 161) | def dm_channel(self) -> bool:
    method dm_channel (line 166) | def dm_channel(self, value: bool) -> None:
    method private_channel (line 170) | def private_channel(self) -> bool:
    method private_channel (line 175) | def private_channel(self, value: bool) -> None:
    method merge (line 178) | def merge(self, other: AppCommandContext) -> AppCommandContext:
    method _is_unset (line 184) | def _is_unset(self) -> bool:
    method _merge_to_array (line 187) | def _merge_to_array(self, other: Optional[AppCommandContext]) -> Optio...
    method _from_value (line 194) | def _from_value(cls, value: Sequence[InteractionContextType]) -> Self:
    method to_array (line 205) | def to_array(self) -> List[InteractionContextType]:

FILE: discord/app_commands/models.py
  function is_app_command_argument_type (line 64) | def is_app_command_argument_type(value: int) -> bool:
  class AllChannels (line 95) | class AllChannels:
    method __init__ (line 108) | def __init__(self, guild: Guild):
    method id (line 112) | def id(self) -> int:
    method __repr__ (line 116) | def __repr__(self) -> str:
  function _to_locale_dict (line 120) | def _to_locale_dict(data: Dict[str, str]) -> Dict[Locale, str]:
  class AppCommand (line 124) | class AppCommand(Hashable):
    method __init__ (line 205) | def __init__(self, *, data: ApplicationCommandPayload, state: Connecti...
    method _from_data (line 209) | def _from_data(self, data: ApplicationCommandPayload) -> None:
    method to_dict (line 249) | def to_dict(self) -> ApplicationCommandPayload:
    method __str__ (line 263) | def __str__(self) -> str:
    method __repr__ (line 266) | def __repr__(self) -> str:
    method mention (line 270) | def mention(self) -> str:
    method guild (line 275) | def guild(self) -> Optional[Guild]:
    method delete (line 281) | async def delete(self) -> None:
    method edit (line 313) | async def edit(
    method fetch_permissions (line 398) | async def fetch_permissions(self, guild: Snowflake) -> GuildAppCommand...
  class Choice (line 438) | class Choice(Generic[ChoiceT]):
    method __init__ (line 471) | def __init__(self, *, name: Union[str, locale_str], value: ChoiceT):
    method from_dict (line 479) | def from_dict(cls, data: ApplicationCommandOptionChoice) -> Choice[Cho...
    method __eq__ (line 486) | def __eq__(self, o: object) -> bool:
    method __hash__ (line 489) | def __hash__(self) -> int:
    method __repr__ (line 492) | def __repr__(self) -> str:
    method _option_type (line 496) | def _option_type(self) -> AppCommandOptionType:
    method get_translated_payload (line 508) | async def get_translated_payload(self, translator: Translator) -> Dict...
    method get_translated_payload_for_locale (line 523) | async def get_translated_payload_for_locale(self, translator: Translat...
    method to_dict (line 533) | def to_dict(self) -> Dict[str, Any]:
  class AppCommandChannel (line 543) | class AppCommandChannel(Hashable):
    method __init__ (line 626) | def __init__(
    method __str__ (line 648) | def __str__(self) -> str:
    method __repr__ (line 651) | def __repr__(self) -> str:
    method guild (line 655) | def guild(self) -> Optional[Guild]:
    method flags (line 660) | def flags(self) -> ChannelFlags:
    method is_nsfw (line 667) | def is_nsfw(self) -> bool:
    method is_news (line 674) | def is_news(self) -> bool:
    method resolve (line 681) | def resolve(self) -> Optional[GuildChannel]:
    method fetch (line 695) | async def fetch(self) -> GuildChannel:
    method mention (line 718) | def mention(self) -> str:
    method jump_url (line 723) | def jump_url(self) -> str:
    method created_at (line 731) | def created_at(self) -> datetime:
  class AppCommandThread (line 736) | class AppCommandThread(Hashable):
    method __init__ (line 842) | def __init__(
    method __str__ (line 866) | def __str__(self) -> str:
    method __repr__ (line 869) | def __repr__(self) -> str:
    method guild (line 873) | def guild(self) -> Optional[Guild]:
    method _unroll_metadata (line 877) | def _unroll_metadata(self, data: ThreadMetadata) -> None:
    method applied_tags (line 887) | def applied_tags(self) -> List[ForumTag]:
    method parent (line 905) | def parent(self) -> Optional[Union[ForumChannel, TextChannel]]:
    method flags (line 911) | def flags(self) -> ChannelFlags:
    method owner (line 919) | def owner(self) -> Optional[Member]:
    method mention (line 927) | def mention(self) -> str:
    method jump_url (line 932) | def jump_url(self) -> str:
    method created_at (line 940) | def created_at(self) -> Optional[datetime]:
    method resolve (line 949) | def resolve(self) -> Optional[Thread]:
    method fetch (line 963) | async def fetch(self) -> Thread:
  class Argument (line 986) | class Argument:
    method __init__ (line 1041) | def __init__(
    method __repr__ (line 1048) | def __repr__(self) -> str:
    method _from_data (line 1051) | def _from_data(self, data: ApplicationCommandOption) -> None:
    method to_dict (line 1066) | def to_dict(self) -> ApplicationCommandOption:
  class AppCommandGroup (line 1085) | class AppCommandGroup:
    method __init__ (line 1119) | def __init__(
    method __repr__ (line 1126) | def __repr__(self) -> str:
    method qualified_name (line 1130) | def qualified_name(self) -> str:
    method mention (line 1147) | def mention(self) -> str:
    method _from_data (line 1155) | def _from_data(self, data: ApplicationCommandOption) -> None:
    method to_dict (line 1165) | def to_dict(self) -> 'ApplicationCommandOption':
  class AppCommandPermissions (line 1176) | class AppCommandPermissions:
    method __init__ (line 1199) | def __init__(self, *, data: ApplicationCommandPermissions, guild: Guil...
    method __repr__ (line 1227) | def __repr__(self) -> str:
    method to_dict (line 1230) | def to_dict(self) -> ApplicationCommandPermissions:
  class GuildAppCommandPermissions (line 1238) | class GuildAppCommandPermissions:
    method __init__ (line 1261) | def __init__(self, *, data: GuildApplicationCommandPermissions, state:...
    method __repr__ (line 1273) | def __repr__(self) -> str:
    method to_dict (line 1276) | def to_dict(self) -> Dict[str, Any]:
    method guild (line 1280) | def guild(self) -> Guild:
  function app_command_option_factory (line 1285) | def app_command_option_factory(

FILE: discord/app_commands/namespace.py
  class ResolveKey (line 43) | class ResolveKey(NamedTuple):
    method any_with (line 50) | def any_with(cls, id: str) -> ResolveKey:
    method __eq__ (line 53) | def __eq__(self, o: object) -> bool:
    method __hash__ (line 60) | def __hash__(self) -> int:
  class Namespace (line 66) | class Namespace:
    method __init__ (line 135) | def __init__(
    method _get_resolved_items (line 177) | def _get_resolved_items(cls, interaction: Interaction, resolved: Resol...
    method __repr__ (line 240) | def __repr__(self) -> str:
    method __eq__ (line 244) | def __eq__(self, other: object) -> bool:
    method __getitem__ (line 249) | def __getitem__(self, key: str) -> Any:
    method __contains__ (line 252) | def __contains__(self, key: str) -> Any:
    method __getattr__ (line 255) | def __getattr__(self, attr: str) -> Any:
    method __iter__ (line 258) | def __iter__(self) -> Iterator[Tuple[str, Any]]:
    method _update_with_defaults (line 261) | def _update_with_defaults(self, defaults: Iterable[Tuple[str, Any]]) -...

FILE: discord/app_commands/transformers.py
  class CommandParameter (line 81) | class CommandParameter:
    method get_translated_payload (line 97) | async def get_translated_payload(self, translator: Translator, data: P...
    method to_dict (line 132) | def to_dict(self) -> Dict[str, Any]:
    method _convert_to_locale_strings (line 157) | def _convert_to_locale_strings(self) -> None:
    method is_choice_annotation (line 171) | def is_choice_annotation(self) -> bool:
    method transform (line 174) | async def transform(self, interaction: Interaction, value: Any, /) -> ...
    method display_name (line 193) | def display_name(self) -> str:
  class Transformer (line 198) | class Transformer(Generic[ClientT]):
    method __call__ (line 236) | def __call__(self) -> None:
    method __or__ (line 239) | def __or__(self, rhs: Any) -> Any:
    method type (line 243) | def type(self) -> AppCommandOptionType:
    method channel_types (line 253) | def channel_types(self) -> List[ChannelType]:
    method min_value (line 265) | def min_value(self) -> Optional[Union[int, float]]:
    method max_value (line 278) | def max_value(self) -> Optional[Union[int, float]]:
    method choices (line 291) | def choices(self) -> Optional[List[Choice[Union[int, float, str]]]]:
    method _error_display_name (line 304) | def _error_display_name(self) -> str:
    method transform (line 311) | async def transform(self, interaction: Interaction[ClientT], value: An...
    method autocomplete (line 330) | async def autocomplete(
  class IdentityTransformer (line 359) | class IdentityTransformer(Transformer[ClientT]):
    method __init__ (line 360) | def __init__(self, type: AppCommandOptionType) -> None:
    method type (line 364) | def type(self) -> AppCommandOptionType:
    method transform (line 367) | async def transform(self, interaction: Interaction[ClientT], value: An...
  class RangeTransformer (line 371) | class RangeTransformer(IdentityTransformer):
    method __init__ (line 372) | def __init__(
    method min_value (line 387) | def min_value(self) -> Optional[Union[int, float]]:
    method max_value (line 391) | def max_value(self) -> Optional[Union[int, float]]:
  class LiteralTransformer (line 395) | class LiteralTransformer(IdentityTransformer):
    method __init__ (line 396) | def __init__(self, values: Tuple[Any, ...]) -> None:
    method choices (line 411) | def choices(self):
  class ChoiceTransformer (line 415) | class ChoiceTransformer(IdentityTransformer):
    method __init__ (line 418) | def __init__(self, inner_type: Any) -> None:
  class EnumValueTransformer (line 431) | class EnumValueTransformer(Transformer):
    method __init__ (line 432) | def __init__(self, enum: Any) -> None:
    method _error_display_name (line 454) | def _error_display_name(self) -> str:
    method type (line 458) | def type(self) -> AppCommandOptionType:
    method choices (line 462) | def choices(self):
    method transform (line 465) | async def transform(self, interaction: Interaction, value: Any, /) -> ...
  class EnumNameTransformer (line 469) | class EnumNameTransformer(Transformer):
    method __init__ (line 470) | def __init__(self, enum: Any) -> None:
    method _error_display_name (line 481) | def _error_display_name(self) -> str:
    method type (line 485) | def type(self) -> AppCommandOptionType:
    method choices (line 489) | def choices(self):
    method transform (line 492) | async def transform(self, interaction: Interaction, value: Any, /) -> ...
  class InlineTransformer (line 496) | class InlineTransformer(Transformer[ClientT]):
    method __init__ (line 497) | def __init__(self, annotation: Any) -> None:
    method _error_display_name (line 502) | def _error_display_name(self) -> str:
    method type (line 506) | def type(self) -> AppCommandOptionType:
    method transform (line 509) | async def transform(self, interaction: Interaction[ClientT], value: An...
  class Transform (line 518) | class Transform:
    method __class_getitem__ (line 532) | def __class_getitem__(cls, items) -> Transformer:
  class Range (line 550) | class Range:
    method __class_getitem__ (line 577) | def __class_getitem__(cls, obj) -> RangeTransformer:
  class MemberTransformer (line 618) | class MemberTransformer(Transformer[ClientT]):
    method type (line 620) | def type(self) -> AppCommandOptionType:
    method transform (line 623) | async def transform(self, interaction: Interaction[ClientT], value: An...
  class BaseChannelTransformer (line 629) | class BaseChannelTransformer(Transformer[ClientT]):
    method __init__ (line 630) | def __init__(self, *channel_types: Type[Any]) -> None:
    method _error_display_name (line 650) | def _error_display_name(self) -> str:
    method type (line 654) | def type(self) -> AppCommandOptionType:
    method channel_types (line 658) | def channel_types(self) -> List[ChannelType]:
    method transform (line 661) | async def transform(self, interaction: Interaction[ClientT], value: An...
  class RawChannelTransformer (line 668) | class RawChannelTransformer(BaseChannelTransformer[ClientT]):
    method transform (line 669) | async def transform(self, interaction: Interaction[ClientT], value: An...
  class UnionChannelTransformer (line 675) | class UnionChannelTransformer(BaseChannelTransformer[ClientT]):
    method transform (line 676) | async def transform(self, interaction: Interaction[ClientT], value: An...
  class Timestamp (line 690) | class Timestamp(Transformer[ClientT]):
    method type (line 711) | def type(self) -> AppCommandOptionType:
    method transform (line 714) | async def transform(self, interaction: Interaction[ClientT], value: An...
  function get_supported_annotation (line 777) | def get_supported_annotation(
  function annotation_to_parameter (line 866) | def annotation_to_parameter(annotation: Any, parameter: inspect.Paramete...

FILE: discord/app_commands/translator.py
  class TranslationContextLocation (line 45) | class TranslationContextLocation(Enum):
  class TranslationContext (line 60) | class TranslationContext(Generic[_L, _D]):
    method __init__ (line 77) | def __init__(
    method __init__ (line 82) | def __init__(
    method __init__ (line 87) | def __init__(
    method __init__ (line 94) | def __init__(
    method __init__ (line 101) | def __init__(self, location: Literal[TranslationContextLocation.choice...
    method __init__ (line 104) | def __init__(self, location: Literal[TranslationContextLocation.other]...
    method __init__ (line 106) | def __init__(self, location: _L, data: _D) -> None:  # type: ignore # ...
  class Translator (line 143) | class Translator:
    method load (line 163) | async def load(self) -> None:
    method unload (line 174) | async def unload(self) -> None:
    method _checked_translate (line 186) | async def _checked_translate(
    method translate (line 196) | async def translate(self, string: locale_str, locale: Locale, context:...
  class locale_str (line 224) | class locale_str:
    method __init__ (line 278) | def __init__(self, message: str, /, **kwargs: Any) -> None:
    method message (line 283) | def message(self) -> str:
    method __str__ (line 286) | def __str__(self) -> str:
    method __repr__ (line 289) | def __repr__(self) -> str:
    method __eq__ (line 295) | def __eq__(self, obj: object) -> bool:
    method __hash__ (line 298) | def __hash__(self) -> int:

FILE: discord/app_commands/tree.py
  function _retrieve_guild_ids (line 85) | def _retrieve_guild_ids(
  class CommandTree (line 111) | class CommandTree(Generic[ClientT]):
    method __init__ (line 137) | def __init__(
    method fetch_command (line 164) | async def fetch_command(self, command_id: int, /, *, guild: Optional[S...
    method fetch_commands (line 203) | async def fetch_commands(self, *, guild: Optional[Snowflake] = None) -...
    method copy_global_to (line 243) | def copy_global_to(self, *, guild: Snowflake) -> None:
    method add_command (line 287) | def add_command(
    method remove_command (line 415) | def remove_command(
    method remove_command (line 425) | def remove_command(
    method remove_command (line 435) | def remove_command(
    method remove_command (line 444) | def remove_command(
    method clear_commands (line 490) | def clear_commands(self, *, guild: Optional[Snowflake], type: Optional...
    method get_command (line 532) | def get_command(
    method get_command (line 542) | def get_command(
    method get_command (line 552) | def get_command(
    method get_command (line 561) | def get_command(
    method get_commands (line 605) | def get_commands(
    method get_commands (line 613) | def get_commands(
    method get_commands (line 621) | def get_commands(
    method get_commands (line 629) | def get_commands(
    method get_commands (line 636) | def get_commands(
    method walk_commands (line 681) | def walk_commands(
    method walk_commands (line 689) | def walk_commands(
    method walk_commands (line 697) | def walk_commands(
    method walk_commands (line 704) | def walk_commands(
    method _get_all_commands (line 750) | def _get_all_commands(
    method _remove_with_module (line 769) | def _remove_with_module(self, name: str) -> None:
    method on_error (line 795) | async def on_error(self, interaction: Interaction[ClientT], error: App...
    method error (line 823) | def error(self, coro: ErrorFunc[ClientT]) -> ErrorFunc[ClientT]:
    method command (line 852) | def command(
    method context_menu (line 936) | def context_menu(
    method translator (line 1025) | def translator(self) -> Optional[Translator]:
    method set_translator (line 1032) | async def set_translator(self, translator: Optional[Translator]) -> None:
    method sync (line 1066) | async def sync(self, *, guild: Optional[Snowflake] = None) -> List[App...
    method _dispatch_error (line 1126) | async def _dispatch_error(self, interaction: Interaction[ClientT], err...
    method _from_interaction (line 1135) | def _from_interaction(self, interaction: Interaction[ClientT]) -> None:
    method _get_context_menu (line 1144) | def _get_context_menu(self, data: ApplicationCommandInteractionData) -...
    method _get_app_command_options (line 1153) | def _get_app_command_options(
    method _call_context_menu (line 1206) | async def _call_context_menu(
    method interaction_check (line 1247) | async def interaction_check(self, interaction: Interaction[ClientT], /...
    method _call (line 1258) | async def _call(self, interaction: Interaction[ClientT]) -> None:

FILE: discord/appinfo.py
  class AppInfo (line 57) | class AppInfo:
    method __init__ (line 188) | def __init__(self, state: ConnectionState, data: AppInfoPayload):
    method __repr__ (line 228) | def __repr__(self) -> str:
    method icon (line 236) | def icon(self) -> Optional[Asset]:
    method cover_image (line 243) | def cover_image(self) -> Optional[Asset]:
    method guild (line 253) | def guild(self) -> Optional[Guild]:
    method flags (line 262) | def flags(self) -> ApplicationFlags:
    method guild_integration_config (line 270) | def guild_integration_config(self) -> Optional[IntegrationTypeConfig]:
    method user_integration_config (line 285) | def user_integration_config(self) -> Optional[IntegrationTypeConfig]:
    method edit (line 299) | async def edit(
  class PartialAppInfo (line 500) | class PartialAppInfo:
    method __init__ (line 560) | def __init__(self, *, state: ConnectionState, data: PartialAppInfoPayl...
    method __repr__ (line 577) | def __repr__(self) -> str:
    method icon (line 581) | def icon(self) -> Optional[Asset]:
    method cover_image (line 588) | def cover_image(self) -> Optional[Asset]:
    method flags (line 600) | def flags(self) -> ApplicationFlags:
  class AppInstallParams (line 608) | class AppInstallParams:
    method __init__ (line 624) | def __init__(self, data: InstallParamsPayload) -> None:
  class IntegrationTypeConfig (line 629) | class IntegrationTypeConfig:
    method __init__ (line 640) | def __init__(self, data: AppIntegrationTypeConfigPayload) -> None:

FILE: discord/asset.py
  class AssetMixin (line 60) | class AssetMixin:
    method read (line 65) | async def read(self) -> bytes:
    method save (line 89) | async def save(self, fp: Union[str, bytes, os.PathLike[Any], io.Buffer...
    method to_file (line 129) | async def to_file(
  class Asset (line 177) | class Asset(AssetMixin):
    method __init__ (line 212) | def __init__(self, state: _State, *, url: str, key: str, animated: boo...
    method _from_default_avatar (line 219) | def _from_default_avatar(cls, state: _State, index: int) -> Self:
    method _from_avatar (line 228) | def _from_avatar(cls, state: _State, user_id: int, avatar: str) -> Self:
    method _from_guild_avatar (line 239) | def _from_guild_avatar(cls, state: _State, guild_id: int, member_id: i...
    method _from_guild_banner (line 250) | def _from_guild_banner(cls, state: _State, guild_id: int, member_id: i...
    method _from_avatar_decoration (line 261) | def _from_avatar_decoration(cls, state: _State, avatar_decoration: str...
    method _from_icon (line 270) | def _from_icon(cls, state: _State, object_id: int, icon_hash: str, pat...
    method _from_app_icon (line 279) | def _from_app_icon(
    method _from_cover_image (line 290) | def _from_cover_image(cls, state: _State, object_id: int, cover_image_...
    method _from_scheduled_event_cover_image (line 299) | def _from_scheduled_event_cover_image(cls, state: _State, scheduled_ev...
    method _from_guild_image (line 308) | def _from_guild_image(cls, state: _State, guild_id: int, image: str, p...
    method _from_guild_icon (line 319) | def _from_guild_icon(cls, state: _State, guild_id: int, icon_hash: str...
    method _from_sticker_banner (line 330) | def _from_sticker_banner(cls, state: _State, banner: int) -> Self:
    method _from_user_banner (line 339) | def _from_user_banner(cls, state: _State, user_id: int, banner_hash: s...
    method _from_primary_guild (line 350) | def _from_primary_guild(cls, state: _State, guild_id: int, icon_hash: ...
    method _from_user_collectible (line 359) | def _from_user_collectible(cls, state: _State, asset: str, animated: b...
    method __str__ (line 368) | def __str__(self) -> str:
    method __len__ (line 371) | def __len__(self) -> int:
    method __repr__ (line 374) | def __repr__(self) -> str:
    method __eq__ (line 378) | def __eq__(self, other: object) -> bool:
    method __hash__ (line 381) | def __hash__(self) -> int:
    method url (line 385) | def url(self) -> str:
    method key (line 390) | def key(self) -> str:
    method is_animated (line 394) | def is_animated(self) -> bool:
    method replace (line 398) | def replace(
    method with_size (line 464) | def with_size(self, size: int, /) -> Self:
    method with_format (line 492) | def with_format(self, format: ValidAssetFormatTypes, /) -> Self:
    method with_static_format (line 527) | def with_static_format(self, format: ValidStaticFormatTypes, /) -> Self:

FILE: discord/audit_logs.py
  function _transform_timestamp (line 103) | def _transform_timestamp(entry: AuditLogEntry, data: Optional[str]) -> O...
  function _transform_color (line 107) | def _transform_color(entry: AuditLogEntry, data: int) -> Colour:
  function _transform_snowflake (line 111) | def _transform_snowflake(entry: AuditLogEntry, data: Snowflake) -> int:
  function _transform_channel (line 115) | def _transform_channel(entry: AuditLogEntry, data: Optional[Snowflake]) ...
  function _transform_channels_or_threads (line 121) | def _transform_channels_or_threads(
  function _transform_member_id (line 127) | def _transform_member_id(entry: AuditLogEntry, data: Optional[Snowflake]...
  function _transform_guild_id (line 133) | def _transform_guild_id(entry: AuditLogEntry, data: Optional[Snowflake])...
  function _transform_roles (line 139) | def _transform_roles(entry: AuditLogEntry, data: List[Snowflake]) -> Lis...
  function _transform_applied_forum_tags (line 143) | def _transform_applied_forum_tags(entry: AuditLogEntry, data: List[Snowf...
  function _transform_overloaded_flags (line 150) | def _transform_overloaded_flags(entry: AuditLogEntry, data: int) -> Unio...
  function _transform_forum_tags (line 175) | def _transform_forum_tags(entry: AuditLogEntry, data: List[ForumTagPaylo...
  function _transform_default_reaction (line 179) | def _transform_default_reaction(entry: AuditLogEntry, data: DefaultReact...
  function _transform_overwrites (line 188) | def _transform_overwrites(
  function _transform_icon (line 213) | def _transform_icon(entry: AuditLogEntry, data: Optional[str]) -> Option...
  function _transform_avatar (line 222) | def _transform_avatar(entry: AuditLogEntry, data: Optional[str]) -> Opti...
  function _transform_cover_image (line 228) | def _transform_cover_image(entry: AuditLogEntry, data: Optional[str]) ->...
  function _guild_hash_transformer (line 234) | def _guild_hash_transformer(path: str) -> Callable[[AuditLogEntry, Optio...
  function _transform_automod_actions (line 243) | def _transform_automod_actions(entry: AuditLogEntry, data: List[AutoMode...
  function _transform_default_emoji (line 247) | def _transform_default_emoji(entry: AuditLogEntry, data: str) -> Partial...
  function _transform_onboarding_prompts (line 251) | def _transform_onboarding_prompts(entry: AuditLogEntry, data: List[Promp...
  function _transform_onboarding_prompt_options (line 255) | def _transform_onboarding_prompt_options(
  function _enum_transformer (line 264) | def _enum_transformer(enum: Type[E]) -> Callable[[AuditLogEntry, int], E]:
  function _flag_transformer (line 274) | def _flag_transformer(cls: Type[F]) -> Callable[[AuditLogEntry, Union[in...
  function _transform_type (line 281) | def _transform_type(
  class AuditLogDiff (line 296) | class AuditLogDiff:
    method __len__ (line 297) | def __len__(self) -> int:
    method __iter__ (line 300) | def __iter__(self) -> Generator[Tuple[str, Any], None, None]:
    method __repr__ (line 303) | def __repr__(self) -> str:
    method __getattr__ (line 309) | def __getattr__(self, item: str) -> Any: ...
    method __setattr__ (line 311) | def __setattr__(self, key: str, value: Any) -> Any: ...
  class AuditLogChanges (line 317) | class AuditLogChanges:
    method __init__ (line 376) | def __init__(self, entry: AuditLogEntry, data: List[AuditLogChangePayl...
    method __repr__ (line 470) | def __repr__(self) -> str:
    method _handle_role (line 473) | def _handle_role(self, first: AuditLogDiff, second: AuditLogDiff, entr...
    method _handle_app_command_permissions (line 492) | def _handle_app_command_permissions(
    method _handle_trigger_metadata (line 508) | def _handle_trigger_metadata(
    method _handle_trigger_attr_update (line 553) | def _handle_trigger_attr_update(
    method _handle_colours (line 564) | def _handle_colours(self, diff: AuditLogDiff, colours: Optional[RoleCo...
    method _create_trigger (line 579) | def _create_trigger(self, diff: AuditLogDiff, entry: AuditLogEntry) ->...
  class _AuditLogProxy (line 594) | class _AuditLogProxy:
    method __init__ (line 595) | def __init__(self, **kwargs: Any) -> None:
  class _AuditLogProxyMemberPrune (line 600) | class _AuditLogProxyMemberPrune(_AuditLogProxy):
  class _AuditLogProxyMemberMoveOrMessageDelete (line 605) | class _AuditLogProxyMemberMoveOrMessageDelete(_AuditLogProxy):
  class _AuditLogProxyMemberDisconnect (line 610) | class _AuditLogProxyMemberDisconnect(_AuditLogProxy):
  class _AuditLogProxyPinAction (line 614) | class _AuditLogProxyPinAction(_AuditLogProxy):
  class _AuditLogProxyStageInstanceAction (line 619) | class _AuditLogProxyStageInstanceAction(_AuditLogProxy):
  class _AuditLogProxyMessageBulkDelete (line 623) | class _AuditLogProxyMessageBulkDelete(_AuditLogProxy):
  class _AuditLogProxyAutoModAction (line 627) | class _AuditLogProxyAutoModAction(_AuditLogProxy):
  class _AuditLogProxyMemberKickOrMemberRoleUpdate (line 633) | class _AuditLogProxyMemberKickOrMemberRoleUpdate(_AuditLogProxy):
  class AuditLogEntry (line 637) | class AuditLogEntry(Hashable):
    method __init__ (line 686) | def __init__(
    method _from_data (line 706) | def _from_data(self, data: AuditLogEntryPayload) -> None:
    method _get_member (line 812) | def _get_member(self, user_id: Optional[int]) -> Union[Member, User, N...
    method _get_integration (line 818) | def _get_integration(self, integration_id: Optional[int]) -> Optional[...
    method _get_integration_by_app_id (line 824) | def _get_integration_by_app_id(self, application_id: Optional[int]) ->...
    method _get_app_command (line 831) | def _get_app_command(self, app_command_id: Optional[int]) -> Optional[...
    method __repr__ (line 837) | def __repr__(self) -> str:
    method created_at (line 841) | def created_at(self) -> datetime.datetime:
    method target (line 846) | def target(self) -> TargetType:
    method category (line 860) | def category(self) -> Optional[enums.AuditLogActionCategory]:
    method changes (line 865) | def changes(self) -> AuditLogChanges:
    method before (line 872) | def before(self) -> AuditLogDiff:
    method after (line 877) | def after(self) -> AuditLogDiff:
    method _convert_target_guild (line 881) | def _convert_target_guild(self, target_id: int) -> Guild:
    method _convert_target_channel (line 884) | def _convert_target_channel(self, target_id: int) -> Union[abc.GuildCh...
    method _convert_target_user (line 887) | def _convert_target_user(self, target_id: Optional[int]) -> Optional[U...
    method _convert_target_role (line 895) | def _convert_target_role(self, target_id: int) -> Union[Role, Object]:
    method _convert_target_invite (line 898) | def _convert_target_invite(self, target_id: None) -> Invite:
    method _convert_target_emoji (line 919) | def _convert_target_emoji(self, target_id: int) -> Union[Emoji, Object]:
    method _convert_target_message (line 922) | def _convert_target_message(self, target_id: Optional[int]) -> Optiona...
    method _convert_target_stage_instance (line 931) | def _convert_target_stage_instance(self, target_id: int) -> Union[Stag...
    method _convert_target_sticker (line 934) | def _convert_target_sticker(self, target_id: int) -> Union[GuildSticke...
    method _convert_target_thread (line 937) | def _convert_target_thread(self, target_id: int) -> Union[Thread, Obje...
    method _convert_target_guild_scheduled_event (line 940) | def _convert_target_guild_scheduled_event(self, target_id: int) -> Uni...
    method _convert_target_integration (line 943) | def _convert_target_integration(self, target_id: int) -> Union[Partial...
    method _convert_target_app_command (line 946) | def _convert_target_app_command(self, target_id: int) -> Union[AppComm...
    method _convert_target_integration_or_app_command (line 956) | def _convert_target_integration_or_app_command(self, target_id: int) -...
    method _convert_target_auto_moderation (line 976) | def _convert_target_auto_moderation(self, target_id: int) -> Union[Aut...
    method _convert_target_webhook (line 979) | def _convert_target_webhook(self, target_id: int) -> Union[Webhook, Ob...
    method _convert_target_onboarding_prompt (line 985) | def _convert_target_onboarding_prompt(self, target_id: int) -> Object:

FILE: discord/automod.py
  class AutoModRuleAction (line 58) | class AutoModRuleAction:
    method __init__ (line 88) | def __init__(self, *, channel_id: int = ...) -> None: ...
    method __init__ (line 91) | def __init__(self, *, type: Literal[AutoModRuleActionType.send_alert_m...
    method __init__ (line 94) | def __init__(self, *, duration: datetime.timedelta = ...) -> None: ...
    method __init__ (line 97) | def __init__(self, *, type: Literal[AutoModRuleActionType.timeout], du...
    method __init__ (line 100) | def __init__(self, *, custom_message: str = ...) -> None: ...
    method __init__ (line 103) | def __init__(self, *, type: Literal[AutoModRuleActionType.block_messag...
    method __init__ (line 106) | def __init__(
    method __init__ (line 111) | def __init__(
    method __init__ (line 120) | def __init__(
    method __repr__ (line 158) | def __repr__(self) -> str:
    method from_data (line 162) | def from_data(cls, data: AutoModerationActionPayload) -> Self:
    method to_dict (line 175) | def to_dict(self) -> Dict[str, Any]:
  class AutoModTrigger (line 186) | class AutoModTrigger:
    method __init__ (line 251) | def __init__(
    method __repr__ (line 288) | def __repr__(self) -> str:
    method from_data (line 297) | def from_data(cls, type: int, data: Optional[AutoModerationTriggerMeta...
    method to_metadata_dict (line 321) | def to_metadata_dict(self) -> Optional[Dict[str, Any]]:
  class AutoModRule (line 337) | class AutoModRule:
    method __init__ (line 381) | def __init__(self, *, data: AutoModerationRulePayload, guild: Guild, s...
    method __repr__ (line 394) | def __repr__(self) -> str:
    method to_dict (line 397) | def to_dict(self) -> AutoModerationRulePayload:
    method creator (line 415) | def creator(self) -> Optional[Member]:
    method exempt_roles (line 420) | def exempt_roles(self) -> List[Role]:
    method exempt_channels (line 432) | def exempt_channels(self) -> List[Union[GuildChannel, Thread]]:
    method actions (line 438) | def actions(self) -> List[AutoModRuleAction]:
    method is_exempt (line 442) | def is_exempt(self, obj: Snowflake, /) -> bool:
    method edit (line 457) | async def edit(
    method delete (line 540) | async def delete(self, *, reason: str = MISSING) -> None:
  class AutoModAction (line 562) | class AutoModAction:
    method __init__ (line 611) | def __init__(self, *, data: AutoModerationActionExecutionPayload, stat...
    method __repr__ (line 625) | def __repr__(self) -> str:
    method guild (line 629) | def guild(self) -> Guild:
    method channel (line 634) | def channel(self) -> Optional[Union[GuildChannel, Thread]]:
    method member (line 641) | def member(self) -> Optional[Member]:
    method fetch_rule (line 645) | async def fetch_rule(self) -> AutoModRule:

FILE: discord/backoff.py
  class ExponentialBackoff (line 41) | class ExponentialBackoff(Generic[T]):
    method __init__ (line 63) | def __init__(self, base: int = 1, *, integral: T = False):
    method delay (line 78) | def delay(self: ExponentialBackoff[Literal[False]]) -> float: ...
    method delay (line 81) | def delay(self: ExponentialBackoff[Literal[True]]) -> int: ...
    method delay (line 84) | def delay(self: ExponentialBackoff[bool]) -> Union[int, float]: ...
    method delay (line 86) | def delay(self) -> Union[int, float]:

FILE: discord/channel.py
  class _BaseCreateChannelOptions (line 124) | class _BaseCreateChannelOptions(TypedDict, total=False):
  class _CreateTextChannelOptions (line 128) | class _CreateTextChannelOptions(_BaseCreateChannelOptions, total=False):
  class _CreateVoiceChannelOptions (line 136) | class _CreateVoiceChannelOptions(_BaseCreateChannelOptions, total=False):
  class _CreateStageChannelOptions (line 143) | class _CreateStageChannelOptions(_CreateVoiceChannelOptions, total=False):
  class _CreateForumChannelOptions (line 150) | class _CreateForumChannelOptions(_CreateTextChannelOptions, total=False):
  class ThreadWithMessage (line 163) | class ThreadWithMessage(NamedTuple):
  class VoiceChannelEffectAnimation (line 168) | class VoiceChannelEffectAnimation(NamedTuple):
  class VoiceChannelSoundEffect (line 173) | class VoiceChannelSoundEffect(BaseSoundboardSound):
    method __init__ (line 202) | def __init__(self, *, state: ConnectionState, id: int, volume: float):
    method __repr__ (line 209) | def __repr__(self) -> str:
    method created_at (line 213) | def created_at(self) -> Optional[datetime.datetime]:
    method is_default (line 221) | def is_default(self) -> bool:
  class VoiceChannelEffect (line 227) | class VoiceChannelEffect:
    method __init__ (line 248) | def __init__(self, *, state: ConnectionState, data: VoiceChannelEffect...
    method __repr__ (line 267) | def __repr__(self) -> str:
    method is_sound (line 278) | def is_sound(self) -> bool:
  class TextChannel (line 283) | class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Has...
    method __init__ (line 355) | def __init__(self, *, state: ConnectionState, guild: Guild, data: Unio...
    method __repr__ (line 361) | def __repr__(self) -> str:
    method _update (line 373) | def _update(self, guild: Guild, data: Union[TextChannelPayload, NewsCh...
    method _get_channel (line 388) | async def _get_channel(self) -> Self:
    method type (line 392) | def type(self) -> Literal[ChannelType.text, ChannelType.news]:
    method _sorting_bucket (line 399) | def _sorting_bucket(self) -> int:
    method _scheduled_event_entity_type (line 403) | def _scheduled_event_entity_type(self) -> Optional[EntityType]:
    method permissions_for (line 407) | def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
    method members (line 417) | def members(self) -> List[Member]:
    method threads (line 422) | def threads(self) -> List[Thread]:
    method is_nsfw (line 429) | def is_nsfw(self) -> bool:
    method is_news (line 433) | def is_news(self) -> bool:
    method last_message (line 438) | def last_message(self) -> Optional[Message]:
    method edit (line 459) | async def edit(self) -> Optional[TextChannel]: ...
    method edit (line 462) | async def edit(self, *, position: int, reason: Optional[str] = ...) ->...
    method edit (line 465) | async def edit(
    method edit (line 482) | async def edit(self, *, reason: Optional[str] = None, **options: Any) ...
    method clone (line 563) | async def clone(
    method delete_messages (line 585) | async def delete_messages(self, messages: Iterable[Snowflake], *, reas...
    method purge (line 641) | async def purge(
    method webhooks (line 726) | async def webhooks(self) -> List[Webhook]:
    method create_webhook (line 749) | async def create_webhook(self, *, name: str, avatar: Optional[bytes] =...
    method follow (line 790) | async def follow(self, *, destination: TextChannel, reason: Optional[s...
    method get_partial_message (line 845) | def get_partial_message(self, message_id: int, /) -> PartialMessage:
    method get_thread (line 872) | def get_thread(self, thread_id: int, /) -> Optional[Thread]:
    method create_thread (line 894) | async def create_thread(
    method archived_threads (line 979) | async def archived_threads(
  class VocalGuildChannel (line 1074) | class VocalGuildChannel(discord.abc.Messageable, discord.abc.Connectable...
    method __init__ (line 1092) | def __init__(self, *, state: ConnectionState, guild: Guild, data: Unio...
    method _get_channel (line 1097) | async def _get_channel(self) -> Self:
    method _get_voice_client_key (line 1100) | def _get_voice_client_key(self) -> Tuple[int, str]:
    method _get_voice_state_pair (line 1103) | def _get_voice_state_pair(self) -> Tuple[int, int]:
    method _update (line 1106) | def _update(self, guild: Guild, data: Union[VoiceChannelPayload, Stage...
    method _sorting_bucket (line 1121) | def _sorting_bucket(self) -> int:
    method is_nsfw (line 1124) | def is_nsfw(self) -> bool:
    method members (line 1132) | def members(self) -> List[Member]:
    method voice_states (line 1143) | def voice_states(self) -> Dict[int, VoiceState]:
    method scheduled_events (line 1167) | def scheduled_events(self) -> List[ScheduledEvent]:
    method permissions_for (line 1175) | def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
    method last_message (line 1188) | def last_message(self) -> Optional[Message]:
    method get_partial_message (line 1210) | def get_partial_message(self, message_id: int, /) -> PartialMessage:
    method delete_messages (line 1233) | async def delete_messages(self, messages: Iterable[Snowflake], *, reas...
    method purge (line 1285) | async def purge(
    method webhooks (line 1369) | async def webhooks(self) -> List[Webhook]:
    method create_webhook (line 1394) | async def create_webhook(self, *, name: str, avatar: Optional[bytes] =...
    method clone (line 1435) | async def clone(
  class VoiceChannel (line 1456) | class VoiceChannel(VocalGuildChannel):
    method __repr__ (line 1525) | def __repr__(self) -> str:
    method _scheduled_event_entity_type (line 1540) | def _scheduled_event_entity_type(self) -> Optional[EntityType]:
    method type (line 1544) | def type(self) -> Literal[ChannelType.voice]:
    method edit (line 1549) | async def edit(self) -> None: ...
    method edit (line 1552) | async def edit(self, *, position: int, reason: Optional[str] = ...) ->...
    method edit (line 1555) | async def edit(
    method edit (line 1573) | async def edit(self, *, reason: Optional[str] = None, **options: Any) ...
    method send_sound (line 1654) | async def send_sound(self, sound: Union[SoundboardSound, SoundboardDef...
  class StageChannel (line 1684) | class StageChannel(VocalGuildChannel):
    method __repr__ (line 1752) | def __repr__(self) -> str:
    method _update (line 1767) | def _update(self, guild: Guild, data: StageChannelPayload) -> None:
    method _scheduled_event_entity_type (line 1772) | def _scheduled_event_entity_type(self) -> Optional[EntityType]:
    method requesting_to_speak (line 1776) | def requesting_to_speak(self) -> List[Member]:
    method speakers (line 1781) | def speakers(self) -> List[Member]:
    method listeners (line 1793) | def listeners(self) -> List[Member]:
    method moderators (line 1801) | def moderators(self) -> List[Member]:
    method type (line 1810) | def type(self) -> Literal[ChannelType.stage_voice]:
    method instance (line 1815) | def instance(self) -> Optional[StageInstance]:
    method create_instance (line 1822) | async def create_instance(
    method fetch_instance (line 1888) | async def fetch_instance(self) -> StageInstance:
    method edit (line 1911) | async def edit(self) -> None: ...
    method edit (line 1914) | async def edit(self, *, position: int, reason: Optional[str] = ...) ->...
    method edit (line 1917) | async def edit(
    method edit (line 1934) | async def edit(self, *, reason: Optional[str] = None, **options: Any) ...
  class CategoryChannel (line 2010) | class CategoryChannel(discord.abc.GuildChannel, Hashable):
    method __init__ (line 2054) | def __init__(self, *, state: ConnectionState, guild: Guild, data: Cate...
    method __repr__ (line 2059) | def __repr__(self) -> str:
    method _update (line 2062) | def _update(self, guild: Guild, data: CategoryChannelPayload) -> None:
    method _sorting_bucket (line 2071) | def _sorting_bucket(self) -> int:
    method _scheduled_event_entity_type (line 2075) | def _scheduled_event_entity_type(self) -> Optional[EntityType]:
    method type (line 2079) | def type(self) -> Literal[ChannelType.category]:
    method is_nsfw (line 2083) | def is_nsfw(self) -> bool:
    method clone (line 2088) | async def clone(
    method edit (line 2098) | async def edit(self) -> None: ...
    method edit (line 2101) | async def edit(self, *, position: int, reason: Optional[str] = ...) ->...
    method edit (line 2104) | async def edit(
    method edit (line 2114) | async def edit(self, *, reason: Optional[str] = None, **options: Any) ...
    method move (line 2169) | async def move(self, **kwargs: Any) -> None:
    method channels (line 2174) | def channels(self) -> List[GuildChannelType]:
    method text_channels (line 2188) | def text_channels(self) -> List[TextChannel]:
    method voice_channels (line 2195) | def voice_channels(self) -> List[VoiceChannel]:
    method stage_channels (line 2202) | def stage_channels(self) -> List[StageChannel]:
    method forums (line 2212) | def forums(self) -> List[ForumChannel]:
    method create_text_channel (line 2221) | async def create_text_channel(self, name: str, **options: Unpack[_Crea...
    method create_voice_channel (line 2233) | async def create_voice_channel(self, name: str, **options: Unpack[_Cre...
    method create_stage_channel (line 2245) | async def create_stage_channel(self, name: str, **options: Unpack[_Cre...
    method create_forum (line 2259) | async def create_forum(self, name: str, **options: Unpack[_CreateForum...
  class ForumTag (line 2274) | class ForumTag(Hashable):
    method __init__ (line 2314) | def __init__(self, *, name: str, emoji: Optional[EmojiInputType] = Non...
    method from_data (line 2327) | def from_data(cls, *, state: ConnectionState, data: ForumTagPayload) -...
    method to_dict (line 2341) | def to_dict(self) -> Dict[str, Any]:
    method __repr__ (line 2356) | def __repr__(self) -> str:
    method __str__ (line 2359) | def __str__(self) -> str:
  class ForumChannel (line 2363) | class ForumChannel(discord.abc.GuildChannel, Hashable):
    method __init__ (line 2457) | def __init__(self, *, state: ConnectionState, guild: Guild, data: Unio...
    method __repr__ (line 2463) | def __repr__(self) -> str:
    method _update (line 2474) | def _update(self, guild: Guild, data: Union[ForumChannelPayload, Media...
    method type (line 2508) | def type(self) -> Literal[ChannelType.forum, ChannelType.media]:
    method _sorting_bucket (line 2515) | def _sorting_bucket(self) -> int:
    method members (line 2519) | def members(self) -> List[Member]:
    method _scheduled_event_entity_type (line 2527) | def _scheduled_event_entity_type(self) -> Optional[EntityType]:
    method permissions_for (line 2531) | def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
    method get_thread (line 2540) | def get_thread(self, thread_id: int, /) -> Optional[Thread]:
    method threads (line 2566) | def threads(self) -> List[Thread]:
    method flags (line 2571) | def flags(self) -> ChannelFlags:
    method available_tags (line 2579) | def available_tags(self) -> Sequence[ForumTag]:
    method get_tag (line 2586) | def get_tag(self, tag_id: int, /) -> Optional[ForumTag]:
    method is_nsfw (line 2603) | def is_nsfw(self) -> bool:
    method is_media (line 2607) | def is_media(self) -> bool:
    method clone (line 2615) | async def clone(
    method edit (line 2645) | async def edit(self) -> None: ...
    method edit (line 2648) | async def edit(self, *, position: int, reason: Optional[str] = ...) ->...
    method edit (line 2651) | async def edit(
    method edit (line 2673) | async def edit(self, *, reason: Optional[str] = None, **options: Any) ...
    method create_tag (line 2813) | async def create_tag(
    method create_thread (line 2865) | async def create_thread(
    method create_thread (line 2883) | async def create_thread(
    method create_thread (line 2905) | async def create_thread(
    method webhooks (line 3060) | async def webhooks(self) -> List[Webhook]:
    method create_webhook (line 3083) | async def create_webhook(self, *, name: str, avatar: Optional[bytes] =...
    method archived_threads (line 3121) | async def archived_threads(
  class DMChannel (line 3189) | class DMChannel(discord.abc.Messageable, discord.abc.PrivateChannel, Has...
    method __init__ (line 3228) | def __init__(self, *, me: ClientUser, state: ConnectionState, data: DM...
    method _get_channel (line 3234) | async def _get_channel(self) -> Self:
    method __str__ (line 3237) | def __str__(self) -> str:
    method __repr__ (line 3242) | def __repr__(self) -> str:
    method _from_message (line 3246) | def _from_message(cls, state: ConnectionState, channel_id: int) -> Self:
    method recipient (line 3256) | def recipient(self) -> Optional[User]:
    method type (line 3262) | def type(self) -> Literal[ChannelType.private]:
    method guild (line 3267) | def guild(self) -> Optional[Guild]:
    method jump_url (line 3277) | def jump_url(self) -> str:
    method created_at (line 3285) | def created_at(self) -> datetime.datetime:
    method permissions_for (line 3289) | def permissions_for(self, obj: Any = None, /) -> Permissions:
    method get_partial_message (line 3326) | def get_partial_message(self, message_id: int, /) -> PartialMessage:
  class GroupChannel (line 3354) | class GroupChannel(discord.abc.Messageable, discord.abc.PrivateChannel, ...
    method __init__ (line 3395) | def __init__(self, *, me: ClientUser, state: ConnectionState, data: Gr...
    method _update_group (line 3401) | def _update_group(self, data: GroupChannelPayload) -> None:
    method _get_channel (line 3413) | async def _get_channel(self) -> Self:
    method __str__ (line 3416) | def __str__(self) -> str:
    method __repr__ (line 3425) | def __repr__(self) -> str:
    method type (line 3429) | def type(self) -> Literal[ChannelType.group]:
    method guild (line 3434) | def guild(self) -> Optional[Guild]:
    method icon (line 3444) | def icon(self) -> Optional[Asset]:
    method created_at (line 3451) | def created_at(self) -> datetime.datetime:
    method jump_url (line 3456) | def jump_url(self) -> str:
    method permissions_for (line 3463) | def permissions_for(self, obj: Snowflake, /) -> Permissions:
    method leave (line 3508) | async def leave(self) -> None:
  class PartialMessageable (line 3524) | class PartialMessageable(discord.abc.Messageable, Hashable):
    method __init__ (line 3558) | def __init__(self, state: ConnectionState, id: int, guild_id: Optional...
    method __repr__ (line 3564) | def __repr__(self) -> str:
    method _get_channel (line 3567) | async def _get_channel(self) -> PartialMessageable:
    method guild (line 3571) | def guild(self) -> Optional[Guild]:
    method jump_url (line 3576) | def jump_url(self) -> str:
    method created_at (line 3583) | def created_at(self) -> datetime.datetime:
    method permissions_for (line 3587) | def permissions_for(self, obj: Any = None, /) -> Permissions:
    method mention (line 3610) | def mention(self) -> str:
    method get_partial_message (line 3617) | def get_partial_message(self, message_id: int, /) -> PartialMessage:
  function _guild_channel_factory (line 3639) | def _guild_channel_factory(channel_type: int):
  function _channel_factory (line 3659) | def _channel_factory(channel_type: int):
  function _threaded_channel_factory (line 3669) | def _threaded_channel_factory(channel_type: int):
  function _threaded_guild_channel_factory (line 3676) | def _threaded_guild_channel_factory(channel_type: int):

FILE: discord/client.py
  class _ClientOptions (line 126) | class _ClientOptions(TypedDict, total=False):
  class _LoopSentinel (line 161) | class _LoopSentinel:
    method __getattr__ (line 164) | def __getattr__(self, attr: str) -> None:
  class Client (line 176) | class Client:
    method __init__ (line 298) | def __init__(self, *, intents: Intents, **options: Unpack[_ClientOptio...
    method __aenter__ (line 347) | async def __aenter__(self) -> Self:
    method __aexit__ (line 351) | async def __aexit__(
    method _get_websocket (line 365) | def _get_websocket(self, guild_id: Optional[int] = None, *, shard_id: ...
    method _get_state (line 368) | def _get_state(self, **options: Any) -> ConnectionState[Self]:
    method _handle_ready (line 371) | def _handle_ready(self) -> None:
    method latency (line 375) | def latency(self) -> float:
    method is_ws_ratelimited (line 383) | def is_ws_ratelimited(self) -> bool:
    method user (line 396) | def user(self) -> Optional[ClientUser]:
    method guilds (line 401) | def guilds(self) -> Sequence[Guild]:
    method emojis (line 406) | def emojis(self) -> Sequence[Emoji]:
    method stickers (line 417) | def stickers(self) -> Sequence[GuildSticker]:
    method soundboard_sounds (line 425) | def soundboard_sounds(self) -> List[SoundboardSound]:
    method cached_messages (line 433) | def cached_messages(self) -> Sequence[Message]:
    method private_channels (line 441) | def private_channels(self) -> Sequence[PrivateChannel]:
    method voice_clients (line 452) | def voice_clients(self) -> List[VoiceProtocol]:
    method application_id (line 460) | def application_id(self) -> Optional[int]:
    method application_flags (line 473) | def application_flags(self) -> ApplicationFlags:
    method application (line 481) | def application(self) -> Optional[AppInfo]:
    method is_ready (line 496) | def is_ready(self) -> bool:
    method _run_event (line 500) | async def _run_event(
    method _schedule_event (line 517) | def _schedule_event(
    method dispatch (line 528) | def dispatch(self, event: str, /, *args: Any, **kwargs: Any) -> None:
    method on_error (line 568) | async def on_error(self, event_method: str, /, *args: Any, **kwargs: A...
    method _call_before_identify_hook (line 586) | async def _call_before_identify_hook(self, shard_id: Optional[int], *,...
    method before_identify_hook (line 592) | async def before_identify_hook(self, shard_id: Optional[int], *, initi...
    method _async_setup_hook (line 614) | async def _async_setup_hook(self) -> None:
    method setup_hook (line 623) | async def setup_hook(self) -> None:
    method login (line 647) | async def login(self, token: str) -> None:
    method connect (line 695) | async def connect(self, *, reconnect: bool = True) -> None:
    method close (line 793) | async def close(self) -> None:
    method clear (line 817) | def clear(self) -> None:
    method start (line 829) | async def start(self, token: str, *, reconnect: bool = True) -> None:
    method run (line 853) | def run(
    method is_closed (line 942) | def is_closed(self) -> bool:
    method activity (line 947) | def activity(self) -> Optional[ActivityTypes]:
    method activity (line 954) | def activity(self, value: Optional[ActivityTypes]) -> None:
    method status (line 964) | def status(self) -> Status:
    method status (line 975) | def status(self, value: Status) -> None:
    method allowed_mentions (line 984) | def allowed_mentions(self) -> Optional[AllowedMentions]:
    method allowed_mentions (line 992) | def allowed_mentions(self, value: Optional[AllowedMentions]) -> None:
    method intents (line 999) | def intents(self) -> Intents:
    method users (line 1009) | def users(self) -> List[User]:
    method get_channel (line 1013) | def get_channel(self, id: int, /) -> Optional[Union[GuildChannel, Thre...
    method get_partial_messageable (line 1032) | def get_partial_messageable(
    method get_stage_instance (line 1062) | def get_stage_instance(self, id: int, /) -> Optional[StageInstance]:
    method get_guild (line 1084) | def get_guild(self, id: int, /) -> Optional[Guild]:
    method get_user (line 1103) | def get_user(self, id: int, /) -> Optional[User]:
    method get_emoji (line 1122) | def get_emoji(self, id: int, /) -> Optional[Emoji]:
    method get_sticker (line 1141) | def get_sticker(self, id: int, /) -> Optional[GuildSticker]:
    method get_soundboard_sound (line 1158) | def get_soundboard_sound(self, id: int, /) -> Optional[SoundboardSound]:
    method get_all_channels (line 1175) | def get_all_channels(self) -> Generator[GuildChannel, None, None]:
    method get_all_members (line 1199) | def get_all_members(self) -> Generator[Member, None, None]:
    method wait_until_ready (line 1218) | async def wait_until_ready(self) -> None:
    method wait_for (line 1238) | async def wait_for(
    method wait_for (line 1248) | async def wait_for(
    method wait_for (line 1260) | async def wait_for(
    method wait_for (line 1270) | async def wait_for(
    method wait_for (line 1282) | async def wait_for(
    method wait_for (line 1292) | async def wait_for(
    method wait_for (line 1302) | async def wait_for(
    method wait_for (line 1312) | async def wait_for(
    method wait_for (line 1322) | async def wait_for(
    method wait_for (line 1337) | async def wait_for(
    method wait_for (line 1347) | async def wait_for(
    method wait_for (line 1359) | async def wait_for(
    method wait_for (line 1369) | async def wait_for(
    method wait_for (line 1379) | async def wait_for(
    method wait_for (line 1389) | async def wait_for(
    method wait_for (line 1400) | async def wait_for(
    method wait_for (line 1412) | async def wait_for(
    method wait_for (line 1427) | async def wait_for(
    method wait_for (line 1437) | async def wait_for(
    method wait_for (line 1447) | async def wait_for(
    method wait_for (line 1457) | async def wait_for(
    method wait_for (line 1467) | async def wait_for(
    method wait_for (line 1479) | async def wait_for(
    method wait_for (line 1489) | async def wait_for(
    method wait_for (line 1499) | async def wait_for(
    method wait_for (line 1509) | async def wait_for(
    method wait_for (line 1521) | async def wait_for(
    method wait_for (line 1533) | async def wait_for(
    method wait_for (line 1543) | async def wait_for(
    method wait_for (line 1553) | async def wait_for(
    method wait_for (line 1563) | async def wait_for(
    method wait_for (line 1573) | async def wait_for(
    method wait_for (line 1583) | async def wait_for(
    method wait_for (line 1595) | async def wait_for(
    method wait_for (line 1605) | async def wait_for(
    method wait_for (line 1615) | async def wait_for(
    method wait_for (line 1625) | async def wait_for(
    method wait_for (line 1635) | async def wait_for(
    method wait_for (line 1645) | async def wait_for(
    method wait_for (line 1657) | async def wait_for(
    method wait_for (line 1667) | async def wait_for(
    method wait_for (line 1677) | async def wait_for(
    method wait_for (line 1687) | async def wait_for(
    method wait_for (line 1697) | async def wait_for(
    method wait_for (line 1707) | async def wait_for(
    method wait_for (line 1719) | async def wait_for(
    method wait_for (line 1729) | async def wait_for(
    method wait_for (line 1741) | async def wait_for(
    method wait_for (line 1751) | async def wait_for(
    method wait_for (line 1761) | async def wait_for(
    method wait_for (line 1773) | async def wait_for(
    method wait_for (line 1783) | async def wait_for(
    method wait_for (line 1795) | async def wait_for(
    method wait_for (line 1805) | async def wait_for(
    method wait_for (line 1816) | async def wait_for(
    method wait_for (line 1827) | async def wait_for(
    method wait_for (line 1837) | async def wait_for(
    method wait_for (line 1847) | async def wait_for(
    method wait_for (line 1857) | async def wait_for(
    method wait_for (line 1867) | async def wait_for(
    method wait_for (line 1877) | async def wait_for(
    method wait_for (line 1889) | async def wait_for(
    method wait_for (line 1899) | async def wait_for(
    method wait_for (line 1911) | async def wait_for(
    method wait_for (line 1921) | async def wait_for(
    method wait_for (line 1933) | async def wait_for(
    method wait_for (line 1943) | async def wait_for(
    method wait_for (line 1953) | async def wait_for(
    method wait_for (line 1962) | def wait_for(
    method event (line 2075) | def event(self, coro: CoroT, /) -> CoroT:
    method change_presence (line 2108) | async def change_presence(
    method fetch_guilds (line 2172) | async def fetch_guilds(
    method fetch_template (line 2302) | async def fetch_template(self, code: Union[Template, str]) -> Template:
    method fetch_guild (line 2328) | async def fetch_guild(self, guild_id: int, /, *, with_counts: bool = T...
    method fetch_guild_preview (line 2373) | async def fetch_guild_preview(self, guild_id: int) -> GuildPreview:
    method create_guild (line 2397) | async def create_guild(
    method fetch_stage_instance (line 2456) | async def fetch_stage_instance(self, channel_id: int, /) -> StageInsta...
    method fetch_invite (line 2487) | async def fetch_invite(
    method delete_invite (line 2560) | async def delete_invite(self, invite: Union[Invite, str], /, *, reason...
    method fetch_widget (line 2595) | async def fetch_widget(self, guild_id: int, /) -> Widget:
    method application_info (line 2629) | async def application_info(self) -> AppInfo:
    method fetch_user (line 2647) | async def fetch_user(self, user_id: int, /) -> User:
    method fetch_channel (line 2682) | async def fetch_channel(self, channel_id: int, /) -> Union[GuildChanne...
    method fetch_webhook (line 2731) | async def fetch_webhook(self, webhook_id: int, /) -> Webhook:
    method fetch_sticker (line 2757) | async def fetch_sticker(self, sticker_id: int, /) -> Union[StandardSti...
    method fetch_skus (line 2781) | async def fetch_skus(self) -> List[SKU]:
    method fetch_entitlement (line 2807) | async def fetch_entitlement(self, entitlement_id: int, /) -> Entitlement:
    method entitlements (line 2840) | async def entitlements(
    method create_entitlement (line 2987) | async def create_entitlement(
    method fetch_premium_sticker_packs (line 3023) | async def fetch_premium_sticker_packs(self) -> List[StickerPack]:
    method fetch_premium_sticker_pack (line 3043) | async def fetch_premium_sticker_pack(self, sticker_pack_id: int, /) ->...
    method fetch_soundboard_default_sounds (line 3070) | async def fetch_soundboard_default_sounds(self) -> List[SoundboardDefa...
    method create_dm (line 3090) | async def create_dm(self, user: Snowflake) -> DMChannel:
    method add_dynamic_items (line 3118) | def add_dynamic_items(self, *items: Type[DynamicItem[Item[Any]]]) -> N...
    method remove_dynamic_items (line 3142) | def remove_dynamic_items(self, *items: Type[DynamicItem[Item[Any]]]) -...
    method add_view (line 3166) | def add_view(self, view: BaseView, *, message_id: Optional[int] = None...
    method persistent_views (line 3204) | def persistent_views(self) -> Sequence[BaseView]:
    method create_application_emoji (line 3211) | async def create_application_emoji(
    method fetch_application_emoji (line 3250) | async def fetch_application_emoji(self, emoji_id: int, /) -> Emoji:
    method fetch_application_emojis (line 3280) | async def fetch_application_emojis(self) -> List[Emoji]:

FILE: discord/collectible.py
  class Collectible (line 47) | class Collectible:
    method __init__ (line 78) | def __init__(self, *, state: ConnectionState, type: str, data: Collect...
    method static (line 94) | def static(self) -> Asset:
    method animated (line 99) | def animated(self) -> Asset:
    method __repr__ (line 103) | def __repr__(self) -> str:

FILE: discord/colour.py
  function parse_hex_number (line 44) | def parse_hex_number(argument: str) -> Colour:
  function parse_rgb_number (line 56) | def parse_rgb_number(number: str) -> int:
  function parse_rgb (line 69) | def parse_rgb(argument: str, *, regex: re.Pattern[str] = RGB_REGEX) -> C...
  class Colour (line 80) | class Colour:
    method __init__ (line 121) | def __init__(self, value: int):
    method _get_byte (line 127) | def _get_byte(self, byte: int) -> int:
    method __eq__ (line 130) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 133) | def __ne__(self, other: object) -> bool:
    method __str__ (line 136) | def __str__(self) -> str:
    method __int__ (line 139) | def __int__(self) -> int:
    method __repr__ (line 142) | def __repr__(self) -> str:
    method __hash__ (line 145) | def __hash__(self) -> int:
    method r (line 149) | def r(self) -> int:
    method g (line 154) | def g(self) -> int:
    method b (line 159) | def b(self) -> int:
    method to_rgb (line 163) | def to_rgb(self) -> Tuple[int, int, int]:
    method from_rgb (line 168) | def from_rgb(cls, r: int, g: int, b: int) -> Self:
    method from_hsv (line 173) | def from_hsv(cls, h: float, s: float, v: float) -> Self:
    method from_str (line 179) | def from_str(cls, value: str) -> Colour:
    method default (line 220) | def default(cls) -> Self:
    method random (line 228) | def random(cls, *, seed: Optional[Union[int, str, float, bytes, bytear...
    method teal (line 249) | def teal(cls) -> Self:
    method dark_teal (line 257) | def dark_teal(cls) -> Self:
    method brand_green (line 265) | def brand_green(cls) -> Self:
    method green (line 276) | def green(cls) -> Self:
    method dark_green (line 284) | def dark_green(cls) -> Self:
    method blue (line 292) | def blue(cls) -> Self:
    method dark_blue (line 300) | def dark_blue(cls) -> Self:
    method purple (line 308) | def purple(cls) -> Self:
    method dark_purple (line 316) | def dark_purple(cls) -> Self:
    method magenta (line 324) | def magenta(cls) -> Self:
    method dark_magenta (line 332) | def dark_magenta(cls) -> Self:
    method gold (line 340) | def gold(cls) -> Self:
    method dark_gold (line 348) | def dark_gold(cls) -> Self:
    method orange (line 356) | def orange(cls) -> Self:
    method dark_orange (line 364) | def dark_orange(cls) -> Self:
    method brand_red (line 372) | def brand_red(cls) -> Self:
    method red (line 382) | def red(cls) -> Self:
    method dark_red (line 390) | def dark_red(cls) -> Self:
    method lighter_grey (line 398) | def lighter_grey(cls) -> Self:
    method dark_grey (line 408) | def dark_grey(cls) -> Self:
    method light_grey (line 418) | def light_grey(cls) -> Self:
    method darker_grey (line 428) | def darker_grey(cls) -> Self:
    method og_blurple (line 438) | def og_blurple(cls) -> Self:
    method blurple (line 446) | def blurple(cls) -> Self:
    method greyple (line 454) | def greyple(cls) -> Self:
    method ash_theme (line 462) | def ash_theme(cls) -> Self:
    method dark_theme (line 474) | def dark_theme(cls) -> Self:
    method onyx_theme (line 492) | def onyx_theme(cls) -> Self:
    method light_theme (line 504) | def light_theme(cls) -> Self:
    method fuchsia (line 516) | def fuchsia(cls) -> Self:
    method yellow (line 526) | def yellow(cls) -> Self:
    method ash_embed (line 536) | def ash_embed(cls) -> Self:
    method dark_embed (line 547) | def dark_embed(cls) -> Self:
    method onyx_embed (line 560) | def onyx_embed(cls) -> Self:
    method light_embed (line 570) | def light_embed(cls) -> Self:
    method pink (line 583) | def pink(cls) -> Self:

FILE: discord/components.py
  class Component (line 131) | class Component:
    method __repr__ (line 159) | def __repr__(self) -> str:
    method type (line 164) | def type(self) -> ComponentType:
    method _raw_construct (line 169) | def _raw_construct(cls, **kwargs) -> Self:
    method to_dict (line 180) | def to_dict(self) -> ComponentPayload:
  class BaseOption (line 184) | class BaseOption:
    method __init__ (line 200) | def __init__(
    method __repr__ (line 213) | def __repr__(self) -> str:
    method __str__ (line 217) | def __str__(self) -> str:
    method from_dict (line 225) | def from_dict(cls, data: OptionPayload) -> Self:
    method to_dict (line 233) | def to_dict(self) -> OptionPayload:
    method copy (line 245) | def copy(self) -> Self:
  class ActionRow (line 249) | class ActionRow(Component):
    method __init__ (line 272) | def __init__(self, data: ActionRowPayload, /) -> None:
    method type (line 283) | def type(self) -> Literal[ComponentType.action_row]:
    method to_dict (line 287) | def to_dict(self) -> ActionRowPayload:
  class Button (line 297) | class Button(Component):
    method __init__ (line 347) | def __init__(self, data: ButtonComponentPayload, /) -> None:
    method type (line 366) | def type(self) -> Literal[ComponentType.button]:
    method to_dict (line 370) | def to_dict(self) -> ButtonComponentPayload:
  class SelectMenu (line 398) | class SelectMenu(Component):
    method __init__ (line 457) | def __init__(self, data: SelectMenuPayload, /) -> None:
    method to_dict (line 472) | def to_dict(self) -> SelectMenuPayload:
  class SelectOption (line 495) | class SelectOption(BaseOption):
    method __init__ (line 536) | def __init__(
    method __str__ (line 549) | def __str__(self) -> str:
    method emoji (line 560) | def emoji(self) -> Optional[PartialEmoji]:
    method emoji (line 565) | def emoji(self, value: Optional[Union[str, Emoji, PartialEmoji]]) -> N...
    method from_dict (line 577) | def from_dict(cls, data: SelectOptionPayload) -> Self:
    method to_dict (line 591) | def to_dict(self) -> SelectOptionPayload:
  class TextInput (line 600) | class TextInput(Component):
    method __init__ (line 647) | def __init__(self, data: TextInputPayload, /) -> None:
    method type (line 659) | def type(self) -> Literal[ComponentType.text_input]:
    method to_dict (line 663) | def to_dict(self) -> TextInputPayload:
    method default (line 690) | def default(self) -> Optional[str]:
  class SelectDefaultValue (line 698) | class SelectDefaultValue:
    method __init__ (line 713) | def __init__(
    method type (line 723) | def type(self) -> SelectDefaultValueType:
    method type (line 728) | def type(self, value: SelectDefaultValueType) -> None:
    method __repr__ (line 734) | def __repr__(self) -> str:
    method from_dict (line 738) | def from_dict(cls, data: SelectDefaultValuesPayload) -> SelectDefaultV...
    method to_dict (line 744) | def to_dict(self) -> SelectDefaultValuesPayload:
    method from_channel (line 751) | def from_channel(cls, channel: Snowflake, /) -> Self:
    method from_role (line 770) | def from_role(cls, role: Snowflake, /) -> Self:
    method from_user (line 789) | def from_user(cls, user: Snowflake, /) -> Self:
  class SectionComponent (line 808) | class SectionComponent(Component):
    method __init__ (line 838) | def __init__(self, data: SectionComponentPayload, state: Optional[Conn...
    method type (line 849) | def type(self) -> Literal[ComponentType.section]:
    method to_dict (line 852) | def to_dict(self) -> SectionComponentPayload:
  class ThumbnailComponent (line 865) | class ThumbnailComponent(Component):
    method __init__ (line 898) | def __init__(
    method type (line 909) | def type(self) -> Literal[ComponentType.thumbnail]:
    method to_dict (line 912) | def to_dict(self) -> ThumbnailComponentPayload:
  class TextDisplay (line 926) | class TextDisplay(Component):
    method __init__ (line 950) | def __init__(self, data: TextComponentPayload) -> None:
    method type (line 955) | def type(self) -> Literal[ComponentType.text_display]:
    method to_dict (line 958) | def to_dict(self) -> TextComponentPayload:
  class UnfurledMediaItem (line 968) | class UnfurledMediaItem(AssetMixin):
    method __init__ (line 1016) | def __init__(self, url: str) -> None:
    method flags (line 1030) | def flags(self) -> AttachmentFlags:
    method _from_data (line 1035) | def _from_data(cls, data: UnfurledMediaItemPayload, state: Optional[Co...
    method _update (line 1040) | def _update(self, data: UnfurledMediaItemPayload, state: Optional[Conn...
    method __repr__ (line 1054) | def __repr__(self) -> str:
    method to_dict (line 1057) | def to_dict(self):
  class MediaGalleryItem (line 1063) | class MediaGalleryItem:
    method __init__ (line 1088) | def __init__(
    method __repr__ (line 1107) | def __repr__(self) -> str:
    method media (line 1111) | def media(self) -> UnfurledMediaItem:
    method media (line 1116) | def media(self, value: Union[str, File, UnfurledMediaItem]) -> None:
    method _from_data (line 1127) | def _from_data(cls, data: MediaGalleryItemPayload, state: Optional[Con...
    method _from_gallery (line 1138) | def _from_gallery(
    method to_dict (line 1145) | def to_dict(self) -> MediaGalleryItemPayload:
  class MediaGalleryComponent (line 1157) | class MediaGalleryComponent(Component):
    method __init__ (line 1181) | def __init__(self, data: MediaGalleryComponentPayload, state: Optional...
    method type (line 1186) | def type(self) -> Literal[ComponentType.media_gallery]:
    method to_dict (line 1189) | def to_dict(self) -> MediaGalleryComponentPayload:
  class FileComponent (line 1199) | class FileComponent(Component):
    method __init__ (line 1235) | def __init__(self, data: FileComponentPayload, state: Optional[Connect...
    method type (line 1243) | def type(self) -> Literal[ComponentType.file]:
    method to_dict (line 1246) | def to_dict(self) -> FileComponentPayload:
  class SeparatorComponent (line 1257) | class SeparatorComponent(Component):
    method __init__ (line 1287) | def __init__(
    method type (line 1296) | def type(self) -> Literal[ComponentType.separator]:
    method to_dict (line 1299) | def to_dict(self) -> SeparatorComponentPayload:
  class Container (line 1310) | class Container(Component):
    method __init__ (line 1346) | def __init__(self, data: ContainerComponentPayload, state: Optional[Co...
    method accent_colour (line 1364) | def accent_colour(self) -> Optional[Colour]:
    method type (line 1371) | def type(self) -> Literal[ComponentType.container]:
    method to_dict (line 1374) | def to_dict(self) -> ContainerComponentPayload:
  class LabelComponent (line 1387) | class LabelComponent(Component):
    method __init__ (line 1420) | def __init__(self, data: LabelComponentPayload, state: Optional[Connec...
    method type (line 1427) | def type(self) -> Literal[ComponentType.label]:
    method to_dict (line 1430) | def to_dict(self) -> LabelComponentPayload:
  class FileUploadComponent (line 1443) | class FileUploadComponent(Component):
    method __init__ (line 1482) | def __init__(self, data: FileUploadComponentPayload, /) -> None:
    method type (line 1490) | def type(self) -> Literal[ComponentType.file_upload]:
    method to_dict (line 1494) | def to_dict(self) -> FileUploadComponentPayload:
  class RadioGroupComponent (line 1508) | class RadioGroupComponent(Component):
    method __init__ (line 1537) | def __init__(self, data: RadioGroupComponentPayload, /) -> None:
    method type (line 1544) | def type(self) -> Literal[ComponentType.radio_group]:
    method to_dict (line 1548) | def to_dict(self) -> RadioGroupComponentPayload:
  class RadioGroupOption (line 1562) | class RadioGroupOption(BaseOption):
  class CheckboxGroupComponent (line 1599) | class CheckboxGroupComponent(Component):
    method __init__ (line 1634) | def __init__(self, data: CheckboxGroupComponentPayload, /) -> None:
    method type (line 1645) | def type(self) -> Literal[ComponentType.checkbox_group]:
    method to_dict (line 1649) | def to_dict(self) -> CheckboxGroupComponentPayload:
  class CheckboxGroupOption (line 1665) | class CheckboxGroupOption(BaseOption):
  class CheckboxComponent (line 1702) | class CheckboxComponent(Component):
    method __init__ (line 1728) | def __init__(self, data: CheckboxComponentPayload, /) -> None:
    method type (line 1734) | def type(self) -> Literal[ComponentType.checkbox]:
    method to_dict (line 1738) | def to_dict(self) -> CheckboxComponentPayload:
  function _component_factory (line 1750) | def _component_factory(data: ComponentPayload, state: Optional[Connectio...

FILE: discord/context_managers.py
  function _typing_done_callback (line 44) | def _typing_done_callback(fut: asyncio.Future) -> None:
  class Typing (line 52) | class Typing:
    method __init__ (line 53) | def __init__(self, messageable: Messageable) -> None:
    method _get_channel (line 58) | async def _get_channel(self) -> MessageableChannel:
    method wrapped_typer (line 65) | async def wrapped_typer(self) -> None:
    method __await__ (line 69) | def __await__(self) -> Generator[None, None, None]:
    method do_typing (line 72) | async def do_typing(self) -> None:
    method __aenter__ (line 80) | async def __aenter__(self) -> None:
    method __aexit__ (line 86) | async def __aexit__(

FILE: discord/embeds.py
  class EmbedProxy (line 41) | class EmbedProxy:
    method __init__ (line 42) | def __init__(self, layer: Dict[str, Any]):
    method __len__ (line 45) | def __len__(self) -> int:
    method __repr__ (line 48) | def __repr__(self) -> str:
    method __getattr__ (line 52) | def __getattr__(self, attr: str) -> None:
    method __eq__ (line 55) | def __eq__(self, other: object) -> bool:
  class EmbedMediaProxy (line 59) | class EmbedMediaProxy(EmbedProxy):
    method __init__ (line 60) | def __init__(self, layer: Dict[str, Any]):
    method __bool__ (line 64) | def __bool__(self) -> bool:
    method flags (line 71) | def flags(self) -> AttachmentFlags:
  class _EmbedFooterProxy (line 82) | class _EmbedFooterProxy(Protocol):
  class _EmbedFieldProxy (line 86) | class _EmbedFieldProxy(Protocol):
  class _EmbedMediaProxy (line 91) | class _EmbedMediaProxy(Protocol):
  class _EmbedProviderProxy (line 98) | class _EmbedProviderProxy(Protocol):
  class _EmbedAuthorProxy (line 102) | class _EmbedAuthorProxy(Protocol):
  class Embed (line 109) | class Embed:
    method __init__ (line 181) | def __init__(
    method from_dict (line 212) | def from_dict(cls, data: Mapping[str, Any]) -> Self:
    method copy (line 265) | def copy(self) -> Self:
    method __len__ (line 269) | def __len__(self) -> int:
    method __bool__ (line 290) | def __bool__(self) -> bool:
    method __eq__ (line 308) | def __eq__(self, other: Embed) -> bool:
    method flags (line 327) | def flags(self) -> EmbedFlags:
    method colour (line 335) | def colour(self) -> Optional[Colour]:
    method colour (line 339) | def colour(self, value: Optional[Union[int, Colour]]) -> None:
    method timestamp (line 352) | def timestamp(self) -> Optional[datetime.datetime]:
    method timestamp (line 356) | def timestamp(self, value: Optional[datetime.datetime]) -> None:
    method footer (line 367) | def footer(self) -> _EmbedFooterProxy:
    method set_footer (line 377) | def set_footer(self, *, text: Optional[Any] = None, icon_url: Optional...
    method remove_footer (line 401) | def remove_footer(self) -> Self:
    method image (line 417) | def image(self) -> _EmbedMediaProxy:
    method set_image (line 433) | def set_image(self, *, url: Optional[Any]) -> Self:
    method thumbnail (line 460) | def thumbnail(self) -> _EmbedMediaProxy:
    method set_thumbnail (line 476) | def set_thumbnail(self, *, url: Optional[Any]) -> Self:
    method video (line 503) | def video(self) -> _EmbedMediaProxy:
    method provider (line 520) | def provider(self) -> _EmbedProviderProxy:
    method author (line 531) | def author(self) -> _EmbedAuthorProxy:
    method set_author (line 541) | def set_author(self, *, name: Any, url: Optional[Any] = None, icon_url...
    method remove_author (line 570) | def remove_author(self) -> Self:
    method fields (line 586) | def fields(self) -> List[_EmbedFieldProxy]:
    method add_field (line 596) | def add_field(self, *, name: Any, value: Any, inline: bool = True) -> ...
    method insert_field_at (line 625) | def insert_field_at(self, index: int, *, name: Any, value: Any, inline...
    method clear_fields (line 658) | def clear_fields(self) -> Self:
    method remove_field (line 674) | def remove_field(self, index: int) -> Self:
    method set_field_at (line 703) | def set_field_at(self, index: int, *, name: Any, value: Any, inline: b...
    method to_dict (line 738) | def to_dict(self) -> EmbedData:

FILE: discord/emoji.py
  class Emoji (line 50) | class Emoji(_EmojiTag, AssetMixin):
    method __init__ (line 117) | def __init__(self, *, guild: Snowflake, state: ConnectionState, data: ...
    method _from_data (line 122) | def _from_data(self, emoji: EmojiPayload) -> None:
    method _to_partial (line 133) | def _to_partial(self) -> PartialEmoji:
    method __iter__ (line 136) | def __iter__(self) -> Iterator[Tuple[str, Any]]:
    method __str__ (line 143) | def __str__(self) -> str:
    method __repr__ (line 148) | def __repr__(self) -> str:
    method __eq__ (line 151) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 154) | def __ne__(self, other: object) -> bool:
    method __hash__ (line 157) | def __hash__(self) -> int:
    method created_at (line 161) | def created_at(self) -> datetime:
    method url (line 166) | def url(self) -> str:
    method roles (line 172) | def roles(self) -> List[Role]:
    method guild (line 184) | def guild(self) -> Optional[Guild]:
    method is_usable (line 188) | def is_usable(self) -> bool:
    method delete (line 200) | async def delete(self, *, reason: Optional[str] = None) -> None:
    method edit (line 234) | async def edit(
    method is_application_owned (line 297) | def is_application_owned(self) -> bool:

FILE: discord/enums.py
  function _create_value_cls (line 93) | def _create_value_cls(name: str, comparable: bool):
  function _is_descriptor (line 107) | def _is_descriptor(obj):
  class EnumMeta (line 111) | class EnumMeta(type):
    method __new__ (line 118) | def __new__(
    method __iter__ (line 163) | def __iter__(cls) -> Iterator[Any]:
    method __reversed__ (line 166) | def __reversed__(cls) -> Iterator[Any]:
    method __len__ (line 169) | def __len__(cls) -> int:
    method __repr__ (line 172) | def __repr__(cls) -> str:
    method __members__ (line 176) | def __members__(cls) -> Mapping[str, Any]:
    method __call__ (line 179) | def __call__(cls, value: str) -> Any:
    method __getitem__ (line 185) | def __getitem__(cls, key: str) -> Any:
    method __setattr__ (line 188) | def __setattr__(cls, name: str, value: Any) -> None:
    method __delattr__ (line 191) | def __delattr__(cls, attr: str) -> None:
    method __instancecheck__ (line 194) | def __instancecheck__(self, instance: Any) -> bool:
  class Enum (line 207) | class Enum(metaclass=EnumMeta):
    method try_value (line 209) | def try_value(cls, value):
  class ChannelType (line 216) | class ChannelType(Enum):
    method __str__ (line 230) | def __str__(self) -> str:
  class MessageReferenceType (line 234) | class MessageReferenceType(Enum):
  class MessageType (line 240) | class MessageType(Enum):
    method is_deletable (line 282) | def is_deletable(self) -> bool:
  class SpeakingState (line 293) | class SpeakingState(Enum):
    method __str__ (line 299) | def __str__(self) -> str:
    method __int__ (line 302) | def __int__(self) -> int:
  class VerificationLevel (line 306) | class VerificationLevel(Enum, comparable=True):
    method __str__ (line 313) | def __str__(self) -> str:
  class ContentFilter (line 317) | class ContentFilter(Enum, comparable=True):
    method __str__ (line 322) | def __str__(self) -> str:
  class Status (line 326) | class Status(Enum):
    method __str__ (line 334) | def __str__(self) -> str:
  class DefaultAvatar (line 338) | class DefaultAvatar(Enum):
    method __str__ (line 347) | def __str__(self) -> str:
  class NotificationLevel (line 351) | class NotificationLevel(Enum, comparable=True):
  class AuditLogActionCategory (line 356) | class AuditLogActionCategory(Enum):
  class AuditLogAction (line 362) | class AuditLogAction(Enum):
    method category (line 434) | def category(self) -> Optional[AuditLogActionCategory]:
    method target_type (line 509) | def target_type(self) -> Optional[str]:
  class UserFlags (line 557) | class UserFlags(Enum):
  class ActivityType (line 580) | class ActivityType(Enum):
    method __int__ (line 589) | def __int__(self) -> int:
  class TeamMembershipState (line 593) | class TeamMembershipState(Enum):
  class TeamMemberRole (line 598) | class TeamMemberRole(Enum):
  class WebhookType (line 604) | class WebhookType(Enum):
  class ExpireBehaviour (line 610) | class ExpireBehaviour(Enum):
  class StickerType (line 618) | class StickerType(Enum):
  class StickerFormatType (line 623) | class StickerFormatType(Enum):
    method file_extension (line 630) | def file_extension(self) -> str:
  class InviteTarget (line 642) | class InviteTarget(Enum):
  class InteractionType (line 648) | class InteractionType(Enum):
  class InteractionResponseType (line 656) | class InteractionResponseType(Enum):
  class VideoQualityMode (line 670) | class VideoQualityMode(Enum):
    method __int__ (line 674) | def __int__(self) -> int:
  class ComponentType (line 678) | class ComponentType(Enum):
    method __int__ (line 702) | def __int__(self) -> int:
  class ButtonStyle (line 706) | class ButtonStyle(Enum):
    method __int__ (line 722) | def __int__(self) -> int:
  class TextStyle (line 726) | class TextStyle(Enum):
    method __int__ (line 733) | def __int__(self) -> int:
  class PrivacyLevel (line 737) | class PrivacyLevel(Enum):
  class NSFWLevel (line 741) | class NSFWLevel(Enum, comparable=True):
  class MFALevel (line 748) | class MFALevel(Enum, comparable=True):
  class Locale (line 789) | class Locale(Enum):
    method __str__ (line 823) | def __str__(self) -> str:
    method language_code (line 827) | def language_code(self) -> str:
  class EntityType (line 834) | class EntityType(Enum):
  class EventStatus (line 840) | class EventStatus(Enum):
  class AppCommandOptionType (line 850) | class AppCommandOptionType(Enum):
  class AppCommandType (line 864) | class AppCommandType(Enum):
  class AppCommandPermissionType (line 870) | class AppCommandPermissionType(Enum):
  class AutoModRuleTriggerType (line 876) | class AutoModRuleTriggerType(Enum):
  class AutoModRuleEventType (line 885) | class AutoModRuleEventType(Enum):
  class AutoModRuleActionType (line 890) | class AutoModRuleActionType(Enum):
  class ForumLayoutType (line 897) | class ForumLayoutType(Enum):
  class ForumOrderType (line 903) | class ForumOrderType(Enum):
  class SelectDefaultValueType (line 908) | class SelectDefaultValueType(Enum):
  class SKUType (line 914) | class SKUType(Enum):
  class EntitlementType (line 921) | class EntitlementType(Enum):
  class EntitlementOwnerType (line 932) | class EntitlementOwnerType(Enum):
  class PollLayoutType (line 937) | class PollLayoutType(Enum):
  class InviteType (line 941) | class InviteType(Enum):
  class ReactionType (line 947) | class ReactionType(Enum):
  class VoiceChannelEffectAnimationType (line 952) | class VoiceChannelEffectAnimationType(Enum):
  class SubscriptionStatus (line 957) | class SubscriptionStatus(Enum):
  class StatusDisplayType (line 963) | class StatusDisplayType(Enum):
  class OnboardingPromptType (line 969) | class OnboardingPromptType(Enum):
  class OnboardingMode (line 974) | class OnboardingMode(Enum):
  class SeparatorSpacing (line 979) | class SeparatorSpacing(Enum):
  class MediaItemLoadingState (line 984) | class MediaItemLoadingState(Enum):
  class CollectibleType (line 991) | class CollectibleType(Enum):
  class NameplatePalette (line 995) | class NameplatePalette(Enum):
  function create_unknown_value (line 1009) | def create_unknown_value(cls: Type[E], val: Any) -> E:
  function try_enum (line 1015) | def try_enum(cls: Type[E], val: Any) -> E:

FILE: discord/errors.py
  class DiscordException (line 60) | class DiscordException(Exception):
  class ClientException (line 69) | class ClientException(DiscordException):
  class FFmpegProcessError (line 78) | class FFmpegProcessError(ClientException):
  class GatewayNotFound (line 87) | class GatewayNotFound(DiscordException):
    method __init__ (line 90) | def __init__(self):
  function _flatten_error_dict (line 95) | def _flatten_error_dict(d: Dict[str, Any], key: str = '') -> Dict[str, s...
  class HTTPException (line 113) | class HTTPException(DiscordException):
    method __init__ (line 131) | def __init__(self, response: _ResponseType, message: Optional[Union[st...
  class RateLimited (line 158) | class RateLimited(DiscordException):
    method __init__ (line 177) | def __init__(self, retry_after: float):
  class Forbidden (line 182) | class Forbidden(HTTPException):
  class NotFound (line 191) | class NotFound(HTTPException):
  class DiscordServerError (line 200) | class DiscordServerError(HTTPException):
  class InvalidData (line 211) | class InvalidData(ClientException):
  class LoginFailure (line 219) | class LoginFailure(ClientException):
  class ConnectionClosed (line 228) | class ConnectionClosed(ClientException):
    method __init__ (line 242) | def __init__(self, socket: ClientWebSocketResponse, *, shard_id: Optio...
  class PrivilegedIntentsRequired (line 252) | class PrivilegedIntentsRequired(ClientException):
    method __init__ (line 269) | def __init__(self, shard_id: Optional[int]):
  class InteractionResponded (line 280) | class InteractionResponded(ClientException):
    method __init__ (line 294) | def __init__(self, interaction: Interaction):
  class MissingApplicationID (line 299) | class MissingApplicationID(ClientException):
    method __init__ (line 314) | def __init__(self, message: Optional[str] = None):

FILE: discord/ext/commands/_types.py
  class Check (line 61) | class Check(Protocol[ContextT_co]):  # type: ignore # TypeVar is expecte...
    method __call__ (line 64) | def __call__(self, coro_or_commands: T) -> T: ...
  class _BaseCommand (line 69) | class _BaseCommand:

FILE: discord/ext/commands/bot.py
  class _BotOptions (line 91) | class _BotOptions(_ClientOptions, total=False):
  class _AutoShardedBotOptions (line 97) | class _AutoShardedBotOptions(_AutoShardedClientOptions, _BotOptions): ...
  function when_mentioned (line 113) | def when_mentioned(bot: _Bot, msg: Message, /) -> List[str]:
  function when_mentioned_or (line 126) | def when_mentioned_or(*prefixes: str) -> Callable[[_Bot, Message], List[...
  class _DefaultRepr (line 164) | class _DefaultRepr:
    method __repr__ (line 165) | def __repr__(self):
  class BotBase (line 172) | class BotBase(GroupMixin[None]):
    method __init__ (line 173) | def __init__(
    method _async_setup_hook (line 220) | async def _async_setup_hook(self) -> None:
    method dispatch (line 237) | def dispatch(self, event_name: str, /, *args: Any, **kwargs: Any) -> N...
    method close (line 245) | async def close(self) -> None:
    method add_command (line 263) | def add_command(self, command: Command[Any, ..., Any], /) -> None:
    method remove_command (line 274) | def remove_command(self, name: str, /) -> Optional[Command[Any, ..., A...
    method hybrid_command (line 290) | def hybrid_command(
    method hybrid_group (line 314) | def hybrid_group(
    method on_command_error (line 340) | async def on_command_error(self, context: Context[BotT], exception: er...
    method check (line 370) | def check(self, func: T, /) -> T:
    method add_check (line 402) | def add_check(self, func: UserCheck[ContextT], /, *, call_once: bool =...
    method remove_check (line 428) | def remove_check(self, func: UserCheck[ContextT], /, *, call_once: boo...
    method check_once (line 453) | def check_once(self, func: CFT, /) -> CFT:
    method can_run (line 495) | async def can_run(self, ctx: Context[BotT], /, *, call_once: bool = Fa...
    method is_owner (line 503) | async def is_owner(self, user: User, /) -> bool:
    method before_invoke (line 554) | def before_invoke(self, coro: CFT, /) -> CFT:
    method after_invoke (line 590) | def after_invoke(self, coro: CFT, /) -> CFT:
    method add_listener (line 629) | def add_listener(self, func: CoroFunc, /, name: str = MISSING) -> None:
    method remove_listener (line 665) | def remove_listener(self, func: CoroFunc, /, name: str = MISSING) -> N...
    method listen (line 689) | def listen(self, name: str = MISSING) -> Callable[[CFT], CFT]:
    method add_cog (line 727) | async def add_cog(
    method get_cog (line 813) | def get_cog(self, name: str, /) -> Optional[Cog]:
    method remove_cog (line 836) | async def remove_cog(
    method cogs (line 906) | def cogs(self) -> Mapping[str, Cog]:
    method _remove_module_references (line 912) | async def _remove_module_references(self, name: str) -> None:
    method _call_module_finalizers (line 939) | async def _call_module_finalizers(self, lib: types.ModuleType, key: st...
    method _load_from_module_spec (line 957) | async def _load_from_module_spec(self, spec: importlib.machinery.Modul...
    method _resolve_name (line 983) | def _resolve_name(self, name: str, package: Optional[str]) -> str:
    method load_extension (line 989) | async def load_extension(self, name: str, *, package: Optional[str] = ...
    method unload_extension (line 1042) | async def unload_extension(self, name: str, *, package: Optional[str] ...
    method reload_extension (line 1089) | async def reload_extension(self, name: str, *, package: Optional[str] ...
    method extensions (line 1157) | def extensions(self) -> Mapping[str, types.ModuleType]:
    method help_command (line 1164) | def help_command(self) -> Optional[HelpCommand]:
    method help_command (line 1168) | def help_command(self, value: Optional[HelpCommand]) -> None:
    method tree (line 1188) | def tree(self) -> app_commands.CommandTree[Self]:  # type: ignore
    method get_prefix (line 1198) | async def get_prefix(self, message: Message, /) -> Union[List[str], str]:
    method get_context (line 1242) | async def get_context(
    method get_context (line 1250) | async def get_context(
    method get_context (line 1258) | async def get_context(
    method invoke (line 1357) | async def invoke(self, ctx: Context[BotT], /) -> None:
    method process_commands (line 1387) | async def process_commands(self, message: Message, /) -> None:
    method on_message (line 1420) | async def on_message(self, message: Message, /) -> None:
  class Bot (line 1424) | class Bot(BotBase, discord.Client):
  class AutoShardedBot (line 1527) | class AutoShardedBot(BotBase, discord.AutoShardedClient):
    method __init__ (line 1542) | def __init__(

FILE: discord/ext/commands/cog.py
  class CogMeta (line 74) | class CogMeta(type):
    method __new__ (line 174) | def __new__(cls, *args: Any, **kwargs: Any) -> CogMeta:
    method __init__ (line 259) | def __init__(self, *args: Any, **kwargs: Any) -> None:
    method qualified_name (line 263) | def qualified_name(cls) -> str:
  function _cog_special_method (line 267) | def _cog_special_method(func: FuncT) -> FuncT:
  class Cog (line 272) | class Cog(metaclass=CogMeta):
    method __new__ (line 297) | def __new__(cls, *args: Any, **kwargs: Any) -> Self:
    method get_commands (line 408) | def get_commands(self) -> List[Command[Self, ..., Any]]:
    method get_app_commands (line 422) | def get_app_commands(self) -> List[Union[app_commands.Command[Self, .....
    method qualified_name (line 434) | def qualified_name(self) -> str:
    method description (line 439) | def description(self) -> str:
    method description (line 444) | def description(self, description: str) -> None:
    method walk_commands (line 447) | def walk_commands(self) -> Generator[Command[Self, ..., Any], None, No...
    method walk_app_commands (line 463) | def walk_app_commands(self) -> Generator[Union[app_commands.Command[Se...
    method app_command (line 477) | def app_command(self) -> Optional[app_commands.Group]:
    method get_listeners (line 484) | def get_listeners(self) -> List[Tuple[str, Callable[..., Any]]]:
    method _get_overridden_method (line 495) | def _get_overridden_method(cls, method: FuncT) -> Optional[FuncT]:
    method listener (line 500) | def listener(cls, name: str = MISSING) -> Callable[[FuncT], FuncT]:
    method has_error_handler (line 541) | def has_error_handler(self) -> bool:
    method has_app_command_error_handler (line 548) | def has_app_command_error_handler(self) -> bool:
    method cog_load (line 556) | async def cog_load(self) -> None:
    method cog_unload (line 570) | async def cog_unload(self) -> None:
    method bot_check_once (line 586) | def bot_check_once(self, ctx: Context[BotT]) -> MaybeCoro[bool]:
    method bot_check (line 596) | def bot_check(self, ctx: Context[BotT]) -> MaybeCoro[bool]:
    method cog_check (line 606) | def cog_check(self, ctx: Context[BotT]) -> MaybeCoro[bool]:
    method interaction_check (line 616) | def interaction_check(self, interaction: discord.Interaction[ClientT],...
    method cog_command_error (line 628) | async def cog_command_error(self, ctx: Context[BotT], error: Exception...
    method cog_app_command_error (line 649) | async def cog_app_command_error(
    method cog_before_invoke (line 672) | async def cog_before_invoke(self, ctx: Context[BotT]) -> None:
    method cog_after_invoke (line 689) | async def cog_after_invoke(self, ctx: Context[BotT]) -> None:
    method _inject (line 705) | async def _inject(self, bot: BotBase, override: bool, guild: Optional[...
    method _eject (line 753) | async def _eject(self, bot: BotBase, guild_ids: Optional[Iterable[int]...
  class GroupCog (line 785) | class GroupCog(Cog):

FILE: discord/ext/commands/context.py
  function is_cog (line 82) | def is_cog(obj: Any) -> TypeGuard[Cog]:
  class DeferTyping (line 86) | class DeferTyping(Generic[BotT]):
    method __init__ (line 87) | def __init__(self, ctx: Context[BotT], *, ephemeral: bool):
    method do_defer (line 91) | async def do_defer(self) -> None:
    method __await__ (line 95) | def __await__(self) -> Generator[Any, None, None]:
    method __aenter__ (line 98) | async def __aenter__(self) -> None:
    method __aexit__ (line 101) | async def __aexit__(
  class Context (line 110) | class Context(discord.abc.Messageable, Generic[BotT]):
    method __init__ (line 182) | def __init__(
    method from_interaction (line 219) | async def from_interaction(cls, interaction: Interaction[BotT], /) -> ...
    method invoke (line 308) | async def invoke(self, command: Command[CogT, P, T], /, *args: P.args,...
    method reinvoke (line 345) | async def reinvoke(self, *, call_hooks: bool = False, restart: bool = ...
    method valid (line 408) | def valid(self) -> bool:
    method _get_channel (line 412) | async def _get_channel(self) -> discord.abc.Messageable:
    method clean_prefix (line 416) | def clean_prefix(self) -> str:
    method cog (line 433) | def cog(self) -> Optional[Cog]:
    method filesize_limit (line 441) | def filesize_limit(self) -> int:
    method guild (line 449) | def guild(self) -> Optional[Guild]:
    method channel (line 454) | def channel(self) -> MessageableChannel:
    method author (line 461) | def author(self) -> Union[User, Member]:
    method me (line 468) | def me(self) -> Union[Member, ClientUser]:
    method permissions (line 476) | def permissions(self) -> Permissions:
    method bot_permissions (line 502) | def bot_permissions(self) -> Permissions:
    method voice_client (line 546) | def voice_client(self) -> Optional[VoiceProtocol]:
    method send_help (line 551) | async def send_help(self, *args: Any) -> Any:
    method reply (line 634) | async def reply(
    method reply (line 650) | async def reply(
    method reply (line 666) | async def reply(
    method reply (line 687) | async def reply(
    method reply (line 708) | async def reply(
    method reply (line 729) | async def reply(
    method reply (line 749) | async def reply(self, content: Optional[str] = None, **kwargs: Any) ->...
    method typing (line 784) | def typing(self, *, ephemeral: bool = False) -> Union[Typing, DeferTyp...
    method defer (line 824) | async def defer(self, *, ephemeral: bool = False) -> None:
    method send (line 851) | async def send(
    method send (line 867) | async def send(
    method send (line 883) | async def send(
    method send (line 904) | async def send(
    method send (line 925) | async def send(
    method send (line 946) | async def send(
    method send (line 966) | async def send(

FILE: discord/ext/commands/converter.py
  function _get_from_guilds (line 95) | def _get_from_guilds(bot: _Bot, getter: str, argument: Any) -> Any:
  class Converter (line 112) | class Converter(Protocol[T_co]):
    method convert (line 123) | async def convert(self, ctx: Context[BotT], argument: str) -> T_co:
  class IDConverter (line 156) | class IDConverter(Converter[T_co]):
    method _get_id_match (line 158) | def _get_id_match(argument):
  class ObjectConverter (line 162) | class ObjectConverter(IDConverter[discord.Object]):
    method convert (line 175) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class MemberConverter (line 186) | class MemberConverter(IDConverter[discord.Member]):
    method query_member_named (line 214) | async def query_member_named(self, guild: discord.Guild, argument: str...
    method query_member_by_id (line 232) | async def query_member_by_id(self, bot: _Bot, guild: discord.Guild, us...
    method convert (line 253) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class UserConverter (line 288) | class UserConverter(IDConverter[discord.User]):
    method convert (line 314) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class PartialMessageConverter (line 348) | class PartialMessageConverter(Converter[discord.PartialMessage]):
    method _get_id_matches (line 361) | def _get_id_matches(ctx: Context[BotT], argument: str) -> Tuple[Option...
    method _resolve_channel (line 384) | def _resolve_channel(
    method convert (line 399) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class MessageConverter (line 407) | class MessageConverter(IDConverter[discord.Message]):
    method convert (line 422) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class GuildChannelConverter (line 438) | class GuildChannelConverter(IDConverter[discord.abc.GuildChannel]):
    method convert (line 457) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
    method _parse_from_url (line 461) | def _parse_from_url(argument: str) -> Optional[re.Match[str]]:
    method _resolve_channel (line 470) | def _resolve_channel(ctx: Context[BotT], argument: str, attribute: str...
    method _resolve_thread (line 506) | def _resolve_thread(ctx: Context[BotT], argument: str, attribute: str,...
  class TextChannelConverter (line 531) | class TextChannelConverter(IDConverter[discord.TextChannel]):
    method convert (line 551) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class VoiceChannelConverter (line 555) | class VoiceChannelConverter(IDConverter[discord.VoiceChannel]):
    method convert (line 575) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class StageChannelConverter (line 579) | class StageChannelConverter(IDConverter[discord.StageChannel]):
    method convert (line 598) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class CategoryChannelConverter (line 602) | class CategoryChannelConverter(IDConverter[discord.CategoryChannel]):
    method convert (line 622) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class ThreadConverter (line 626) | class ThreadConverter(IDConverter[discord.Thread]):
    method convert (line 644) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class ForumChannelConverter (line 648) | class ForumChannelConverter(IDConverter[discord.ForumChannel]):
    method convert (line 667) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class ColourConverter (line 671) | class ColourConverter(Converter[discord.Colour]):
    method convert (line 697) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class RoleConverter (line 711) | class RoleConverter(IDConverter[discord.Role]):
    method convert (line 727) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class GameConverter (line 743) | class GameConverter(Converter[discord.Game]):
    method convert (line 746) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class InviteConverter (line 750) | class InviteConverter(Converter[discord.Invite]):
    method convert (line 759) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class GuildConverter (line 767) | class GuildConverter(IDConverter[discord.Guild]):
    method convert (line 778) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class EmojiConverter (line 794) | class EmojiConverter(IDConverter[discord.Emoji]):
    method convert (line 810) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class PartialEmojiConverter (line 835) | class PartialEmojiConverter(Converter[discord.PartialEmoji]):
    method convert (line 844) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class GuildStickerConverter (line 859) | class GuildStickerConverter(IDConverter[discord.GuildSticker]):
    method convert (line 873) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class Timestamp (line 902) | class Timestamp(Converter[str]):
    method convert (line 913) | async def convert(self, ctx: Context[BotT], argument: str) -> datetime...
  class ScheduledEventConverter (line 920) | class ScheduledEventConverter(IDConverter[discord.ScheduledEvent]):
    method convert (line 935) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class SoundboardSoundConverter (line 979) | class SoundboardSoundConverter(IDConverter[discord.SoundboardSound]):
    method convert (line 993) | async def convert(self, ctx: Context[BotT], argument: str) -> discord....
  class clean_content (line 1017) | class clean_content(Converter[str]):
    method __init__ (line 1037) | def __init__(
    method convert (line 1050) | async def convert(self, ctx: Context[BotT], argument: str) -> str:
  class Greedy (line 1106) | class Greedy(List[T]):
    method __init__ (line 1136) | def __init__(self, *, converter: T) -> None:
    method __repr__ (line 1139) | def __repr__(self) -> str:
    method __class_getitem__ (line 1143) | def __class_getitem__(cls, params: Union[Tuple[T], T]) -> Greedy[T]:
    method constructed_converter (line 1168) | def constructed_converter(self) -> Any:
  class Range (line 1183) | class Range:
    method __init__ (line 1216) | def __init__(
    method convert (line 1230) | async def convert(self, ctx: Context[BotT], value: str) -> Union[int, ...
    method __call__ (line 1246) | def __call__(self) -> None:
    method __or__ (line 1250) | def __or__(self, rhs) -> Any:
    method __repr__ (line 1253) | def __repr__(self) -> str:
    method __class_getitem__ (line 1256) | def __class_getitem__(cls, obj) -> Range:
  function _convert_to_bool (line 1290) | def _convert_to_bool(argument: str) -> bool:
  function is_generic_type (line 1303) | def is_generic_type(tp: Any, *, _GenericAlias: type = _GenericAlias) -> ...
  function _actual_conversion (line 1333) | async def _actual_conversion(ctx: Context[BotT], converter: Any, argumen...
  function run_converters (line 1372) | async def run_converters(
  function run_converters (line 1378) | async def run_converters(ctx: Context[BotT], converter: Any, argument: s...
  function run_converters (line 1381) | async def run_converters(ctx: Context[BotT], converter: Any, argument: s...

FILE: discord/ext/commands/cooldowns.py
  class BucketType (line 55) | class BucketType(Enum):
    method get_key (line 64) | def get_key(self, msg: Union[Message, Context[Any]]) -> Any:
    method __call__ (line 82) | def __call__(self, msg: Union[Message, Context[Any]]) -> Any:
  class CooldownMapping (line 86) | class CooldownMapping(Generic[T_contra]):
    method __init__ (line 87) | def __init__(
    method copy (line 99) | def copy(self) -> CooldownMapping[T_contra]:
    method valid (line 105) | def valid(self) -> bool:
    method type (line 109) | def type(self) -> Callable[[T_contra], Any]:
    method from_cooldown (line 113) | def from_cooldown(cls, rate: float, per: float, type: Callable[[T_cont...
    method _bucket_key (line 116) | def _bucket_key(self, msg: T_contra) -> Any:
    method _verify_cache_integrity (line 119) | def _verify_cache_integrity(self, current: Optional[float] = None) -> ...
    method create_bucket (line 128) | def create_bucket(self, message: T_contra) -> Cooldown:
    method get_bucket (line 131) | def get_bucket(self, message: T_contra, current: Optional[float] = Non...
    method update_rate_limit (line 146) | def update_rate_limit(self, message: T_contra, current: Optional[float...
  class DynamicCooldownMapping (line 153) | class DynamicCooldownMapping(CooldownMapping[T_contra]):
    method __init__ (line 154) | def __init__(
    method copy (line 162) | def copy(self) -> DynamicCooldownMapping[T_contra]:
    method valid (line 168) | def valid(self) -> bool:
    method create_bucket (line 171) | def create_bucket(self, message: T_contra) -> Optional[Cooldown]:
  class _Semaphore (line 175) | class _Semaphore:
    method __init__ (line 190) | def __init__(self, number: int) -> None:
    method __repr__ (line 195) | def __repr__(self) -> str:
    method locked (line 198) | def locked(self) -> bool:
    method is_active (line 201) | def is_active(self) -> bool:
    method wake_up (line 204) | def wake_up(self) -> None:
    method acquire (line 211) | async def acquire(self, *, wait: bool = False) -> bool:
    method release (line 230) | def release(self) -> None:
  class MaxConcurrency (line 235) | class MaxConcurrency:
    method __init__ (line 238) | def __init__(self, number: int, *, per: BucketType, wait: bool) -> None:
    method copy (line 250) | def copy(self) -> Self:
    method __repr__ (line 253) | def __repr__(self) -> str:
    method get_key (line 256) | def get_key(self, message: Union[Message, Context[Any]]) -> Any:
    method acquire (line 259) | async def acquire(self, message: Union[Message, Context[Any]]) -> None:
    method release (line 271) | async def release(self, message: Union[Message, Context[Any]]) -> None:

FILE: discord/ext/commands/core.py
  class _CommandDecoratorKwargs (line 69) | class _CommandDecoratorKwargs(TypedDict, total=False):
  class _CommandKwargs (line 86) | class _CommandKwargs(_CommandDecoratorKwargs, total=False):
  class _GroupDecoratorKwargs (line 89) | class _GroupDecoratorKwargs(_CommandDecoratorKwargs, total=False):
  class _GroupKwargs (line 93) | class _GroupKwargs(_GroupDecoratorKwargs, total=False):
  function unwrap_function (line 137) | def unwrap_function(function: Callable[..., Any], /) -> Callable[..., Any]:
  function get_signature_parameters (line 148) | def get_signature_parameters(
  function _fold_text (line 205) | def _fold_text(input: str) -> str:
  function extract_descriptions_from_docstring (line 216) | def extract_descriptions_from_docstring(function: Callable[..., Any], pa...
  function wrap_callback (line 244) | def wrap_callback(coro: Callable[P, Coro[T]], /) -> Callable[P, Coro[Opt...
  function hooked_wrapped_callback (line 260) | def hooked_wrapped_callback(
  class _CaseInsensitiveDict (line 286) | class _CaseInsensitiveDict(dict):
    method __contains__ (line 287) | def __contains__(self, k):
    method __delitem__ (line 290) | def __delitem__(self, k):
    method __getitem__ (line 293) | def __getitem__(self, k):
    method get (line 296) | def get(self, k, default=None):
    method pop (line 299) | def pop(self, k, default=None):
    method __setitem__ (line 302) | def __setitem__(self, k, v):
  class _AttachmentIterator (line 306) | class _AttachmentIterator:
    method __init__ (line 307) | def __init__(self, data: List[discord.Attachment]):
    method __iter__ (line 311) | def __iter__(self) -> Self:
    method __next__ (line 314) | def __next__(self) -> discord.Attachment:
    method is_empty (line 323) | def is_empty(self) -> bool:
  class Command (line 327) | class Command(_BaseCommand, Generic[CogT, P, T]):
    method __new__ (line 405) | def __new__(cls, *args: Any, **kwargs: Any) -> Self:
    method __init__ (line 421) | def __init__(
    method cog (line 515) | def cog(self) -> CogT:
    method cog (line 519) | def cog(self, value: CogT) -> None:
    method callback (line 523) | def callback(
    method callback (line 532) | def callback(
    method add_check (line 550) | def add_check(self, func: UserCheck[Context[Any]], /) -> None:
    method remove_check (line 571) | def remove_check(self, func: UserCheck[Context[Any]], /) -> None:
    method update (line 594) | def update(self, **kwargs: Unpack[_CommandKwargs]) -> None:
    method __call__ (line 605) | async def __call__(self, context: Context[BotT], /, *args: P.args, **k...
    method _ensure_assignment_on_copy (line 627) | def _ensure_assignment_on_copy(self, other: Self) -> Self:
    method copy (line 644) | def copy(self) -> Self:
    method _update_copy (line 655) | def _update_copy(self, kwargs: Dict[str, Any]) -> Self:
    method dispatch_error (line 664) | async def dispatch_error(self, ctx: Context[BotT], error: CommandError...
    method transform (line 687) | async def transform(self, ctx: Context[BotT], param: Parameter, attach...
    method _transform_greedy_pos (line 752) | async def _transform_greedy_pos(self, ctx: Context[BotT], param: Param...
    method _transform_greedy_var_pos (line 773) | async def _transform_greedy_var_pos(self, ctx: Context[BotT], param: P...
    method clean_params (line 786) | def clean_params(self) -> Dict[str, Parameter]:
    method cooldown (line 795) | def cooldown(self) -> Optional[Cooldown]:
    method full_parent_name (line 804) | def full_parent_name(self) -> str:
    method parents (line 820) | def parents(self) -> List[Group[Any, ..., Any]]:
    method root_parent (line 838) | def root_parent(self) -> Optional[Group[Any, ..., Any]]:
    method qualified_name (line 850) | def qualified_name(self) -> str:
    method __str__ (line 864) | def __str__(self) -> str:
    method _parse_arguments (line 867) | async def _parse_arguments(self, ctx: Context[BotT]) -> None:
    method call_before_hooks (line 903) | async def call_before_hooks(self, ctx: Context[BotT], /) -> None:
    method call_after_hooks (line 928) | async def call_after_hooks(self, ctx: Context[BotT], /) -> None:
    method _prepare_cooldowns (line 947) | def _prepare_cooldowns(self, ctx: Context[BotT]) -> None:
    method prepare (line 957) | async def prepare(self, ctx: Context[BotT], /) -> None:
    method is_on_cooldown (line 981) | def is_on_cooldown(self, ctx: Context[BotT], /) -> bool:
    method reset_cooldown (line 1008) | def reset_cooldown(self, ctx: Context[BotT], /) -> None:
    method get_cooldown_retry_after (line 1025) | def get_cooldown_retry_after(self, ctx: Context[BotT], /) -> float:
    method invoke (line 1055) | async def invoke(self, ctx: Context[BotT], /) -> None:
    method reinvoke (line 1066) | async def reinvoke(self, ctx: Context[BotT], /, *, call_hooks: bool = ...
    method error (line 1083) | def error(self, coro: Error[CogT, ContextT], /) -> Error[CogT, ContextT]:
    method has_error_handler (line 1111) | def has_error_handler(self) -> bool:
    method before_invoke (line 1118) | def before_invoke(self, coro: Hook[CogT, ContextT], /) -> Hook[CogT, C...
    method after_invoke (line 1149) | def after_invoke(self, coro: Hook[CogT, ContextT], /) -> Hook[CogT, Co...
    method cog_name (line 1181) | def cog_name(self) -> Optional[str]:
    method short_doc (line 1186) | def short_doc(self) -> str:
    method _is_typing_optional (line 1199) | def _is_typing_optional(self, annotation: Union[T, Optional[T]]) -> bool:
    method signature (line 1203) | def signature(self) -> str:
    method can_run (line 1269) | async def can_run(self, ctx: Context[BotT], /) -> bool:
  class GroupMixin (line 1328) | class GroupMixin(Generic[CogT]):
    method __init__ (line 1341) | def __init__(self, *args: Any, **kwargs: Any) -> None:
    method commands (line 1348) | def commands(self) -> Set[Command[CogT, ..., Any]]:
    method recursively_remove_all_commands (line 1352) | def recursively_remove_all_commands(self) -> None:
    method add_command (line 1358) | def add_command(self, command: Command[CogT, ..., Any], /) -> None:
    method remove_command (line 1400) | def remove_command(self, name: str, /) -> Optional[Command[CogT, ..., ...
    method walk_commands (line 1441) | def walk_commands(self) -> Generator[Command[CogT, ..., Any], None, No...
    method get_command (line 1457) | def get_command(self, name: str, /) -> Optional[Command[CogT, ..., Any]]:
    method command (line 1502) | def command(
    method command (line 1518) | def command(
    method command (line 1534) | def command(
    method group (line 1559) | def group(
    method group (line 1575) | def group(
    method group (line 1591) | def group(
  class Group (line 1616) | class Group(GroupMixin[CogT], Command[CogT, P, T]):
    method __init__ (line 1639) | def __init__(self, *args: Any, **attrs: Unpack[_GroupKwargs]) -> None:
    method copy (line 1643) | def copy(self) -> Self:
    method invoke (line 1656) | async def invoke(self, ctx: Context[BotT], /) -> None:
    method reinvoke (line 1687) | async def reinvoke(self, ctx: Context[BotT], /, *, call_hooks: bool = ...
  class _CommandDecorator (line 1733) | class _CommandDecorator:
    method __call__ (line 1735) | def __call__(self, func: Callable[Concatenate[CogT, ContextT, P], Coro...
    method __call__ (line 1738) | def __call__(self, func: Callable[Concatenate[ContextT, P], Coro[T]], ...
    method __call__ (line 1740) | def __call__(self, func: Callable[..., Coro[T]], /) -> Any: ...
  class _GroupDecorator (line 1742) | class _GroupDecorator:
    method __call__ (line 1744) | def __call__(self, func: Callable[Concatenate[CogT, ContextT, P], Coro...
    method __call__ (line 1747) | def __call__(self, func: Callable[Concatenate[ContextT, P], Coro[T]], ...
    method __call__ (line 1749) | def __call__(self, func: Callable[..., Coro[T]], /) -> Any: ...
  function command (line 1753) | def command(
  function command (line 1760) | def command(
  function command (line 1775) | def command(
  function group (line 1821) | def group(
  function group (line 1828) | def group(
  function group (line 1843) | def group(
  function check (line 1862) | def check(predicate: UserCheck[ContextT], /) -> Check[ContextT]:
  function check_any (line 1961) | def check_any(*checks: Check[ContextT]) -> Check[ContextT]:
  function has_role (line 2030) | def has_role(item: Union[int, str], /) -> Check[Any]:
  function has_any_role (line 2077) | def has_any_role(*items: Union[int, str]) -> Callable[[T], T]:
  function bot_has_role (line 2126) | def bot_has_role(item: int, /) -> Callable[[T], T]:
  function bot_has_any_role (line 2159) | def bot_has_any_role(*items: int) -> Callable[[T], T]:
  function has_permissions (line 2188) | def has_permissions(**perms: Unpack[_PermissionsKwargs]) -> Check[Any]:
  function bot_has_permissions (line 2235) | def bot_has_permissions(**perms: Unpack[_PermissionsKwargs]) -> Check[Any]:
  function has_guild_permissions (line 2260) | def has_guild_permissions(**perms: Unpack[_PermissionsKwargs]) -> Check[...
  function bot_has_guild_permissions (line 2289) | def bot_has_guild_permissions(**perms: Unpack[_PermissionsKwargs]) -> Ch...
  function dm_only (line 2315) | def dm_only() -> Check[Any]:
  function guild_only (line 2334) | def guild_only() -> Check[Any]:
  function is_owner (line 2385) | def is_owner() -> Check[Any]:
  function is_nsfw (line 2403) | def is_nsfw() -> Check[Any]:
  function cooldown (line 2460) | def cooldown(
  function dynamic_cooldown (line 2505) | def dynamic_cooldown(
  function max_concurrency (line 2553) | def max_concurrency(number: int, per: BucketType = BucketType.default, *...
  function before_invoke (line 2588) | def before_invoke(coro: Hook[CogT, ContextT], /) -> Callable[[T], T]:
  function after_invoke (line 2640) | def after_invoke(coro: Hook[CogT, ContextT], /) -> Callable[[T], T]:

FILE: discord/ext/commands/errors.py
  class CommandError (line 114) | class CommandError(DiscordException):
    method __init__ (line 124) | def __init__(self, message: Optional[str] = None, *args: Any) -> None:
  class ConversionError (line 133) | class ConversionError(CommandError):
    method __init__ (line 147) | def __init__(self, converter: Converter[Any], original: Exception) -> ...
  class UserInputError (line 152) | class UserInputError(CommandError):
  class CommandNotFound (line 162) | class CommandNotFound(CommandError):
  class MissingRequiredArgument (line 175) | class MissingRequiredArgument(UserInputError):
    method __init__ (line 187) | def __init__(self, param: Parameter) -> None:
  class MissingRequiredAttachment (line 192) | class MissingRequiredAttachment(UserInputError):
    method __init__ (line 206) | def __init__(self, param: Parameter) -> None:
  class TooManyArguments (line 211) | class TooManyArguments(UserInputError):
  class BadArgument (line 221) | class BadArgument(UserInputError):
  class CheckFailure (line 231) | class CheckFailure(CommandError):
  class CheckAnyFailure (line 240) | class CheckAnyFailure(Generic[BotT], CheckFailure):
    method __init__ (line 255) | def __init__(self, checks: List[Callable[[Context[BotT]], bool]], erro...
  class PrivateMessageOnly (line 261) | class PrivateMessageOnly(CheckFailure):
    method __init__ (line 268) | def __init__(self, message: Optional[str] = None) -> None:
  class NoPrivateMessage (line 272) | class NoPrivateMessage(CheckFailure):
    method __init__ (line 279) | def __init__(self, message: Optional[str] = None) -> None:
  class NotOwner (line 283) | class NotOwner(CheckFailure):
  class ObjectNotFound (line 292) | class ObjectNotFound(BadArgument):
    method __init__ (line 306) | def __init__(self, argument: str) -> None:
  class MemberNotFound (line 311) | class MemberNotFound(BadArgument):
    method __init__ (line 325) | def __init__(self, argument: str) -> None:
  class GuildNotFound (line 330) | class GuildNotFound(BadArgument):
    method __init__ (line 343) | def __init__(self, argument: str) -> None:
  class UserNotFound (line 348) | class UserNotFound(BadArgument):
    method __init__ (line 362) | def __init__(self, argument: str) -> None:
  class MessageNotFound (line 367) | class MessageNotFound(BadArgument):
    method __init__ (line 380) | def __init__(self, argument: str) -> None:
  class ChannelNotReadable (line 385) | class ChannelNotReadable(BadArgument):
    method __init__ (line 399) | def __init__(self, argument: Union[GuildChannel, Thread]) -> None:
  class ChannelNotFound (line 404) | class ChannelNotFound(BadArgument):
    method __init__ (line 417) | def __init__(self, argument: Union[int, str]) -> None:
  class ThreadNotFound (line 422) | class ThreadNotFound(BadArgument):
    method __init__ (line 435) | def __init__(self, argument: str) -> None:
  class BadColourArgument (line 440) | class BadColourArgument(BadArgument):
    method __init__ (line 453) | def __init__(self, argument: str) -> None:
  class RoleNotFound (line 461) | class RoleNotFound(BadArgument):
    method __init__ (line 474) | def __init__(self, argument: str) -> None:
  class BadInviteArgument (line 479) | class BadInviteArgument(BadArgument):
    method __init__ (line 492) | def __init__(self, argument: str) -> None:
  class EmojiNotFound (line 497) | class EmojiNotFound(BadArgument):
    method __init__ (line 510) | def __init__(self, argument: str) -> None:
  class PartialEmojiConversionFailure (line 515) | class PartialEmojiConversionFailure(BadArgument):
    method __init__ (line 529) | def __init__(self, argument: str) -> None:
  class GuildStickerNotFound (line 534) | class GuildStickerNotFound(BadArgument):
    method __init__ (line 547) | def __init__(self, argument: str) -> None:
  class ScheduledEventNotFound (line 552) | class ScheduledEventNotFound(BadArgument):
    method __init__ (line 565) | def __init__(self, argument: str) -> None:
  class SoundboardSoundNotFound (line 570) | class SoundboardSoundNotFound(BadArgument):
    method __init__ (line 583) | def __init__(self, argument: str) -> None:
  class BadBoolArgument (line 588) | class BadBoolArgument(BadArgument):
    method __init__ (line 601) | def __init__(self, argument: str) -> None:
  class BadTimestampArgument (line 606) | class BadTimestampArgument(BadArgument):
    method __init__ (line 619) | def __init__(self, argument: str) -> None:
  class RangeError (line 624) | class RangeError(BadArgument):
    method __init__ (line 641) | def __init__(
  class DisabledCommand (line 670) | class DisabledCommand(CommandError):
  class CommandInvokeError (line 679) | class CommandInvokeError(CommandError):
    method __init__ (line 691) | def __init__(self, e: Exception) -> None:
  class CommandOnCooldown (line 696) | class CommandOnCooldown(CommandError):
    method __init__ (line 712) | def __init__(self, cooldown: Cooldown, retry_after: float, type: Bucke...
  class MaxConcurrencyReached (line 719) | class MaxConcurrencyReached(CommandError):
    method __init__ (line 732) | def __init__(self, number: int, per: BucketType) -> None:
  class MissingRole (line 742) | class MissingRole(CheckFailure):
    method __init__ (line 756) | def __init__(self, missing_role: Snowflake) -> None:
  class BotMissingRole (line 762) | class BotMissingRole(CheckFailure):
    method __init__ (line 776) | def __init__(self, missing_role: Snowflake) -> None:
  class MissingAnyRole (line 782) | class MissingAnyRole(CheckFailure):
    method __init__ (line 797) | def __init__(self, missing_roles: SnowflakeList) -> None:
  class BotMissingAnyRole (line 806) | class BotMissingAnyRole(CheckFailure):
    method __init__ (line 822) | def __init__(self, missing_roles: SnowflakeList) -> None:
  class NSFWChannelRequired (line 831) | class NSFWChannelRequired(CheckFailure):
    method __init__ (line 844) | def __init__(self, channel: Union[GuildChannel, Thread]) -> None:
  class MissingPermissions (line 849) | class MissingPermissions(CheckFailure):
    method __init__ (line 861) | def __init__(self, missing_permissions: List[str], *args: Any) -> None:
  class BotMissingPermissions (line 870) | class BotMissingPermissions(CheckFailure):
    method __init__ (line 882) | def __init__(self, missing_permissions: List[str], *args: Any) -> None:
  class BadUnionArgument (line 891) | class BadUnionArgument(UserInputError):
    method __init__ (line 907) | def __init__(self, param: Parameter, converters: Tuple[type, ...], err...
  class BadLiteralArgument (line 925) | class BadLiteralArgument(UserInputError):
    method __init__ (line 947) | def __init__(self, param: Parameter, literals: Tuple[Any, ...], errors...
  class ArgumentParsingError (line 958) | class ArgumentParsingError(UserInputError):
  class UnexpectedQuoteError (line 970) | class UnexpectedQuoteError(ArgumentParsingError):
    method __init__ (line 981) | def __init__(self, quote: str) -> None:
  class InvalidEndOfQuotedStringError (line 986) | class InvalidEndOfQuotedStringError(ArgumentParsingError):
    method __init__ (line 998) | def __init__(self, char: str) -> None:
  class ExpectedClosingQuoteError (line 1003) | class ExpectedClosingQuoteError(ArgumentParsingError):
    method __init__ (line 1014) | def __init__(self, close_quote: str) -> None:
  class ExtensionError (line 1019) | class ExtensionError(DiscordException):
    method __init__ (line 1030) | def __init__(self, message: Optional[str] = None, *args: Any, name: st...
  class ExtensionAlreadyLoaded (line 1038) | class ExtensionAlreadyLoaded(ExtensionError):
    method __init__ (line 1044) | def __init__(self, name: str) -> None:
  class ExtensionNotLoaded (line 1048) | class ExtensionNotLoaded(ExtensionError):
    method __init__ (line 1054) | def __init__(self, name: str) -> None:
  class NoEntryPointError (line 1058) | class NoEntryPointError(ExtensionError):
    method __init__ (line 1064) | def __init__(self, name: str) -> None:
  class ExtensionFailed (line 1068) | class ExtensionFailed(ExtensionError):
    method __init__ (line 1082) | def __init__(self, name: str, original: Exception) -> None:
  class ExtensionNotFound (line 1088) | class ExtensionNotFound(ExtensionError):
    method __init__ (line 1102) | def __init__(self, name: str) -> None:
  class CommandRegistrationError (line 1107) | class CommandRegistrationError(ClientException):
    method __init__ (line 1123) | def __init__(self, name: str, *, alias_conflict: bool = False) -> None:
  class FlagError (line 1130) | class FlagError(BadArgument):
  class TooManyFlags (line 1141) | class TooManyFlags(FlagError):
    method __init__ (line 1156) | def __init__(self, flag: Flag, values: List[str]) -> None:
  class BadFlagArgument (line 1162) | class BadFlagArgument(FlagError):
    method __init__ (line 1180) | def __init__(self, flag: Flag, argument: str, original: Exception) -> ...
  class MissingRequiredFlag (line 1193) | class MissingRequiredFlag(FlagError):
    method __init__ (line 1206) | def __init__(self, flag: Flag) -> None:
  class MissingFlagArgument (line 1211) | class MissingFlagArgument(FlagError):
    method __init__ (line 1224) | def __init__(self, flag: Flag) -> None:
  class HybridCommandError (line 1229) | class HybridCommandError(CommandError):
    method __init__ (line 1243) | def __init__(self, original: AppCommandError) -> None:

FILE: discord/ext/commands/flags.py
  function get_annotations_from_namespace (line 56) | def get_annotations_from_namespace(namespace: Dict[str, Any]) -> Dict[st...
  function get_annotations_from_namespace (line 69) | def get_annotations_from_namespace(namespace: Dict[str, Any]) -> Dict[st...
  class Flag (line 74) | class Flag:
    method required (line 119) | def required(self) -> bool:
  function flag (line 127) | def flag(
  function is_flag (line 181) | def is_flag(obj: Any) -> TypeGuard[Type[FlagConverter]]:
  function validate_flag_name (line 185) | def validate_flag_name(name: str, forbidden: Set[str]) -> None:
  function get_flags (line 198) | def get_flags(namespace: Dict[str, Any], globals: Dict[str, Any], locals...
  class FlagsMeta (line 300) | class FlagsMeta(type):
    method __new__ (line 311) | def __new__(
  function tuple_convert_all (line 397) | async def tuple_convert_all(ctx: Context[BotT], argument: str, flag: Fla...
  function tuple_convert_flag (line 420) | async def tuple_convert_flag(ctx: Context[BotT], argument: str, flag: Fl...
  function convert_flag (line 446) | async def convert_flag(ctx: Context[BotT], argument: str, flag: Flag, an...
  class FlagConverter (line 477) | class FlagConverter(metaclass=FlagsMeta):
    method get_flags (line 510) | def get_flags(cls) -> Dict[str, Flag]:
    method _can_be_constructible (line 515) | def _can_be_constructible(cls) -> bool:
    method __iter__ (line 518) | def __iter__(self) -> Iterator[Tuple[str, Any]]:
    method _construct_default (line 523) | async def _construct_default(cls, ctx: Context[BotT]) -> Self:
    method __repr__ (line 535) | def __repr__(self) -> str:
    method parse_flags (line 540) | def parse_flags(cls, argument: str, *, ignore_extra: bool = True) -> D...
    method convert (line 614) | async def convert(cls, ctx: Context[BotT], argument: str) -> Self:

FILE: discord/ext/commands/help.py
  class _HelpCommandOptions (line 70) | class _HelpCommandOptions(TypedDict, total=False):
  class _BaseHelpCommandOptions (line 75) | class _BaseHelpCommandOptions(_HelpCommandOptions, total=False):
  class _DefaultHelpCommandOptions (line 83) | class _DefaultHelpCommandOptions(_BaseHelpCommandOptions, total=False):
  class _MinimalHelpCommandOptions (line 90) | class _MinimalHelpCommandOptions(_BaseHelpCommandOptions, total=False):
  class Paginator (line 127) | class Paginator:
    method __init__ (line 149) | def __init__(
    method clear (line 158) | def clear(self) -> None:
    method _prefix_len (line 169) | def _prefix_len(self) -> int:
    method _suffix_len (line 173) | def _suffix_len(self) -> int:
    method _linesep_len (line 177) | def _linesep_len(self) -> int:
    method add_line (line 180) | def add_line(self, line: str = '', *, empty: bool = False) -> None:
    method close_page (line 212) | def close_page(self) -> None:
    method __len__ (line 225) | def __len__(self) -> int:
    method pages (line 230) | def pages(self) -> List[str]:
    method __repr__ (line 242) | def __repr__(self) -> str:
  function _not_overridden (line 247) | def _not_overridden(f: FuncT) -> FuncT:
  class _HelpCommandImpl (line 252) | class _HelpCommandImpl(Command):
    method __init__ (line 253) | def __init__(self, inject: HelpCommand, *args: Any, **kwargs: Unpack[_...
    method prepare (line 259) | async def prepare(self, ctx: Context[Any]) -> None:
    method _parse_arguments (line 274) | async def _parse_arguments(self, ctx: Context[BotT]) -> None:
    method _on_error_cog_implementation (line 284) | async def _on_error_cog_implementation(self, _, ctx: Context[BotT], er...
    method _inject_into_cog (line 287) | def _inject_into_cog(self, cog: Cog) -> None:
    method _eject_cog (line 313) | def _eject_cog(self) -> None:
    method update (line 326) | def update(self, **kwargs: Any) -> None:
  class HelpCommand (line 332) | class HelpCommand:
    method __new__ (line 379) | def __new__(cls, *args: Any, **kwargs: Any) -> Self:
    method __init__ (line 395) | def __init__(self, **options: Unpack[_HelpCommandOptions]) -> None:
    method copy (line 404) | def copy(self) -> Self:
    method _add_to_bot (line 409) | def _add_to_bot(self, bot: BotBase) -> None:
    method _remove_from_bot (line 413) | def _remove_from_bot(self, bot: BotBase) -> None:
    method add_check (line 417) | def add_check(self, func: UserCheck[Context[Any]], /) -> None:
    method remove_check (line 437) | def remove_check(self, func: UserCheck[Context[Any]], /) -> None:
    method get_bot_mapping (line 458) | def get_bot_mapping(self) -> Dict[Optional[Cog], List[Command[Any, ......
    method invoked_with (line 466) | def invoked_with(self) -> Optional[str]:
    method get_command_signature (line 486) | def get_command_signature(self, command: Command[Any, ..., Any], /) ->...
    method remove_mentions (line 524) | def remove_mentions(self, string: str, /) -> str:
    method cog (line 545) | def cog(self) -> Optional[Cog]:
    method cog (line 562) | def cog(self, cog: Optional[Cog]) -> None:
    method command_not_found (line 570) | def command_not_found(self, string: str, /) -> str:
    method subcommand_not_found (line 595) | def subcommand_not_found(self, command: Command[Any, ..., Any], string...
    method filter_commands (line 629) | async def filter_commands(
    method get_max_size (line 696) | def get_max_size(self, commands: Sequence[Command[Any, ..., Any]], /) ...
    method get_destination (line 717) | def get_destination(self) -> discord.abc.MessageableChannel:
    method send_error_message (line 731) | async def send_error_message(self, error: str, /) -> None:
    method on_help_command_error (line 760) | async def on_help_command_error(self, ctx: Context[BotT], error: Comma...
    method send_bot_help (line 784) | async def send_bot_help(self, mapping: Mapping[Optional[Cog], List[Com...
    method send_cog_help (line 817) | async def send_cog_help(self, cog: Cog, /) -> None:
    method send_group_help (line 849) | async def send_group_help(self, group: Group[Any, ..., Any], /) -> None:
    method send_command_help (line 881) | async def send_command_help(self, command: Command[Any, ..., Any], /) ...
    method prepare_help_command (line 923) | async def prepare_help_command(self, ctx: Context[BotT], command: Opti...
    method command_callback (line 951) | async def command_callback(self, ctx: Context[BotT], /, *, command: Op...
  class DefaultHelpCommand (line 1017) | class DefaultHelpCommand(HelpCommand):
    method __init__ (line 1069) | def __init__(self, **options: Unpack[_DefaultHelpCommandOptions]) -> N...
    method shorten_text (line 1089) | def shorten_text(self, text: str, /) -> str:
    method get_ending_note (line 1100) | def get_ending_note(self) -> str:
    method get_command_signature (line 1108) | def get_command_signature(self, command: Command[Any, ..., Any], /) ->...
    method add_indented_commands (line 1136) | def add_indented_commands(
    method add_command_arguments (line 1177) | def add_command_arguments(self, command: Command[Any, ..., Any], /) ->...
    method send_pages (line 1213) | async def send_pages(self) -> None:
    method add_command_formatting (line 1222) | def add_command_formatting(self, command: Command[Any, ..., Any], /) -...
    method get_destination (line 1255) | def get_destination(self) -> discord.abc.Messageable:
    method prepare_help_command (line 1264) | async def prepare_help_command(self, ctx: Context[BotT], command: Opti...
    method send_bot_help (line 1268) | async def send_bot_help(self, mapping: Mapping[Optional[Cog], List[Com...
    method send_command_help (line 1298) | async def send_command_help(self, command: Command[Any, ..., Any], /) ...
    method send_group_help (line 1303) | async def send_group_help(self, group: Group[Any, ..., Any], /) -> None:
    method send_cog_help (line 1317) | async def send_cog_help(self, cog: Cog, /) -> None:
  class MinimalHelpCommand (line 1332) | class MinimalHelpCommand(HelpCommand):
    method __init__ (line 1364) | def __init__(self, **options: Unpack[_MinimalHelpCommandOptions]) -> N...
    method send_pages (line 1380) | async def send_pages(self) -> None:
    method get_opening_note (line 1389) | def get_opening_note(self) -> str:
    method get_command_signature (line 1408) | def get_command_signature(self, command: Command[Any, ..., Any], /) ->...
    method get_ending_note (line 1411) | def get_ending_note(self) -> str:
    method add_bot_commands_formatting (line 1423) | def add_bot_commands_formatting(self, commands: Sequence[Command[Any, ...
    method add_subcommand_formatting (line 1448) | def add_subcommand_formatting(self, command: Command[Any, ..., Any], /...
    method add_aliases_formatting (line 1468) | def add_aliases_formatting(self, aliases: Sequence[str], /) -> None:
    method add_command_formatting (line 1489) | def add_command_formatting(self, command: Command[Any, ..., Any], /) -...
    method get_destination (line 1520) | def get_destination(self) -> discord.abc.Messageable:
    method prepare_help_command (line 1529) | async def prepare_help_command(self, ctx: Context[BotT], command: Opti...
    method send_bot_help (line 1533) | async def send_bot_help(self, mapping: Mapping[Optional[Cog], List[Com...
    method send_cog_help (line 1564) | async def send_cog_help(self, cog: Cog, /) -> None:
    method send_group_help (line 1589) | async def send_group_help(self, group: Group[Any, ..., Any], /) -> None:
    method send_command_help (line 1609) | async def send_command_help(self, command: Command[Any, ..., Any], /) ...

FILE: discord/ext/commands/hybrid.py
  class _HybridCommandKwargs (line 53) | class _HybridCommandKwargs(_CommandKwargs, total=False):
  class _HybridCommandDecoratorKwargs (line 60) | class _HybridCommandDecoratorKwargs(_HybridCommandKwargs, total=False):
  class _HybridGroupKwargs (line 63) | class _HybridGroupKwargs(_HybridCommandDecoratorKwargs, total=False):
  class _HybridGroupDecoratorKwargs (line 72) | class _HybridGroupDecoratorKwargs(_HybridGroupKwargs, total=False):
  class _CallableDefault (line 106) | class _CallableDefault:
    method __init__ (line 109) | def __init__(self, func: Callable[[Context], Any]) -> None:
    method __class__ (line 113) | def __class__(self) -> Any:
  function is_converter (line 117) | def is_converter(converter: Any) -> bool:
  function is_transformer (line 121) | def is_transformer(converter: Any) -> bool:
  function required_pos_arguments (line 127) | def required_pos_arguments(func: Callable[..., Any]) -> int:
  class ConverterTransformer (line 132) | class ConverterTransformer(app_commands.Transformer):
    method __init__ (line 133) | def __init__(self, converter: Any, parameter: Parameter) -> None:
    method transform (line 146) | async def transform(self, interaction: discord.Interaction, value: str...
  class CallableTransformer (line 165) | class CallableTransformer(app_commands.Transformer):
    method __init__ (line 166) | def __init__(self, func: Callable[[str], Any]) -> None:
    method transform (line 170) | async def transform(self, interaction: discord.Interaction, value: str...
  class GreedyTransformer (line 179) | class GreedyTransformer(app_commands.Transformer):
    method __init__ (line 180) | def __init__(self, converter: Any, parameter: Parameter) -> None:
    method transform (line 185) | async def transform(self, interaction: discord.Interaction, value: str...
  function replace_parameter (line 205) | def replace_parameter(
  function replace_parameters (line 288) | def replace_parameters(
  class HybridAppCommand (line 318) | class HybridAppCommand(discord.app_commands.Command[CogT, P, T]):
    method __init__ (line 321) | def __init__(
    method _copy_with (line 348) | def _copy_with(self, **kwargs) -> Self:
    method copy (line 354) | def copy(self) -> Self:
    method _transform_arguments (line 360) | async def _transform_arguments(
    method _check_can_run (line 395) | async def _check_can_run(self, interaction: discord.Interaction) -> bool:
    method _invoke_with_namespace (line 448) | async def _invoke_with_namespace(self, interaction: discord.Interactio...
  class HybridCommand (line 494) | class HybridCommand(Command[CogT, P, T]):
    method __init__ (line 510) | def __init__(
    method __discord_app_commands_unwrap__ (line 538) | def __discord_app_commands_unwrap__(self) -> Optional[HybridAppCommand...
    method cog (line 542) | def cog(self) -> CogT:
    method cog (line 546) | def cog(self, value: CogT) -> None:
    method can_run (line 551) | async def can_run(self, ctx: Context[BotT], /) -> bool:
    method _parse_arguments (line 560) | async def _parse_arguments(self, ctx: Context[BotT]) -> None:
    method _ensure_assignment_on_copy (line 567) | def _ensure_assignment_on_copy(self, other: Self) -> Self:
    method autocomplete (line 576) | def autocomplete(
  class HybridGroup (line 607) | class HybridGroup(Group[CogT, P, T]):
    method __init__ (line 635) | def __init__(
    method _fallback_command (line 704) | def _fallback_command(self) -> Optional[HybridAppCommand[CogT, ..., T]]:
    method __discord_app_commands_unwrap__ (line 710) | def __discord_app_commands_unwrap__(self) -> Optional[app_commands.Gro...
    method cog (line 714) | def cog(self) -> CogT:
    method cog (line 718) | def cog(self, value: CogT) -> None:
    method can_run (line 724) | async def can_run(self, ctx: Context[BotT], /) -> bool:
    method _parse_arguments (line 731) | async def _parse_arguments(self, ctx: Context[BotT]) -> None:
    method _ensure_assignment_on_copy (line 739) | def _ensure_assignment_on_copy(self, other: Self) -> Self:
    method _update_copy (line 744) | def _update_copy(self, kwargs: Dict[str, Any]) -> Self:
    method autocomplete (line 762) | def autocomplete(
    method add_command (line 798) | def add_command(self, command: Union[HybridGroup[CogT, ..., Any], Hybr...
    method remove_command (line 838) | def remove_command(self, name: str, /) -> Optional[Command[CogT, ..., ...
    method command (line 844) | def command(
    method group (line 868) | def group(
  function hybrid_command (line 893) | def hybrid_command(
  function hybrid_group (line 945) | def hybrid_group(

FILE: discord/ext/commands/parameters.py
  function _gen_property (line 73) | def _gen_property(name: str) -> property:
  class Parameter (line 82) | class Parameter(inspect.Parameter):
    method __init__ (line 92) | def __init__(
    method __repr__ (line 112) | def __repr__(self) -> str:
    method replace (line 115) | def replace(
    method required (line 160) | def required(self) -> bool:
    method converter (line 165) | def converter(self) -> Any:
    method description (line 173) | def description(self) -> Optional[str]:
    method displayed_default (line 178) | def displayed_default(self) -> Optional[str]:
    method displayed_name (line 192) | def displayed_name(self) -> Optional[str]:
    method get_default (line 199) | async def get_default(self, ctx: Context[Any]) -> Any:
  function parameter (line 215) | def parameter(
  class ParameterAlias (line 272) | class ParameterAlias(Protocol):
    method __call__ (line 273) | def __call__(
  function default_guild (line 308) | def default_guild(ctx: Context[Any]) -> Guild:
  class Signature (line 322) | class Signature(inspect.Signature):

FILE: discord/ext/commands/view.py
  class StringView (line 54) | class StringView:
    method __init__ (line 55) | def __init__(self, buffer: str) -> None:
    method current (line 62) | def current(self) -> Optional[str]:
    method eof (line 66) | def eof(self) -> bool:
    method undo (line 69) | def undo(self) -> None:
    method skip_ws (line 72) | def skip_ws(self) -> bool:
    method skip_string (line 87) | def skip_string(self, string: str) -> bool:
    method read_rest (line 95) | def read_rest(self) -> str:
    method read (line 101) | def read(self, n: int) -> str:
    method get (line 107) | def get(self) -> Optional[str]:
    method get_word (line 117) | def get_word(self) -> str:
    method get_quoted_word (line 132) | def get_quoted_word(self) -> Optional[str]:
    method __repr__ (line 195) | def __repr__(self) -> str:

FILE: discord/ext/tasks/__init__.py
  function is_ambiguous (line 66) | def is_ambiguous(dt: datetime.datetime) -> bool:
  function is_imaginary (line 79) | def is_imaginary(dt: datetime.datetime) -> bool:
  function resolve_datetime (line 90) | def resolve_datetime(dt: datetime.datetime) -> datetime.datetime:
  class SleepHandle (line 108) | class SleepHandle:
    method __init__ (line 111) | def __init__(self, dt: datetime.datetime, *, loop: asyncio.AbstractEve...
    method _wrapped_set_result (line 118) | def _wrapped_set_result(future: asyncio.Future) -> None:
    method recalculate (line 122) | def recalculate(self, dt: datetime.datetime) -> None:
    method wait (line 127) | def wait(self) -> asyncio.Future[Any]:
    method done (line 130) | def done(self) -> bool:
    method cancel (line 133) | def cancel(self) -> None:
  class Loop (line 138) | class Loop(Generic[LF]):
    method __init__ (line 144) | def __init__(
    method _call_loop_function (line 188) | async def _call_loop_function(self, name: str, *args: Any, **kwargs: A...
    method _try_sleep_until (line 198) | def _try_sleep_until(self, dt: datetime.datetime):
    method _is_relative_time (line 202) | def _is_relative_time(self) -> bool:
    method _is_explicit_time (line 205) | def _is_explicit_time(self) -> bool:
    method _loop (line 208) | async def _loop(self, *args: Any, **kwargs: Any) -> None:
    method __get__ (line 288) | def __get__(self, obj: T, objtype: Type[T]) -> Loop[LF]:
    method seconds (line 310) | def seconds(self) -> Optional[float]:
    method minutes (line 320) | def minutes(self) -> Optional[float]:
    method hours (line 330) | def hours(self) -> Optional[float]:
    method time (line 340) | def time(self) -> Optional[List[datetime.time]]:
    method current_loop (line 350) | def current_loop(self) -> int:
    method next_iteration (line 355) | def next_iteration(self) -> Optional[datetime.datetime]:
    method __call__ (line 366) | async def __call__(self, *args: Any, **kwargs: Any) -> Any:
    method start (line 386) | def start(self, *args: Any, **kwargs: Any) -> asyncio.Task[None]:
    method stop (line 417) | def stop(self) -> None:
    method _can_be_cancelled (line 441) | def _can_be_cancelled(self) -> bool:
    method cancel (line 444) | def cancel(self) -> None:
    method restart (line 449) | def restart(self, *args: Any, **kwargs: Any) -> None:
    method add_exception_type (line 474) | def add_exception_type(self, *exceptions: Type[BaseException]) -> None:
    method clear_exception_types (line 503) | def clear_exception_types(self) -> None:
    method remove_exception_type (line 512) | def remove_exception_type(self, *exceptions: Type[BaseException]) -> b...
    method get_task (line 529) | def get_task(self) -> Optional[asyncio.Task[None]]:
    method is_being_cancelled (line 533) | def is_being_cancelled(self) -> bool:
    method failed (line 537) | def failed(self) -> bool:
    method is_running (line 544) | def is_running(self) -> bool:
    method _error (line 551) | async def _error(self, *args: Any) -> None:
    method before_loop (line 555) | def before_loop(self, coro: FT) -> FT:
    method after_loop (line 583) | def after_loop(self, coro: FT) -> FT:
    method error (line 611) | def error(self, coro: ET) -> ET:
    method _get_next_sleep_time (line 641) | def _get_next_sleep_time(self, now: datetime.datetime = MISSING) -> da...
    method _start_time_relative_to (line 661) | def _start_time_relative_to(self, now: datetime.datetime) -> Optional[...
    method _get_time_parameter (line 686) | def _get_time_parameter(
    method change_interval (line 715) | def change_interval(
    method change_interval (line 724) | def change_interval(
    method change_interval (line 730) | def change_interval(
  function loop (line 798) | def loop(
  function loop (line 810) | def loop(
  function loop (line 819) | def loop(

FILE: discord/file.py
  function _strip_spoiler (line 40) | def _strip_spoiler(filename: str) -> Tuple[str, bool]:
  class File (line 48) | class File:
    method __init__ (line 82) | def __init__(
    method filename (line 122) | def filename(self) -> str:
    method filename (line 130) | def filename(self, value: str) -> None:
    method uri (line 134) | def uri(self) -> str:
    method reset (line 147) | def reset(self, *, seek: Union[int, bool] = True) -> None:
    method close (line 159) | def close(self) -> None:
    method to_dict (line 164) | def to_dict(self, index: int) -> Dict[str, Any]:

FILE: discord/flags.py
  class _IntentsFlagsKwargs (line 51) | class _IntentsFlagsKwargs(TypedDict, total=False):
  class _MemberCacheFlagsKwargs (line 82) | class _MemberCacheFlagsKwargs(TypedDict, total=False):
  class flag_value (line 109) | class flag_value:
    method __init__ (line 110) | def __init__(self, func: Callable[[Any], int]):
    method __get__ (line 115) | def __get__(self, instance: None, owner: Type[BF]) -> Self: ...
    method __get__ (line 118) | def __get__(self, instance: BF, owner: Type[BF]) -> bool: ...
    method __get__ (line 120) | def __get__(self, instance: Optional[BF], owner: Type[BF]) -> Any:
    method __set__ (line 125) | def __set__(self, instance: BaseFlags, value: bool) -> None:
    method __repr__ (line 128) | def __repr__(self) -> str:
  class alias_flag_value (line 132) | class alias_flag_value(flag_value):
  function fill_with_flags (line 136) | def fill_with_flags(*, inverted: bool = False) -> Callable[[Type[BF]], T...
  class BaseFlags (line 158) | class BaseFlags:
    method __init__ (line 166) | def __init__(self, **kwargs: bool):
    method _from_value (line 174) | def _from_value(cls, value: int) -> Self:
    method __or__ (line 179) | def __or__(self, other: Self) -> Self:
    method __and__ (line 182) | def __and__(self, other: Self) -> Self:
    method __xor__ (line 185) | def __xor__(self, other: Self) -> Self:
    method __ior__ (line 188) | def __ior__(self, other: Self) -> Self:
    method __iand__ (line 192) | def __iand__(self, other: Self) -> Self:
    method __ixor__ (line 196) | def __ixor__(self, other: Self) -> Self:
    method __invert__ (line 200) | def __invert__(self) -> Self:
    method __bool__ (line 205) | def __bool__(self) -> bool:
    method __eq__ (line 208) | def __eq__(self, other: object) -> bool:
    method __ne__ (line 211) | def __ne__(self, other: object) -> bool:
    method __hash__ (line 214) | def __hash__(self) -> int:
    method __repr__ (line 217) | def __repr__(self) -> str:
    method __iter__ (line 220) | def __iter__(self) -> Iterator[Tuple[str, bool]]:
    method _has_flag (line 228) | def _has_flag(self, o: int) -> bool:
    method _set_flag (line 231) | def _set_flag(self, o: int, toggle: bool) -> None:
  class SystemChannelFlags (line 241) | class SystemChannelFlags(BaseFlags):
    method _has_flag (line 318) | def _has_flag(self, o: int) -> bool:
    method _set_flag (line 321) | def _set_flag(self, o: int, toggle: bool) -> None:
    method join_notifications (line 330) | def join_notifications(self):
    method premium_subscriptions (line 335) | def premium_subscriptions(self):
    method guild_reminder_notifications (line 340) | def guild_reminder_notifications(self):
    method join_notification_replies (line 348) | def join_notification_replies(self):
    method role_subscription_purchase_notifications (line 357) | def role_subscription_purchase_notifications(self):
    method role_subscription_purchase_notification_replies (line 366) | def role_subscription_purchase_notification_replies(self):
    method emoji_added (line 375) | def emoji_added(self):
  class MessageFlags (line 385) | class MessageFlags(BaseFlags):
    method crossposted (line 453) | def crossposted(self):
    method is_crossposted (line 458) | def is_crossposted(self):
    method suppress_embeds (line 463) | def suppress_embeds(self):
    method source_message_deleted (line 468) | def source_message_deleted(self):
    method urgent (line 473) | def urgent(self):
    method has_thread (line 481) | def has_thread(self):
    method ephemeral (line 489) | def ephemeral(self):
    method loading (line 497) | def loading(self):
    method failed_to_mention_some_roles_in_thread (line 506) | def failed_to_mention_some_roles_in_thread(self):
    method suppress_notifications (line 515) | def suppress_notifications(self):
    method silent (line 523) | def silent(self):
    method voice (line 531) | def voice(self):
    method forwarded (line 539) | def forwarded(self):
    method components_v2 (line 547) | def components_v2(self):
  class PublicUserFlags (line 558) | class PublicUserFlags(BaseFlags):
    method staff (line 625) | def staff(self):
    method partner (line 630) | def partner(self):
    method hypesquad (line 635) | def hypesquad(self):
    method bug_hunter (line 640) | def bug_hunter(self):
    method hypesquad_bravery (line 645) | def hypesquad_bravery(self):
    method hypesquad_brilliance (line 650) | def hypesquad_brilliance(self):
    method hypesquad_balance (line 655) | def hypesquad_balance(self):
    method early_supporter (line 660) | def early_supporter(self):
    method team_user (line 665) | def team_user(self):
    method system (line 670) | def system(self):
    method bug_hunter_level_2 (line 675) | def bug_hunter_level_2(self):
    method verified_bot (line 680) | def verified_bot(self):
    method verified_bot_developer (line 685) | def verified_bot_developer(self):
    method early_verified_bot_developer (line 690) | def early_verified_bot_developer(self):
    method discord_certified_moderator (line 698) | def discord_certified_moderator(self):
    method bot_http_interactions (line 706) | def bot_http_interactions(self):
    method spammer (line 715) | def spammer(self):
    method active_developer (line 723) | def active_developer(self):
    method all (line 730) | def all(self) -> List[UserFlags]:
  class Intents (line 736) | class Intents(BaseFlags):
    method __init__ (line 811) | def __init__(self, value: int = 0, **kwargs: Unpack[_IntentsFlagsKwarg...
    method all (line 819) | def all(cls: Type[Intents]) -> Intents:
    method none (line 827) | def none(cls: Type[Intents]) -> Intents:
    method default (line 834) | def default(cls: Type[Intents]) -> Intents:
    method guilds (line 845) | def guilds(self):
    method members (line 875) | def members(self):
    method moderation (line 913) | def moderation(self):
    method bans (line 927) | def bans(self):
    method emojis (line 936) | def emojis(self):
    method emojis_and_stickers (line 945) | def emojis_and_stickers(self):
    method expressions (line 956) | def expressions(self):
    method integrations (line 987) | def integrations(self):
    method webhooks (line 1002) | def webhooks(self):
    method invites (line 1014) | def invites(self):
    method voice_states (line 1027) | def voice_states(self):
    method presences (line 1047) | def presences(self):
    method messages (line 1070) | def messages(self):
    method guild_messages (line 1097) | def guild_messages(self):
    method dm_messages (line 1124) | def dm_messages(self):
    method reactions (line 1151) | def reactions(self):
    method guild_reactions (line 1172) | def guild_reactions(self):
    method dm_reactions (line 1193) | def dm_reactions(self):
    method typing (line 1214) | def typing(self):
    method guild_typing (line 1228) | def guild_typing(self):
    method dm_typing (line 1242) | def dm_typing(self):
    method message_content (line 1256) | def message_content(self):
    method guild_scheduled_events (line 1283) | def guild_scheduled_events(self):
    method auto_moderation (line 1299) | def auto_moderation(self):
    method auto_moderation_configuration (line 1317) | def auto_moderation_configuration(self):
    method auto_moderation_execution (line 1331) | def auto_moderation_execution(self):
    method polls (line 1342) | def polls(self):
    method guild_polls (line 1359) | def guild_polls(self):
    method dm_polls (line 1376) | def dm_polls(self):
  class MemberCacheFlags (line 1394) | class MemberCacheFlags(BaseFlags):
    method __init__ (line 1472) | def __init__(self, **kwargs: Unpack[_MemberCacheFlagsKwargs]) -> None:
    method all (line 1481) | def all(cls: Type[MemberCacheFlags]) -> MemberCacheFlags:
    method none (line 1490) | def none(cls: Type[MemberCacheFlags]) -> MemberCacheFlags:
    method _empty (line 1497) | def _empty(self):
    method voice (line 1501) | def voice(self):
    method joined (line 1511) | def joined(self):
    method from_intents (line 1522) | def from_intents(cls: Type[MemberCacheFlags], intents: Intents) -> Mem...
    method _verify_intents (line 1545) | def _verify_intents(self, intents: Intents):
    method _voice_only (line 1553) | def _voice_only(self):
  class ApplicationFlags (line 1558) | class ApplicationFlags(BaseFlags):
    method auto_mod_badge (line 1620) | def auto_mod_badge(self):
    method gateway_presence (line 1629) | def gateway_presence(self):
    method gateway_presence_limited (line 1636) | def gateway_presence_limited(self):
    method gateway_guild_members (line 1643) | def gateway_guild_members(self):
    method gateway_guild_members_limited (line 1650) | def gateway_guild_members_limited(self):
    method verification_pending_guild_limit (line 1657) | def verification_pending_guild_limit(self):
    method embedded (line 1664) | def embedded(self):
    method gateway_message_content (line 1669) | def gateway_message_content(self):
    method gateway_message_content_limited (line 1675) | def gateway_message_content_limited(self):
    method app_commands_badge (line 1681) | def app_commands_badge(self):
    method active (line 1687) | def active(self):
  class ChannelFlags (line 1697) | class ChannelFlags(BaseFlags):
    method pinned (line 1759) | def pinned(self):
    method require_tag (line 1764) | def require_tag(self):
    method hide_media_download_options (line 1773) | def hide_media_download_options(self):
  class ArrayFlags (line 1782) | class ArrayFlags(BaseFlags):
    method _from_value (line 1784) | def _from_value(cls: Type[Self], value: Sequence[int]) -> Self:
    method to_array (line 1797) | def to_array(self, *, offset: int = 0) -> List[int]:
    method all (line 1801) | def all(cls: Type[Self]) -> Self:
    method none (line 1810) | def none(cls: Type[Self]) -> Self:
  class AutoModPresets (line 1818) | class AutoModPresets(ArrayFlags):
    method to_array (line 1881) | def to_array(self) -> List[int]:
    method profanity (line 1885) | def profanity(self):
    method sexual_content (line 1890) | def sexual_content(self):
    method slurs (line 1895) | def slurs(self):
  class AppCommandContext (line 1901) | class AppCommandContext(ArrayFlags):
    method guild (line 1958) | def guild(self):
    method dm_channel (line 1963) | def dm_channel(self):
    method private_channel (line 1968) | def private_channel(self):
  class AppInstallationType (line 1974) | class AppInstallationType(ArrayFlags):
    method guild (line 2029) | def guild(self):
    method user (line 2034) | def user(self):
  class MemberFlags (line 2040) | class MemberFlags(BaseFlags):
    method did_rejoin (line 2097) | def did_rejoin(self):
    method completed_onboarding (line 2102) | def completed_onboarding(self):
    method bypasses_verification (line 2107) | def bypasses_verification(self):
    method started_onboarding (line 2112) | def started_onboarding(self):
    method guest (line 2117) | def guest(self):
    method started_home_actions (line 2126) | def started_home_actions(self):
    method completed_home_actions (line 2134) | def completed_home_actions(self):
    method automod_quarantined_username (line 2142) | def automod_quarantined_username(self):
    method automod_quarantined_guild_tag (line 2151) | def automod_quarantined_guild_tag(self):
    method dm_settings_upsell_acknowledged (line 2160) | def dm_settings_upsell_acknowledged(self):
  class AttachmentFlags (line 2169) | class AttachmentFlags(BaseFlags):
    method clip (line 2226) | def clip(self):
    method thumbnail (line 2231) | def thumbnail(self):
    method remix (line 2236) | def remix(self):
    method spoiler (line 2241) | def spoiler(self):
    method contains_explicit_media (line 2249) | def contains_explicit_media(self):
    method animated (line 2257) | def animated(self):
  class RoleFlags (line 2266) | class RoleFlags(BaseFlags):
    method in_prompt (line 2323) | def in_prompt(self):
  class SKUFlags (line 2329) | class SKUFlags(BaseFlags):
    method available (line 2386) | def available(self):
    method guild_subscription (line 2391) | def guild_subscription(self):
    method user_subscription (line 2396) | def user_subscription(self):
  class EmbedFlags (line 2402) | class EmbedFlags(BaseFlags):
    method contains_explicit_media (line 2453) | def contains_explicit_media(self):
    method content_inventory_entry (line 2458) | def content_inventory_entry(self):
  class InviteFlags (line 2466) | class InviteFlags(BaseFlags):
    method guest (line 2517) | def guest(self):

FILE: discord/gateway.py
  class ReconnectWebSocket (line 70) | class ReconnectWebSocket(Exception):
    method __init__ (line 73) | def __init__(self, shard_id: Optional[int], *, resume: bool = True) ->...
  class WebSocketClosure (line 79) | class WebSocketClosure(Exception):
  class EventListener (line 85) | class EventListener(NamedTuple):
  class GatewayRatelimiter (line 92) | class GatewayRatelimiter:
    method __init__ (line 93) | def __init__(self, count: int = 110, per: float = 60.0) -> None:
    method is_ratelimited (line 102) | def is_ratelimited(self) -> bool:
    method get_delay (line 108) | def get_delay(self) -> float:
    method block (line 123) | async def block(self) -> None:
  class KeepAliveHandler (line 131) | class KeepAliveHandler(threading.Thread):
    method __init__ (line 132) | def __init__(
    method run (line 157) | def run(self) -> None:
    method get_payload (line 201) | def get_payload(self) -> Dict[str, Any]:
    method stop (line 207) | def stop(self) -> None:
    method tick (line 210) | def tick(self) -> None:
    method beat (line 213) | def beat(self) -> Dict[str, Any]:
    method ack (line 217) | def ack(self) -> None:
  class VoiceKeepAliveHandler (line 225) | class VoiceKeepAliveHandler(KeepAliveHandler):
    method __init__ (line 229) | def __init__(self, *args: Any, **kwargs: Any) -> None:
    method get_payload (line 237) | def get_payload(self) -> Dict[str, Any]:
    method ack (line 246) | def ack(self) -> None:
  class DiscordClientWebSocketResponse (line 254) | class DiscordClientWebSocketResponse(aiohttp.ClientWebSocketResponse):
    method close (line 255) | async def close(self, *, code: int = 4000, message: bytes = b'') -> bool:
  class DiscordWebSocket (line 262) | class DiscordWebSocket:
    method __init__ (line 330) | def __init__(self, socket: aiohttp.ClientWebSocketResponse, *, loop: a...
    method open (line 350) | def open(self) -> bool:
    method is_ratelimited (line 353) | def is_ratelimited(self) -> bool:
    method debug_log_receive (line 356) | def debug_log_receive(self, data: Dict[str, Any], /) -> None:
    method log_receive (line 359) | def log_receive(self, _: Dict[str, Any], /) -> None:
    method from_client (line 363) | async def from_client(
    method wait_for (line 428) | def wait_for(
    method identify (line 458) | async def identify(self) -> None:
    method resume (line 493) | async def resume(self) -> None:
    method received_message (line 507) | async def received_message(self, msg: Any, /) -> None:
    method latency (line 619) | def latency(self) -> float:
    method _can_handle_close (line 624) | def _can_handle_close(self) -> bool:
    method poll_event (line 631) | async def poll_event(self) -> None:
    method debug_send (line 670) | async def debug_send(self, data: str, /) -> None:
    method send (line 675) | async def send(self, data: str, /) -> None:
    method send_as_json (line 679) | async def send_as_json(self, data: Any) -> None:
    method send_heartbeat (line 686) | async def send_heartbeat(self, data: Any) -> None:
    method change_presence (line 694) | async def change_presence(
    method request_chunks (line 725) | async def request_chunks(
    method voice_state (line 755) | async def voice_state(
    method close (line 775) | async def close(self, code: int = 4000) -> None:
  class DiscordVoiceWebSocket (line 787) | class DiscordVoiceWebSocket:
    method __init__ (line 851) | def __init__(
    method _hook (line 868) | async def _hook(self, *args: Any) -> None:
    method send_as_json (line 871) | async def send_as_json(self, data: Any) -> None:
    method send_binary (line 875) | async def send_binary(self, opcode: int, data: bytes) -> None:
    method resume (line 881) | async def resume(self) -> None:
    method identify (line 894) | async def identify(self) -> None:
    method from_connection_state (line 909) | async def from_connection_state(
    method select_protocol (line 936) | async def select_protocol(self, ip: str, port: int, mode: str) -> None:
    method client_connect (line 951) | async def client_connect(self) -> None:
    method speak (line 961) | async def speak(self, state: SpeakingState = SpeakingState.voice) -> N...
    method send_transition_ready (line 973) | async def send_transition_ready(self, transition_id: int):
    method received_message (line 983) | async def received_message(self, msg: Dict[str, Any]) -> None:
    method received_binary_message (line 1034) | async def received_binary_message(self, msg: bytes) -> None:
    method initial_connection (line 1078) | async def initial_connection(self, data: Dict[str, Any]) -> None:
    method discover_ip (line 1096) | async def discover_ip(self) -> Tuple[str, int]:
    method latency (line 1129) | def latency(self) -> float:
    method average_latency (line 1135) | def average_latency(self) -> float:
    method load_secret_key (line 1143) | async def load_secret_key(self, data: Dict[str, Any]) -> None:
    method poll_event (line 1152) | async def poll_event(self) -> None:
    method close (line 1166) | async def close(self, code: int = 1000) -> None:

FILE: discord/guild.py
  class BanEntry (line 150) | class BanEntry(NamedTuple):
  class BulkBanResult (line 155) | class BulkBanResult(NamedTuple):
  class _GuildLimit (line 160) | class _GuildLimit(NamedTuple):
  class GuildPreview (line 167) | class GuildPreview(Hashable):
    method __init__ (line 225) | def __init__(self, *, data: GuildPreviewPayload, state: ConnectionStat...
    method __str__ (line 246) | def __str__(self) -> str:
    method __repr__ (line 249) | def __repr__(self) -> str:
    method created_at (line 256) | def created_at(self) -> datetime.datetime:
    method icon (line 261) | def icon(self) -> Optional[Asset]:
    method splash (line 268) | def splash(self) -> Optional[Asset]:
    method discovery_splash (line 275) | def discovery_splash(self) -> Optional[Asset]:
  class Guild (line 282) | class Guild(Hashable):
    method __init__ (line 462) | def __init__(self, *, data: GuildPayload, state: ConnectionState) -> N...
    method _add_channel (line 474) | def _add_channel(self, channel: GuildChannel, /) -> None:
    method _remove_channel (line 477) | def _remove_channel(self, channel: Snowflake, /) -> None:
    method _voice_state_for (line 480) | def _voice_state_for(self, user_id: int, /) -> Optional[VoiceState]:
    method _add_member (line 483) | def _add_member(self, member: Member, /) -> None:
    method _store_thread (line 486) | def _store_thread(self, payload: ThreadPayload, /) -> Thread:
    method _remove_member (line 491) | def _remove_member(self, member: Snowflake, /) -> None:
    method _add_thread (line 494) | def _add_thread(self, thread: Thread, /) -> None:
    method _remove_thread (line 497) | def _remove_thread(self, thread: Snowflake, /) -> None:
    method _clear_threads (line 500) | def _clear_threads(self) -> None:
    method _remove_threads_by_channel (line 503) | def _remove_threads_by_channel(self, channel_id: int) -> List[Thread]:
    method _filter_threads (line 509) | def _filter_threads(self, channel_ids: Set[int]) -> Dict[int, Thread]:
    method _add_soundboard_sound (line 515) | def _add_soundboard_sound(self, sound: SoundboardSound, /) -> None:
    method _remove_soundboard_sound (line 518) | def _remove_soundboard_sound(self, sound: SoundboardSound, /) -> None:
    method __str__ (line 521) | def __str__(self) -> str:
    method __repr__ (line 524) | def __repr__(self) -> str:
    method _update_voice_state (line 535) | def _update_voice_state(self, data: GuildVoiceState, channel_id: int) ...
    method _add_role (line 563) | def _add_role(self, role: Role, /) -> None:
    method _remove_role (line 566) | def _remove_role(self, role_id: int, /) -> Role:
    method _create_unavailable (line 571) | def _create_unavailable(cls, *, state: ConnectionState, guild_id: int,...
    method _from_data (line 577) | def _from_data(self, guild: GuildPayload) -> None:
    method channels (line 686) | def channels(self) -> Sequence[GuildChannel]:
    method threads (line 691) | def threads(self) -> Sequence[Thread]:
    method large (line 699) | def large(self) -> bool:
    method voice_channels (line 712) | def voice_channels(self) -> List[VoiceChannel]:
    method stage_channels (line 722) | def stage_channels(self) -> List[StageChannel]:
    method me (line 734) | def me(self) -> Member:
    method voice_client (line 743) | def voice_client(self) -> Optional[VoiceProtocol]:
    method text_channels (line 748) | def text_channels(self) -> List[TextChannel]:
    method categories (line 758) | def categories(self) -> List[CategoryChannel]:
    method forums (line 768) | def forums(self) -> List[ForumChannel]:
    method by_category (line 777) | def by_category(self) -> List[ByCategoryItem]:
    method _resolve_channel (line 812) | def _resolve_channel(self, id: Optional[int], /) -> Optional[Union[Gui...
    method get_channel_or_thread (line 818) | def get_channel_or_thread(self, channel_id: int, /) -> Optional[Union[...
    method get_channel (line 835) | def get_channel(self, channel_id: int, /) -> Optional[GuildChannel]:
    method get_thread (line 858) | def get_thread(self, thread_id: int, /) -> Optional[Thread]:
    method get_emoji (line 880) | def get_emoji(self, emoji_id: int, /) -> Optional[Emoji]:
    method afk_channel (line 901) | def afk_channel(self) -> Optional[VocalGuildChannel]:
    method system_channel (line 909) | def system_channel(self) -> Optional[TextChannel]:
    method system_channel_flags (line 918) | def system_channel_flags(self) -> SystemChannelFlags:
    method rules_channel (line 923) | def rules_channel(self) -> Optional[TextChannel]:
    method public_updates_channel (line 935) | def public_updates_channel(self) -> Optional[TextChannel]:
    method safety_alerts_channel (line 948) | def safety_alerts_channel(self) -> Optional[TextChannel]:
    method widget_channel (line 959) | def widget_channel(self) -> Optional[Union[TextChannel, ForumChannel, ...
    method emoji_limit (line 971) | def emoji_limit(self) -> int:
    method sticker_limit (line 977) | def sticker_limit(self) -> int:
    method bitrate_limit (line 986) | def bitrate_limit(self) -> float:
    method filesize_limit (line 992) | def filesize_limit(self) -> int:
    method members (line 997) | def members(self) -> Sequence[Member]:
    method get_member (line 1001) | def get_member(self, user_id: int, /) -> Optional[Member]:
    method premium_subscribers (line 1021) | def premium_subscribers(self) -> List[Member]:
    method roles (line 1026) | def roles(self) -> Sequence[Role]:
    method get_role (line 1034) | def get_role(self, role_id: int, /) -> Optional[Role]:
    method default_role (line 1054) | def default_role(self) -> Role:
    method premium_subscriber_role (line 1060) | def premium_subscriber_role(self) -> Optional[Role]:
    method self_role (line 1071) | def self_role(self) -> Optional[Role]:
    method stage_instances (line 1084) | def stage_instances(self) -> Sequence[StageInstance]:
    method get_stage_instance (line 1092) | def get_stage_instance(self, stage_instance_id: int, /) -> Optional[St...
    method scheduled_events (line 1110) | def scheduled_events(self) -> Sequence[ScheduledEvent]:
    method get_scheduled_event (line 1117) | def get_scheduled_event(self, scheduled_event_id: int, /) -> Optional[...
    method soundboard_sounds (line 1135) | def soundboard_sounds(self) -> Sequence[SoundboardSound]:
    method get_soundboard_sound (line 1142) | def get_soundboard_sound(self, sound_id: int, /) -> Optional[Soundboar...
    method _resolve_soundboard_sound (line 1159) | def _resolve_soundboard_sound(self, id: Optional[int], /) -> Optional[...
    method owner (line 1166) | def owner(self) -> Optional[Member]:
    method 
Condensed preview — 278 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (6,625K chars).
[
  {
    "path": ".git-blame-ignore-revs",
    "chars": 95,
    "preview": "# Replace Black with Ruff, then format whole project.\n44a44e938fb2bd0bb085d8aa4577abeb01653ad3\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 3884,
    "preview": "## Contributing to discord.py\n\nFirst off, thanks for taking the time to contribute. It makes the library substantially b"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 27,
    "preview": "open_collective: discordpy\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "chars": 2372,
    "preview": "name: Bug Report\ndescription: Report broken or incorrect behaviour\nlabels: unconfirmed bug\nbody:\n  - type: markdown\n    "
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 339,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: Ask a question\n    about: Ask questions and discuss with other user"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.yml",
    "chars": 1341,
    "preview": "name: Feature Request\ndescription: Suggest a feature for this library\nlabels: feature request\nbody:\n  - type: input\n    "
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 523,
    "preview": "## Summary\n\n<!-- What is this pull request for? Does it fix any issues? -->\n\n## Checklist\n\n<!-- Put an x inside [ ] to c"
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 1528,
    "preview": "name: build\n\non:\n  push:\n  pull_request:\n    types: [ opened, reopened, synchronize ]\n\njobs:\n  dists-and-docs:\n    runs-"
  },
  {
    "path": ".github/workflows/crowdin_download.yml",
    "chars": 2442,
    "preview": "name: crowdin download\n\non:\n  schedule:\n    - cron: '0 18 * * 1'\n  workflow_dispatch:\n\njobs:\n  check-environment:\n    ru"
  },
  {
    "path": ".github/workflows/crowdin_upload.yml",
    "chars": 1105,
    "preview": "name: crowdin upload\n\non:\n  workflow_dispatch:\n\njobs:\n  upload:\n    runs-on: ubuntu-latest\n    environment: Crowdin\n    "
  },
  {
    "path": ".github/workflows/lint.yml",
    "chars": 1213,
    "preview": "name: lint\n\non:\n  push:\n  pull_request:\n    types: [ opened, reopened, synchronize ]\n\njobs:\n  check:\n    runs-on: ubuntu"
  },
  {
    "path": ".github/workflows/scripts/close_and_reopen_pr.js",
    "chars": 677,
    "preview": "module.exports = (async function ({github, context}) {\n    const pr_number = process.env.PR_NUMBER;\n    const pr_operati"
  },
  {
    "path": ".github/workflows/test.yml",
    "chars": 766,
    "preview": "name: test\n\non:\n  push:\n  pull_request:\n    types: [ opened, reopened, synchronize ]\n\njobs:\n  pytest:\n    runs-on: ubunt"
  },
  {
    "path": ".gitignore",
    "chars": 167,
    "preview": "*.json\n*.py[cod]\n*.log\n*.egg-info\nvenv\n.venv\ndocs/_build\ndocs/crowdin.py\n*.buildinfo\n*.mp3\n*.m4a\n*.wav\n*.png\n*.jpg\n*.fla"
  },
  {
    "path": ".readthedocs.yml",
    "chars": 252,
    "preview": "version: 2\nformats: []\n\nbuild:\n  os: \"ubuntu-22.04\"\n  tools:\n    python: \"3.8\"\n\nsphinx:\n  configuration: docs/conf.py\n  "
  },
  {
    "path": "LICENSE",
    "chars": 1081,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any person ob"
  },
  {
    "path": "MANIFEST.in",
    "chars": 107,
    "preview": "include README.rst\ninclude LICENSE\ninclude requirements.txt\ninclude discord/bin/*\ninclude discord/py.typed\n"
  },
  {
    "path": "README.ja.rst",
    "chars": 2508,
    "preview": "discord.py\n==========\n\n.. image:: https://discord.com/api/guilds/336642139381301249/embed.png\n   :target: https://discor"
  },
  {
    "path": "README.rst",
    "chars": 3199,
    "preview": "discord.py\n==========\n\n.. image:: https://discord.com/api/guilds/336642139381301249/embed.png\n   :target: https://discor"
  },
  {
    "path": "discord/__init__.py",
    "chars": 2417,
    "preview": "\"\"\"\nDiscord API Wrapper\n~~~~~~~~~~~~~~~~~~~\n\nA basic wrapper for the Discord API.\n\n:copyright: (c) 2015-present Rapptz\n:"
  },
  {
    "path": "discord/__main__.py",
    "chars": 11529,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/_types.py",
    "chars": 1410,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/abc.py",
    "chars": 74433,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/activity.py",
    "chars": 29774,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/__init__.py",
    "chars": 448,
    "preview": "\"\"\"\ndiscord.app_commands\n~~~~~~~~~~~~~~~~~~~~~\n\nApplication commands support for the Discord API\n\n:copyright: (c) 2015-p"
  },
  {
    "path": "discord/app_commands/checks.py",
    "chars": 18183,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/commands.py",
    "chars": 111422,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/errors.py",
    "chars": 18787,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/installs.py",
    "chars": 7410,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/models.py",
    "chars": 45921,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/namespace.py",
    "chars": 13043,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/transformers.py",
    "chars": 33826,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/translator.py",
    "chars": 10691,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/app_commands/tree.py",
    "chars": 50788,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/appinfo.py",
    "chars": 25463,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/asset.py",
    "chars": 17218,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/audit_logs.py",
    "chars": 42119,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/automod.py",
    "chars": 26916,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/backoff.py",
    "chars": 3727,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/bin/COPYING",
    "chars": 1487,
    "preview": "Copyright (c) 1994-2013 Xiph.Org Foundation and contributors\n\nRedistribution and use in source and binary forms, with or"
  },
  {
    "path": "discord/channel.py",
    "chars": 129132,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/client.py",
    "chars": 106299,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/collectible.py",
    "chars": 3562,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/colour.py",
    "chars": 16246,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/components.py",
    "chars": 55420,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/context_managers.py",
    "chars": 3032,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/embeds.py",
    "chars": 24111,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/emoji.py",
    "chars": 10426,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/enums.py",
    "chars": 30103,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/errors.py",
    "chars": 10027,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/__init__.py",
    "chars": 437,
    "preview": "\"\"\"\ndiscord.ext.commands\n~~~~~~~~~~~~~~~~~~~~~\n\nAn extension module to facilitate creation of bot commands.\n\n:copyright:"
  },
  {
    "path": "discord/ext/commands/_types.py",
    "chars": 2628,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/bot.py",
    "chars": 54429,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/cog.py",
    "chars": 31833,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/context.py",
    "chars": 42933,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/converter.py",
    "chars": 50096,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/cooldowns.py",
    "chars": 9719,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/core.py",
    "chars": 91003,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/errors.py",
    "chars": 36844,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/flags.py",
    "chars": 25272,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/help.py",
    "chars": 59009,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/hybrid.py",
    "chars": 39907,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/parameters.py",
    "chars": 9625,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/commands/view.py",
    "chars": 6185,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ext/tasks/__init__.py",
    "chars": 30878,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/file.py",
    "chars": 5930,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/flags.py",
    "chars": 72778,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/gateway.py",
    "chars": 42467,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/guild.py",
    "chars": 175489,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/http.py",
    "chars": 105000,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/integrations.py",
    "chars": 13801,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/interactions.py",
    "chars": 60728,
    "preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, fre"
  },
  {
    "path": "discord/invite.py",
    "chars": 21227,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/member.py",
    "chars": 46313,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/mentions.py",
    "chars": 5592,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/message.py",
    "chars": 113053,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/mixins.py",
    "chars": 1485,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/object.py",
    "chars": 3720,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/oggparse.py",
    "chars": 3654,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/onboarding.py",
    "chars": 13203,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/opus.py",
    "chars": 16360,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/partial_emoji.py",
    "chars": 8754,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/permissions.py",
    "chars": 37467,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/player.py",
    "chars": 32018,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/poll.py",
    "chars": 20769,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/presences.py",
    "chars": 5858,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/primary_guild.py",
    "chars": 3537,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/py.typed",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "discord/raw_models.py",
    "chars": 20082,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/reaction.py",
    "chars": 9623,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/role.py",
    "chars": 25149,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/scheduled_event.py",
    "chars": 23589,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/shard.py",
    "chars": 23070,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/sku.py",
    "chars": 12121,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/soundboard.py",
    "chars": 10330,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/stage_instance.py",
    "chars": 6498,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/state.py",
    "chars": 83388,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/sticker.py",
    "chars": 16022,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/subscription.py",
    "chars": 4109,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/team.py",
    "chars": 5012,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/template.py",
    "chars": 9563,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/threads.py",
    "chars": 33180,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/__init__.py",
    "chars": 149,
    "preview": "\"\"\"\ndiscord.types\n~~~~~~~~~~~~~~\n\nTypings for the Discord API\n\n:copyright: (c) 2015-present Rapptz\n:license: MIT, see LI"
  },
  {
    "path": "discord/types/activity.py",
    "chars": 2903,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/appinfo.py",
    "chars": 2812,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/audit_log.py",
    "chars": 9500,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/automod.py",
    "chars": 4047,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/channel.py",
    "chars": 5386,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/command.py",
    "chars": 6457,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/components.py",
    "chars": 6678,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/embed.py",
    "chars": 2142,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/emoji.py",
    "chars": 1602,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/gateway.py",
    "chars": 9562,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/guild.py",
    "chars": 5814,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/integration.py",
    "chars": 2288,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/interactions.py",
    "chars": 11615,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/invite.py",
    "chars": 2837,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/member.py",
    "chars": 2152,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/message.py",
    "chars": 6002,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/onboarding.py",
    "chars": 2150,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/poll.py",
    "chars": 2374,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/role.py",
    "chars": 1909,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/scheduled_event.py",
    "chars": 3282,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/sku.py",
    "chars": 1640,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/snowflake.py",
    "chars": 1182,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/soundboard.py",
    "chars": 1710,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/sticker.py",
    "chars": 2260,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/subscription.py",
    "chars": 1560,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/team.py",
    "chars": 1561,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/template.py",
    "chars": 1609,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/threads.py",
    "chars": 2482,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/user.py",
    "chars": 2352,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/voice.py",
    "chars": 2322,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/webhook.py",
    "chars": 1974,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/welcome_screen.py",
    "chars": 1460,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/types/widget.py",
    "chars": 1883,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/__init__.py",
    "chars": 602,
    "preview": "\"\"\"\ndiscord.ui\n~~~~~~~~~~~\n\nBot UI Kit helper for the Discord API\n\n:copyright: (c) 2015-present Rapptz\n:license: MIT, se"
  },
  {
    "path": "discord/ui/action_row.py",
    "chars": 23007,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/button.py",
    "chars": 13640,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/checkbox.py",
    "chars": 12698,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/container.py",
    "chars": 12204,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/dynamic.py",
    "chars": 8285,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/file.py",
    "chars": 5295,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/file_upload.py",
    "chars": 6675,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/item.py",
    "chars": 8464,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/label.py",
    "chars": 4404,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/media_gallery.py",
    "chars": 8096,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/modal.py",
    "chars": 9091,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/radio.py",
    "chars": 7896,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/section.py",
    "chars": 8424,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/select.py",
    "chars": 48806,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/separator.py",
    "chars": 3930,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/text_display.py",
    "chars": 2771,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/text_input.py",
    "chars": 9241,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/thumbnail.py",
    "chars": 4767,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/ui/view.py",
    "chars": 38292,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/user.py",
    "chars": 19524,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/utils.py",
    "chars": 47690,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/voice_client.py",
    "chars": 21541,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/voice_state.py",
    "chars": 32066,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/webhook/__init__.py",
    "chars": 182,
    "preview": "\"\"\"\ndiscord.webhook\n~~~~~~~~~~~~~~\n\nWebhook support\n\n:copyright: (c) 2015-present Rapptz\n:license: MIT, see LICENSE for "
  },
  {
    "path": "discord/webhook/async_.py",
    "chars": 75180,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/webhook/sync.py",
    "chars": 48401,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "discord/welcome_screen.py",
    "chars": 7532,
    "preview": "# -*- coding: utf-8 -*-\n\n\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, fre"
  },
  {
    "path": "discord/widget.py",
    "chars": 10475,
    "preview": "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015-present Rapptz\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "docs/Makefile",
    "chars": 7064,
    "preview": "# Makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line.\nSPHINXOPTS    =\nSPHINXBUILD "
  },
  {
    "path": "docs/_static/codeblocks.css",
    "chars": 10603,
    "preview": "/* light theme: default */\n.highlight .hll { background-color: #ffffcc }\n.highlight  { background: #f0f0f0; }\n.highlight"
  },
  {
    "path": "docs/_static/copy.js",
    "chars": 1161,
    "preview": "const COPY = \"content_copy\";\nconst COPIED = \"done\";\n\nconst copy = async (obj) => {\n  // <span class=\"copy\"><span class=\""
  },
  {
    "path": "docs/_static/custom.js",
    "chars": 2768,
    "preview": "'use-strict';\n\nlet activeModal = null;\nlet bottomHeightThreshold, sections;\nlet hamburgerToggle;\nlet mobileSearch;\nlet s"
  },
  {
    "path": "docs/_static/icons.css",
    "chars": 201,
    "preview": "@font-face {\n    font-family: 'Custom Icons';\n    font-style: normal;\n    font-weight: 400;\n    src: url('icons.woff') f"
  },
  {
    "path": "docs/_static/scorer.js",
    "chars": 2506,
    "preview": "'use-strict';\n\nlet queryBeingDone = null;\nlet pattern = null;\n\nconst escapedRegex = /[-\\/\\\\^$*+?.()|[\\]{}]/g;\nfunction e"
  },
  {
    "path": "docs/_static/settings.js",
    "chars": 2551,
    "preview": "'use-strict';\n\nlet settingsModal;\n\nclass Setting {\n  constructor(name, defaultValue, setter) {\n    this.name = name;\n   "
  },
  {
    "path": "docs/_static/sidebar.js",
    "chars": 3848,
    "preview": "class Sidebar {\n  constructor(element) {\n    this.element = element;\n    this.activeLink = null;\n\n    this.element.addEv"
  },
  {
    "path": "docs/_static/style.css",
    "chars": 27415,
    "preview": "/*\nThis theme was created from scratch.\nHistorically however, thanks to:\n- Alabaster for being a good base\n  - Which tha"
  },
  {
    "path": "docs/_templates/genindex.html",
    "chars": 755,
    "preview": "{%- extends \"basic/genindex.html\" %}\n\n{% block body %}\n  {{ super() }}\n  <!-- Inject some JavaScript to convert the inde"
  },
  {
    "path": "docs/_templates/gettext/message.pot_t",
    "chars": 879,
    "preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) {{ copyright }}\n# This file is distributed under the same license as the {{ pr"
  },
  {
    "path": "docs/_templates/layout.html",
    "chars": 9214,
    "preview": "<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scal"
  },
  {
    "path": "docs/_templates/relations.html",
    "chars": 28,
    "preview": "<!-- purposefully empty -->\n"
  },
  {
    "path": "docs/api.rst",
    "chars": 161680,
    "preview": ".. currentmodule:: discord\n\nAPI Reference\n===============\n\nThe following section outlines the API of discord.py.\n\n.. not"
  },
  {
    "path": "docs/conf.py",
    "chars": 11926,
    "preview": "#\n# discord.py documentation build configuration file, created by\n# sphinx-quickstart on Fri Aug 21 05:43:30 2015.\n#\n# T"
  },
  {
    "path": "docs/crowdin.yml",
    "chars": 941,
    "preview": "# -*- coding: utf-8 -*-\n\nproject_id: \"362783\"\napi_token_env: CROWDIN_API_KEY\n\nfiles:\n  - source: /_build/locale/**/*.pot"
  },
  {
    "path": "docs/discord.rst",
    "chars": 3665,
    "preview": ":orphan:\n\n.. _discord-intro:\n\nCreating a Bot Account\n========================\n\nIn order to work with the library and the"
  },
  {
    "path": "docs/ext/commands/api.rst",
    "chars": 22106,
    "preview": ".. currentmodule:: discord\n\nAPI Reference\n===============\n\nThe following section outlines the API of discord.py's comman"
  },
  {
    "path": "docs/ext/commands/cogs.rst",
    "chars": 5776,
    "preview": ".. currentmodule:: discord\n\n.. _ext_commands_cogs:\n\nCogs\n======\n\nThere comes a point in your bot's development when you "
  },
  {
    "path": "docs/ext/commands/commands.rst",
    "chars": 47126,
    "preview": ".. currentmodule:: discord\n\n.. _ext_commands_commands:\n\nCommands\n==========\n\nOne of the most appealing aspects of the co"
  },
  {
    "path": "docs/ext/commands/extensions.rst",
    "chars": 2676,
    "preview": ".. currentmodule:: discord\n\n.. _ext_commands_extensions:\n\nExtensions\n=============\n\nThere comes a time in the bot develo"
  },
  {
    "path": "docs/ext/commands/index.rst",
    "chars": 629,
    "preview": ".. _discord_ext_commands:\n\n``discord.ext.commands`` -- Bot commands framework\n=========================================="
  },
  {
    "path": "docs/ext/tasks/index.rst",
    "chars": 5377,
    "preview": ".. _discord_ext_tasks:\n\n``discord.ext.tasks`` -- asyncio.Task helpers\n=================================================="
  },
  {
    "path": "docs/extensions/attributetable.py",
    "chars": 9721,
    "preview": "from __future__ import annotations\nimport importlib\nimport inspect\nimport re\nfrom typing import Dict, List, NamedTuple, "
  },
  {
    "path": "docs/extensions/builder.py",
    "chars": 5289,
    "preview": "from sphinx.builders.html import StandaloneHTMLBuilder\nfrom sphinx.builders.gettext import MessageCatalogBuilder, I18nBu"
  },
  {
    "path": "docs/extensions/colour_preview.py",
    "chars": 1233,
    "preview": "from __future__ import annotations\nfrom typing import Dict, Any\n\nfrom sphinx.util.docutils import SphinxDirective\nfrom d"
  },
  {
    "path": "docs/extensions/details.py",
    "chars": 1740,
    "preview": "from docutils.parsers.rst import Directive\nfrom docutils.parsers.rst import states, directives\nfrom docutils.parsers.rst"
  },
  {
    "path": "docs/extensions/exception_hierarchy.py",
    "chars": 1006,
    "preview": "from docutils.parsers.rst import Directive\nfrom docutils.parsers.rst import states, directives\nfrom docutils.parsers.rst"
  },
  {
    "path": "docs/extensions/nitpick_file_ignorer.py",
    "chars": 724,
    "preview": "import logging\n\nfrom sphinx.application import Sphinx\nfrom sphinx.util import logging as sphinx_logging\n\n\nclass NitpickF"
  },
  {
    "path": "docs/extensions/resourcelinks.py",
    "chars": 1411,
    "preview": "# Credit to sphinx.ext.extlinks for being a good starter\n# Copyright 2007-2020 by the Sphinx team\n# Licensed under BSD.\n"
  },
  {
    "path": "docs/faq.rst",
    "chars": 21020,
    "preview": ":orphan:\n\n.. currentmodule:: discord\n.. _faq:\n\nFrequently Asked Questions\n===========================\n\nThis is a list of"
  },
  {
    "path": "docs/index.rst",
    "chars": 2074,
    "preview": ".. discord.py documentation master file, created by\n   sphinx-quickstart on Fri Aug 21 05:43:30 2015.\n   You can adapt t"
  },
  {
    "path": "docs/intents.rst",
    "chars": 10380,
    "preview": ":orphan:\n\n.. currentmodule:: discord\n.. versionadded:: 1.5\n.. _intents_primer:\n\nA Primer to Gateway Intents\n============"
  },
  {
    "path": "docs/interactions/api.rst",
    "chars": 26161,
    "preview": ".. currentmodule:: discord\n\nInteractions API Reference\n============================\n\nThe following section outlines the "
  },
  {
    "path": "docs/intro.rst",
    "chars": 3197,
    "preview": ":orphan:\n\n.. currentmodule:: discord\n\n.. _intro:\n\nIntroduction\n==============\n\nThis is the documentation for discord.py,"
  }
]

// ... and 78 more files (download for full content)

About this extraction

This page contains the full source code of the Rapptz/discord.py GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 278 files (6.1 MB), approximately 1.6M tokens, and a symbol index with 5690 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!