Skip to content

Commit

Permalink
Trunk/docs (Pycord-Development#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby authored Jan 24, 2022
1 parent 06b5601 commit c213a75
Show file tree
Hide file tree
Showing 91 changed files with 1,280 additions and 36,548 deletions.
3 changes: 1 addition & 2 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
| Version | Supported |
| ------- | ------------------ |
| 2.0.0 | :white_check_mark: |
| 1.7.x | :white_check_mark: |
| < 1.7.3 | :x: |
| <2.0.0 | :x: |

## Reporting a Vulnerability

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docs

on: [push, pull_request]

jobs:
docs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U sphinx sphinxcontrib-trio aiohttp sphinxcontrib-websupport myst-parser
- name: Compile to html
run: |
cd docs
make html
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ docs/crowdin.py
*.mp3
*.m4a
*.wav
*.png
*.jpg
*.flac
*.mo
.idea/
env/
.vs/
.DS_Store
.python-version
__pycache__
.vs/slnx.sqlite
env/
build/
node_modules/*
test.py
*.png
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sphinx:
builder: html

python:
version: 3.8
version: "3.8"
install:
- method: pip
path: .
Expand Down
119 changes: 0 additions & 119 deletions README.ja.rst

This file was deleted.

5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ Rapptz, also known as Danny, the maintainer and core developer of discord.py wil

Pycord v1.7.3 is the same as discord.py v1.7.3, however, Pycord v2.0 will support newer features of the API such as slash commands, context menus, scheduled events, timeouts, and others.


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

- Modern Pythonic API using ``async`` and ``await``.
- Proper rate limit handling.
- Optimised for both speed and memory usage.
- Supports Slash Commands, Context Menus and Message Components.
- Full Application Command Support

Installing
----------
Expand Down Expand Up @@ -86,7 +85,7 @@ Optional Packages
Please note that while installing voice support on Linux, you must install the following packages via your preferred package manager (e.g. ``apt``, ``dnf``, etc) BEFORE running the above commands:

* libffi-dev (or ``libffi-devel`` on some systems)
* python-dev (e.g. ``python3.6-dev`` for Python 3.6)
* python-dev (e.g. ``python3.10-dev`` for Python 3.10)

Quick Example
-------------
Expand Down
2 changes: 1 addition & 1 deletion discord/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'CustomActivity',
)

"""If curious, this is the current schema for an activity.
"""If you're curious, this is the current schema for an activity.
It's fairly long so I will document it here:
Expand Down
2 changes: 1 addition & 1 deletion discord/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def with_format(self, format: ValidAssetFormatTypes, /) -> Asset:
Raises
-------
InvalidArgument
The asset had an invalid format.
The asset has an invalid format.
Returns
--------
Expand Down
58 changes: 23 additions & 35 deletions discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
import asyncio
import collections
import inspect
import sys
import traceback
from .commands.errors import CheckFailure

from typing import (
Any,
Callable,
Expand All @@ -43,11 +42,8 @@
Union,
)

import sys

from .client import Client
from .shard import AutoShardedClient
from .utils import MISSING, get, find, async_all
from .cog import CogMixin
from .commands import (
SlashCommand,
SlashCommandGroup,
Expand All @@ -58,10 +54,11 @@
AutocompleteContext,
command,
)
from .cog import CogMixin

from .commands.errors import CheckFailure
from .errors import Forbidden, DiscordException
from .interactions import Interaction
from .shard import AutoShardedClient
from .utils import MISSING, get, find, async_all
from .enums import InteractionType
from .user import User

Expand Down Expand Up @@ -819,17 +816,15 @@ async def on_application_command_error(
# TODO: Remove these from commands.Bot

def check(self, func):
r"""A decorator that adds a global check to the bot.
A global check is similar to a :func:`.check` that is applied
on a per command basis except it is run before any command checks
have been verified and applies to every command the bot has.
"""A decorator that adds a global check to the bot. A global check is similar to a :func:`.check` that is
applied on a per command basis except it is run before any command checks have been verified and applies to
every command the bot has.
.. note::
This function can either be a regular function or a coroutine.
Similar to a command :func:`.check`\, this takes a single parameter
of type :class:`.Context` and can only raise exceptions inherited from
:exc:`.CommandError`.
This function can either be a regular function or a coroutine. Similar to a command :func:`.check`, this
takes a single parameter of type :class:`.Context` and can only raise exceptions inherited from
:exc:`.CommandError`.
Example
---------
Expand All @@ -845,17 +840,15 @@ def check_commands(ctx):
return func

def add_check(self, func, *, call_once: bool = False) -> None:
"""Adds a global check to the bot.
This is the non-decorator interface to :meth:`.check`
and :meth:`.check_once`.
"""Adds a global check to the bot. This is the non-decorator interface to :meth:`.check` and
:meth:`.check_once`.
Parameters
-----------
func
The function that was used as a global check.
call_once: :class:`bool`
If the function should only be called once per
:meth:`.invoke` call.
If the function should only be called once per :meth:`.Bot.invoke` call.
"""

Expand Down Expand Up @@ -886,26 +879,21 @@ def remove_check(self, func, *, call_once: bool = False) -> None:
pass

def check_once(self, func):
r"""A decorator that adds a "call once" global check to the bot.
Unlike regular global checks, this one is called only once
per :meth:`.invoke` call.
Regular global checks are called whenever a command is called
or :meth:`.Command.can_run` is called. This type of check
bypasses that and ensures that it's called only once, even inside
the default help command.
"""A decorator that adds a "call once" global check to the bot. Unlike regular global checks, this one is called
only once per :meth:`.Bot.invoke` call. Regular global checks are called whenever a command is called or
:meth:`.Command.can_run` is called. This type of check bypasses that and ensures that it's called only once,
even inside the default help command.
.. note::
When using this function the :class:`.Context` sent to a group subcommand
may only parse the parent command and not the subcommands due to it
being invoked once per :meth:`.Bot.invoke` call.
When using this function the :class:`.Context` sent to a group subcommand may only parse the parent command
and not the subcommands due to it being invoked once per :meth:`.Bot.invoke` call.
.. note::
This function can either be a regular function or a coroutine.
Similar to a command :func:`.check`\, this takes a single parameter
of type :class:`.Context` and can only raise exceptions inherited from
:exc:`.CommandError`.
This function can either be a regular function or a coroutine. Similar to a command :func:`.check`,
this takes a single parameter of type :class:`.Context` and can only raise exceptions inherited from
:exc:`.CommandError`.
Example
---------
Expand Down
4 changes: 2 additions & 2 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def _single_delete_strategy(messages: Iterable[Message]):


class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild text channel.
"""Represents a Discord text channel.
.. container:: operations
Expand Down Expand Up @@ -239,7 +239,7 @@ def is_nsfw(self) -> bool:
return self.nsfw

def is_news(self) -> bool:
""":class:`bool`: Checks if the channel is a news channel."""
""":class:`bool`: Checks if the channel is a news/anouncements channel."""
return self._type == ChannelType.news.value

@property
Expand Down
3 changes: 2 additions & 1 deletion discord/cog.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
Expand Down
Loading

0 comments on commit c213a75

Please sign in to comment.