Skip to content

Commit 466546e

Browse files
authored
Updated main-docs to 1.7.5.2
1 parent 2a6dc8d commit 466546e

File tree

10 files changed

+56
-4
lines changed

10 files changed

+56
-4
lines changed

docs/additions.rst

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Events
8181

8282
This Event will be triggered if a Button, that is attached to a Message wich is in the internal Cache, is pressed.
8383

84-
:param interaction: The `Interaction <./interaction.html#interaction>`_-object with all his attributes and methods to respond to the interaction
84+
:param interaction: The `Interaction <./interaction.html#Interaction>`_-object with all his attributes and methods to respond to the interaction
8585
:type interaction: :class:`discord.Interaction`
8686
:param button: The `ButtonClick <./interaction.html#ButtonClick>`_ if the message is ephemeral else `Button <./components.html#Button>`_. (this is also in the first parameter under ``component``).
8787
:type button: Union[:class:`Button`, :class:`ButtonClick`]
@@ -303,7 +303,59 @@ and
303303
:param embeds: A list of up to 10 :class:`discord.Embed`'s to replace the previous ones(This is also usable for normal Messages).
304304
:type embeds: Optional[List[:class:`discord.Embed`]]
305305

306-
.. toctree::
306+
utils
307+
~~~~~
308+
309+
.. function:: styled_timestamp(timestamp, style)
310+
311+
A small function that returns a styled timestamp for discord, this will be displayed accordingly in the Discord client depending on the :attr:`style` specified.
312+
313+
Timestamps will display the given timestamp in the user's timezone and locale.
314+
315+
:param timestamp: Union[`datetime.datetime <https://docs.python.org/3/library/datetime.html>`_, :class:`int`]
316+
The timestamp; A :class:`datetime.datetime` object or an already completed timestamp.
317+
318+
:param style: Optional[Union[:class:`TimestampStyle`, :class:`str`]]
319+
How the timestamp should be displayed in Discord; this can either be a :class:`TimestampStyle` or directly the associated value.
320+
321+
:default: :class:`TimestampStyle.short`
322+
323+
**Example**
324+
325+
.. code-block:: python
326+
327+
@client.command()
328+
async def time(ctx):
329+
await ctx.send(discord.utils.styled_timestamp(datetime.now(), discord.TimestampStyle.long))
330+
331+
.. class:: TimestampStyle
332+
333+
.. note::
334+
This is located in discord.enums but i place it here
335+
336+
The Styles you could use for the :attr:`style` of a :class:`styled_timestamp`
337+
338+
See also in the `Discord-Documentation <https://discord.com/developers/docs/reference#message-formatting-timestamp-styles>`_
339+
340+
+----------------------------------+-------+-----------------+--------------------------------+
341+
| NAME | VALUE | DESCRIPTION | EXAMPLE |
342+
+==================================+=======+=================+================================+
343+
| .. attribute:: short_time | 't' | Short Time | .. image:: imgs/short_time.png |
344+
+----------------------------------+-------+-----------------+--------------------------------+
345+
| .. attribute:: long_time | 'T' | Long Time | .. image:: imgs/long_time.png |
346+
+----------------------------------+-------+-----------------+--------------------------------+
347+
| .. attribute:: short_date | 'd' | Short Date | .. image:: imgs/short_date.png |
348+
+----------------------------------+-------+-----------------+--------------------------------+
349+
| .. attribute:: long_date | 'D' | Long Date | .. image:: imgs/long_date.png |
350+
+----------------------------------+-------+-----------------+--------------------------------+
351+
| .. attribute:: short | 'f' | Short Date/Time | .. image:: imgs/short.png |
352+
+----------------------------------+-------+-----------------+--------------------------------+
353+
| .. attribute:: long | 'F' | Long Date/Time | .. image:: imgs/long.png |
354+
+----------------------------------+-------+-----------------+--------------------------------+
355+
| .. attribute:: relative | 'R' | Relative Time | .. image:: imgs/relative.png |
356+
+----------------------------------+-------+-----------------+--------------------------------+
357+
358+
.. toctree::
307359
:maxdepth: 3
308360
:caption: Contents:
309361

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
author = 'Mathieu Corsham aka. mccoder.py'
2727

2828
# The full version, including alpha/beta/rc tags
29-
release = '1.7.5.1'
29+
release = '1.7.5.2'
3030

3131

3232
# -- General configuration ---------------------------------------------------

docs/imgs/long.png

3.15 KB
Loading

docs/imgs/long_date.png

1.63 KB
Loading

docs/imgs/long_time.png

1.16 KB
Loading

docs/imgs/relative.png

1.33 KB
Loading

docs/imgs/short.png

2.24 KB
Loading

docs/imgs/short_date.png

1.47 KB
Loading

docs/imgs/short_time.png

827 Bytes
Loading

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ___________
5454
**Python 3.5.3 or higher is required**
5555

5656
This Library overwrite the original discord.py Library so to be sure all will work fine
57-
first uninstall the original `discord.py <https://pypi.org/project/discord.py>`_ Library if it is installed:
57+
first uninstall the original `discord.py <https://pypi.org/project/discord.py/1.7.3>`_ Library if it is installed:
5858

5959
.. code:: sh
6060

0 commit comments

Comments
 (0)