Browse Source

Finish docs?

pull/10109/head
dolfies 4 years ago
parent
commit
ccd971527f
  1. 21
      discord/flags.py
  2. 2
      discord/settings.py
  3. 1
      discord/user.py
  4. 5
      docs/_templates/layout.html
  5. 61
      docs/api.rst
  6. 18
      docs/conf.py
  7. 6
      docs/quickstart.rst
  8. 1176
      docs/whats_new.rst

21
discord/flags.py

@ -577,7 +577,7 @@ class ApplicationFlags(BaseFlags):
class GuildSubscriptionOptions: class GuildSubscriptionOptions:
"""Controls the library's auto-subscribing feature. r"""Controls the library's auto-subscribing feature.
Subscribing refers to abusing the member sidebar to scrape all* guild Subscribing refers to abusing the member sidebar to scrape all* guild
members. However, you can only request 200 members per OPCode 14. members. However, you can only request 200 members per OPCode 14.
@ -586,8 +586,8 @@ class GuildSubscriptionOptions:
GUILD_MEMBER_LIST_UPDATE. You then also get subsequent GUILD_MEMBER_LIST_UPDATEs GUILD_MEMBER_LIST_UPDATE. You then also get subsequent GUILD_MEMBER_LIST_UPDATEs
that act (kind of) like GUILD_MEMBER_UPDATE/ADD/REMOVEs. that act (kind of) like GUILD_MEMBER_UPDATE/ADD/REMOVEs.
*Discord doesn't provide offline members for "large" guilds. \*Discord doesn't provide offline members for "large" guilds.
*As this is dependent on the member sidebar, guilds that don't have \*As this is dependent on the member sidebar, guilds that don't have
a channel (of any type, surprisingly) that @everyone or some other a channel (of any type, surprisingly) that @everyone or some other
role everyone has can't access don't get the full online member list. role everyone has can't access don't get the full online member list.
@ -608,7 +608,7 @@ class GuildSubscriptionOptions:
self.max_online = max_online self.max_online = max_online
def __repr__(self) -> str: def __repr__(self) -> str:
return '<GuildSubscriptionOptions auto_subscribe={0.auto_subscribe} concurrent_guilds={0.concurrent_guilds} max_online_count={0.max_online_count}' .format(self) return f'<GuildSubscriptionOptions auto_subscribe={self.auto_subscribe} concurrent_guilds={self.concurrent_guilds} max_online_count={self.max_online_count}'
@classmethod @classmethod
def all(cls) -> GuildSubscriptionOptions: def all(cls) -> GuildSubscriptionOptions:
@ -622,7 +622,16 @@ class GuildSubscriptionOptions:
@classmethod @classmethod
def disabled(cls) -> GuildSubscriptionOptions: def disabled(cls) -> GuildSubscriptionOptions:
"""A factory method that creates a :class:`GuildSubscriptionOptions` with subscribing disabled.""" """A factory method that creates a :class:`GuildSubscriptionOptions` with subscribing disabled.
There is an alias for this called :meth`none`.
"""
return cls(auto_subscribe=False) return cls(auto_subscribe=False)
off = disabled @classmethod
def off(cls) -> GuildSubscriptionOptions:
"""A factory method that creates a :class:`GuildSubscriptionOptions` with subscribing disabled.
This is an alias of :meth:`disabled`.
"""
return cls(auto_subscribe=False)

2
discord/settings.py

@ -266,7 +266,7 @@ class ChannelSettings:
@property @property
def channel(self) -> Optional[GuildChannel]: def channel(self) -> Optional[GuildChannel]:
"""Optional[:class:`GuildChannel]: Returns the channel these settings are for.""" """Optional[:class:`GuildChannel`]: Returns the channel these settings are for."""
guild = self._state._get_guild(self._guild_id) guild = self._state._get_guild(self._guild_id)
return guild and guild.get_channel(self._channel_id) return guild and guild.get_channel(self._channel_id)

1
discord/user.py

@ -56,6 +56,7 @@ __all__ = (
'User', 'User',
'ClientUser', 'ClientUser',
'Profile', 'Profile',
'Note',
) )
BU = TypeVar('BU', bound='BaseUser') BU = TypeVar('BU', bound='BaseUser')

5
docs/_templates/layout.html

@ -58,9 +58,8 @@
{#- The main navigation header #} {#- The main navigation header #}
<header class="grid-item"> <header class="grid-item">
<nav> <nav>
<a href="{{ pathto(master_doc)|e }}" class="main-heading">discord.py</a> <a href="{{ pathto(master_doc)|e }}" class="main-heading">discord.py-self</a>
<a href="https://github.com/Rapptz/discord.py" title="GitHub"><span class="material-icons custom-icons">github</span></a> <a href="https://github.com/dolfies/discord.py-self" title="GitHub"><span class="material-icons custom-icons">github</span></a>
<a href="{{ discord_invite }}" title="{{ _('Discord') }}"><span class="material-icons custom-icons">discord</span></a>
<a href="{{ pathto('faq') }}" title="FAQ"><span class="material-icons">help_center</span></a> <a href="{{ pathto('faq') }}" title="FAQ"><span class="material-icons">help_center</span></a>
{#- If we have more links we can put them here #} {#- If we have more links we can put them here #}
<a onclick="mobileSearch.open();" title="{{ _('Search') }}" id="open-search" class="mobile-only"><span class="material-icons">search</span></a> <a onclick="mobileSearch.open();" title="{{ _('Search') }}" id="open-search" class="mobile-only"><span class="material-icons">search</span></a>

61
docs/api.rst

@ -2014,8 +2014,7 @@ of :class:`enum.Enum`.
- :attr:`~AuditLogDiff.channel` - :attr:`~AuditLogDiff.channel`
- :attr:`~AuditLogDiff.name` - :attr:`~AuditLogDiff.name`
- :attr:`~AuditLogDif - :attr:`~AuditLogDiff.type` (always set to ``1`` if so)
.. attribute:: verified_bot_developerf.type` (always set to ``1`` if so)
.. attribute:: emoji_create .. attribute:: emoji_create
@ -3299,6 +3298,15 @@ ClientUser
:members: :members:
:inherited-members: :inherited-members:
UserSettings
~~~~~~~~~~~~~
.. attributetable:: UserSettings
.. autoclass:: UserSettings()
:members:
:inherited-members:
User User
~~~~~ ~~~~~
@ -3324,21 +3332,21 @@ Profile
:members: :members:
:inherited-members: :inherited-members:
Relationship Note
~~~~~~~~~~~~~ ~~~~~
.. attributetable:: Relationship .. attributetable:: Note
.. autoclass:: Relationship() .. autoclass:: Note()
:members: :members:
:inherited-members: :inherited-members:
UserSettings Relationship
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
.. attributetable:: UserSettings .. attributetable:: Relationship
.. autoclass:: UserSettings() .. autoclass:: Relationship()
:members: :members:
:inherited-members: :inherited-members:
@ -3450,30 +3458,30 @@ Guild
:type: :class:`User` :type: :class:`User`
GuildFolder GuildSettings
~~~~~~~~~~~~ ~~~~~~~~~~~~~~
.. attributetable:: GuildFolder .. attributetable:: GuildSettings
.. autoclass:: GuildFolder() .. autoclass:: GuildSettings()
:members: :members:
:inherited-members: :inherited-members:
GuildSettings GuildFolder
~~~~~~~~~~~~~~ ~~~~~~~~~~~~
.. attributetable:: GuildSettings .. attributetable:: GuildFolder
.. autoclass:: GuildSettings() .. autoclass:: GuildFolder()
:members: :members:
:inherited-members: :inherited-members:
ChannelSettings GuildSubscriptionOptions
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
.. attributetable:: ChannelSettings .. attributetable:: GuildSubscriptionOptions
.. autoclass:: ChannelSettings() .. autoclass:: GuildSubscriptionOptions()
:members: :members:
:inherited-members: :inherited-members:
@ -3587,6 +3595,17 @@ TextChannel
.. automethod:: typing .. automethod:: typing
:async-with: :async-with:
ChannelSettings
~~~~~~~~~~~~~~~~
.. attributetable:: ChannelSettings
.. autoclass:: ChannelSettings()
:members:
:inherited-members:
Thread Thread
~~~~~~~~ ~~~~~~~~

18
docs/conf.py

@ -49,7 +49,7 @@ autodoc_typehints = 'none'
# napoleon_attr_annotations = False # napoleon_attr_annotations = False
extlinks = { extlinks = {
'issue': ('https://github.com/Rapptz/discord.py/issues/%s', 'GH-'), 'issue': ('https://github.com/dolfies/discord.py-self/issues/%s', 'GH-'),
} }
# Links used for cross-referencing stuff in other documentation # Links used for cross-referencing stuff in other documentation
@ -80,7 +80,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = 'discord.py-self' project = 'discord.py-self'
copyright = '2015-present, Rapptz' #copyright = ''
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@ -145,7 +145,6 @@ pygments_style = 'friendly'
# Nitpicky mode options # Nitpicky mode options
nitpick_ignore_files = [ nitpick_ignore_files = [
"migrating_to_async",
"migrating", "migrating",
"whats_new", "whats_new",
] ]
@ -159,7 +158,6 @@ html_experimental_html5_writer = True
html_theme = 'basic' html_theme = 'basic'
html_context = { html_context = {
'discord_invite': 'https://discord.gg/NONE',
'discord_extensions': [ 'discord_extensions': [
('discord.ext.commands', 'ext/commands'), ('discord.ext.commands', 'ext/commands'),
('discord.ext.tasks', 'ext/tasks'), ('discord.ext.tasks', 'ext/tasks'),
@ -167,7 +165,6 @@ html_context = {
} }
resource_links = { resource_links = {
'discord': 'https://discord.gg/NONE',
'issues': 'https://github.com/dolfies/discord.py-self/issues', 'issues': 'https://github.com/dolfies/discord.py-self/issues',
'discussions': 'https://github.com/dolfies/discord.py-self/discussions', 'discussions': 'https://github.com/dolfies/discord.py-self/discussions',
'examples': f'https://github.com/dolfies/discord.py-self/tree/{branch}/examples', 'examples': f'https://github.com/dolfies/discord.py-self/tree/{branch}/examples',
@ -236,10 +233,10 @@ html_static_path = ['_static']
#html_show_sourcelink = True #html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True html_show_copyright = False
# If true, an OpenSearch description file will be output, and all pages will # If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the # contain a <link> tag referring to it. The value of this option must be the
@ -293,7 +290,7 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
('index', 'discord.py.tex', 'discord.py-self Documentation', ('index', 'discord.py-self.tex', 'discord.py-self Documentation',
'Dolfies', 'manual'), 'Dolfies', 'manual'),
] ]
@ -355,7 +352,4 @@ texinfo_documents = [
#texinfo_no_detailmenu = False #texinfo_no_detailmenu = False
def setup(app): def setup(app):
if app.config.language == 'ja': pass
app.config.intersphinx_mapping['py'] = ('https://docs.python.org/ja/3', None)
app.config.html_context['discord_invite'] = 'https://discord.gg/NONE'
app.config.resource_links['discord'] = 'https://discord.gg/NONE'

6
docs/quickstart.rst

@ -55,10 +55,10 @@ There's a lot going on here, so let's walk you through it step by step.
sure that we ignore messages from ourselves. We do this by checking if the :attr:`Message.author` sure that we ignore messages from ourselves. We do this by checking if the :attr:`Message.author`
is the same as the :attr:`Client.user`. is the same as the :attr:`Client.user`.
5. Afterwards, we check if the :class:`Message.content` starts with ``'$hello'``. If it does, 5. Afterwards, we check if the :class:`Message.content` starts with ``'$hello'``. If it does,
then we send a message in the channel it was used in with ``'Hello!'``. This is a basic way of then we send a message in the channel it was used in with ``'Hello!'``. This is a basic way of
handling commands, which can be later automated with the :doc:`./ext/commands/index` framework. handling commands, which can be later automated with the :doc:`./ext/commands/index` framework.
6. Finally, we run the bot with our login token. If you need help getting your token or creating a bot, 6. Finally, we run the bot with our login token. If you need help getting your token,
look in the :ref:`discord-intro` section. look in the :doc:`token` section.
Now that we've made a bot, we have to *run* the bot. Luckily, this is simple since this is just a Now that we've made a bot, we have to *run* the bot. Luckily, this is simple since this is just a

1176
docs/whats_new.rst

File diff suppressed because it is too large
Loading…
Cancel
Save