From 9356cc8f7032bb5090a8602eb5d1e22ec789fa0c Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Sun, 16 Oct 2022 20:53:42 +0200 Subject: [PATCH 01/15] Refactor from More Features to Embeds, Events, Markdown --- .../{more-features.mdx => embeds.mdx} | 213 +----------------- docs/getting-started/events.mdx | 56 +++++ docs/getting-started/markdown.mdx | 160 +++++++++++++ 3 files changed, 223 insertions(+), 206 deletions(-) rename docs/getting-started/{more-features.mdx => embeds.mdx} (55%) create mode 100644 docs/getting-started/events.mdx create mode 100644 docs/getting-started/markdown.mdx diff --git a/docs/getting-started/more-features.mdx b/docs/getting-started/embeds.mdx similarity index 55% rename from docs/getting-started/more-features.mdx rename to docs/getting-started/embeds.mdx index b504328b..10c8f44c 100644 --- a/docs/getting-started/more-features.mdx +++ b/docs/getting-started/embeds.mdx @@ -1,6 +1,6 @@ --- -title: More Features -description: More features to make your bot cool and snazzy. +title: Embeds +description: Discord components used to present data with special formatting and structure. --- import { @@ -15,63 +15,8 @@ import "discord-message-components/packages/react/dist/style.css"; import DiscordComponent from "../../src/components/DiscordComponent"; -So, you just created your first Pycord bot! Now, let's add some more features to it. This will include adding event handlers, waiting for user response, styling the messages, and more. +# Embeds -## Events - -### Event Handlers - -Events in Discord are a way to listen for certain actions. For example, if you want to know when a user joins your server so you could send a welcome message, you can use the `on_member_join` event. - -First, you need to ask Discord to send you events. This is done via "Intents". Read up the [Intents](../Popular-Topics/intents) page for more information. - -Once you understand what intents are, you can enable the events you need, or just use the default ones with `discord.Intents.all()`. - -Now that that's done, let's add an event handler for when a user joins the server. We will use the [`on_member_join` event](https://docs.pycord.dev/en/master/api.html#discord.on_member_join). We will send a private message to the user welcoming them to the server. - -```python -@bot.event -async def on_member_join(member): - await member.send( - f'Welcome to the server, {member.mention}! Enjoy your stay here.' - ) -``` - -We use the [`discord.Bot.event` decorator](https://docs.pycord.dev/en/master/api.html#discord.Bot.event) to add the event handler. - -The `on_member_join` event is called when a user joins the server. The `member` parameter is the user that joined. Different events have different names and parameters. You can find all of them [here](https://docs.pycord.dev/en/master/api.html#discord.Intents). - -So, that's how you add event handlers! - -### Waiting for User Response - -Let's say you want to create a Guess-the-Number game (where the user has to guess a number between 1-10). You need to send a message to a user and wait for them to respond. You can do this with the [`wait_for`](https://docs.pycord.dev/en/master/api.html#discord.Bot.wait_for) method. - -```python -@bot.command() -async def gtn(ctx): - """A Slash Command to play a Guess-the-Number game.""" - - await ctx.respond('Guess a number between 1 and 10.') - guess = await bot.wait_for('message', check=lambda message: message.author == ctx.author) - - if int(guess.content) == 5: - await ctx.send('You guessed it!') - else: - await ctx.send('Nope, try again.') -``` - -`wait_for` takes one argument, which is the event type. The event type is the name of the event you want to wait for. In this case, it's `message`. It could also be `reaction` to wait for a reaction to be added. - -We pass a keyword argument to `wait_for` called `check`. The function may look complicated if you're a beginner. We pass a `lambda` function, which simplifies the code a bit. - -The lambda function takes one parameter, `message`. When Pycord receives a message, it passes it to the `check` function. If the function returns `True`, the message is returned. If the function returns `False`, the message is ignored and the bot waits for another message. - -Here, we check if the message is from the user that sent the command. We simply use `message.author == ctx.author`. This will check if the author of the message was the person who invoked the command. - -## Styling Messages - -### Embeds Embeds are a Discord feature that allows applications to format their messages in cool embedded format, enabling your bot to lay out messages with a lot of text into neat fields. @@ -201,7 +146,7 @@ embed.add_field(title="Inline Field 2", value="Inline Field 2", inline=True) embed.add_field(title="Inline Field 3", value="Inline Field 3", inline=True) ``` -This small section shows off embed fields. You can add fields to embeds with the [`add_field` method](https://docs.pycord.dev/en/master/api.html#discord.Embed.add_field) +This small section shows off embed fields. You can add up to 25 fields to embeds with the [`add_field` method](https://docs.pycord.dev/en/master/api.html#discord.Embed.add_field) of the [`discord.Embed`](https://docs.pycord.dev/en/master/api.html#embed) class. These consist of three keyword arguments: `title`, `value`, and `inline`. `title` and `value` are both required arguments, which inline defaults to `False` if it's not defined. The `inline` argument specifies whether or not space will be divided among the inline fields. There could be a mix of fields where inline has different values too. @@ -224,153 +169,9 @@ method, you can set a small image to reside at the top-right of the embed. This method, you can set an image to sit at the bottom of an embed. This has a single `url` kwarg. There are a lot more methods and attributes you can use to configure embeds. Here, we just covered the basics. Also, remember that all of these values are not necessary in an embed. An embed may only contain a few of these. For example, only a description, a title and a description, and so on. - -### Markdown -Markdown is a type of markup language that's limited in terms of formatting yet simple. Discord allows -for a watered-down version of markdown to be in their messages. - -#### Text Markdown - -Text formatting can be used in messages and in most embed parts, -as explained in the dedicated section below. - - - - - - - - - - - - - - - - - - - - -
*italics*__*underlined italics*__
**bold**__**underlined bold**__
***bold italics***__***underlined bold italics***__
__underlined__~~strikethrough~~
- -#### Code Markdown -To create a single-line code block without syntax highlight, wrap the text between single backticks. -This code block will only add a dark background to the text. +:::info Related Topics -``` -`print("Hello world!")` -``` - -To create a multi-line code block without syntax highlight, wrap the text between triple backticks -on first and last line. This type of code block will encase the code inside a box. - -```` -``` -message = "Hello world!" -print(message) -``` -```` - -To create a multi-line block with syntax highlight, add the name of the language you are using right after -the triple backticks on the first line. For example, for Python you can write either "python" or "py". - -```` -```python -message = "Hello world!" -print(message) -``` -```` - -If you want to use syntax highlight for a single line of code, you still have to format it -like a multi-line block but the code must be on a separate line than the triple backticks. - -#### Quote Markdown - -To create a single-line quote block, start the line with `>` followed by a space. - -``` -> This is a single-line quote. -``` - -To create a multi-line quote block, write `>>>` followed by a space. All text -from that point onwards will be included in that quote block. - -``` ->>> This is a -multi-line quote. -``` - -#### Spoiler Markdown - -To hide a spoiler, encase the text between double pipes. The users -will have to click on it before being able to see the text contained in it. - -``` -||spoiler|| -``` - -#### Link Markdown - -Link formatting only works in embeds and messages sent through webhooks, -by using the following syntax: - -``` -[Pycord](https://pycord.dev/) -``` - -Inside the supported elements that have just been mentioned, -the example above will look like this: [`Pycord`](https://pycord.dev/) - -Outside of them, the link will still be clickable but the formatting will be ignored, -therefore the example above will look similarly to this: `[Pycord](https://pycord.dev/)` - -#### Embed Markdown - -Adding markdown to your embeds or messages will give your bot the sparkle it needs, -however, markdown is limited inside embeds. Use the following table as a reference -and keep in mind that embed title and filed names will always show in **bold**. +- [Markdown](markdown) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PartTextLink
Embed AuthorNoNo
Embed TitleYesNo
Embed DescriptionYesYes
Field NameYesNo
Field ValueYesYes
Embed FooterNoNo
+::: \ No newline at end of file diff --git a/docs/getting-started/events.mdx b/docs/getting-started/events.mdx new file mode 100644 index 00000000..20ee2943 --- /dev/null +++ b/docs/getting-started/events.mdx @@ -0,0 +1,56 @@ +--- +title: Events +description: Events used to listen for certain actions and react to them. +--- + +# Events + +## Event Handlers + +Events in Discord are a way to listen for certain actions. For example, if you want to know when a user joins your server so you could send a welcome message, you can use the `on_member_join` event. + +First, you need to ask Discord to send you events. This is done via "Intents". Read up the [Intents](../Popular-Topics/intents) page for more information. + +Once you understand what intents are, you can enable the events you need, or just use the default ones with `discord.Intents.all()`. + +Now that that's done, let's add an event handler for when a user joins the server. We will use the [`on_member_join` event](https://docs.pycord.dev/en/master/api.html#discord.on_member_join). We will send a private message to the user welcoming them to the server. + +```python +@bot.event +async def on_member_join(member): + await member.send( + f'Welcome to the server, {member.mention}! Enjoy your stay here.' + ) +``` + +We use the [`discord.Bot.event` decorator](https://docs.pycord.dev/en/master/api.html#discord.Bot.event) to add the event handler. + +The `on_member_join` event is called when a user joins the server. The `member` parameter is the user that joined. Different events have different names and parameters. You can find all of them [here](https://docs.pycord.dev/en/master/api.html#discord.Intents). + +So, that's how you add event handlers! + +## Waiting for User Response + +Let's say you want to create a Guess-the-Number game (where the user has to guess a number between 1-10). You need to send a message to a user and wait for them to respond. You can do this with the [`wait_for`](https://docs.pycord.dev/en/master/api.html#discord.Bot.wait_for) method. + +```python +@bot.command() +async def gtn(ctx): + """A Slash Command to play a Guess-the-Number game.""" + + await ctx.respond('Guess a number between 1 and 10.') + guess = await bot.wait_for('message', check=lambda message: message.author == ctx.author) + + if int(guess.content) == 5: + await ctx.send('You guessed it!') + else: + await ctx.send('Nope, try again.') +``` + +`wait_for` takes one argument, which is the event type. The event type is the name of the event you want to wait for. In this case, it's `message`. It could also be `reaction` to wait for a reaction to be added. + +We pass a keyword argument to `wait_for` called `check`. The function may look complicated if you're a beginner. We pass a `lambda` function, which simplifies the code a bit. + +The lambda function takes one parameter, `message`. When Pycord receives a message, it passes it to the `check` function. If the function returns `True`, the message is returned. If the function returns `False`, the message is ignored and the bot waits for another message. + +Here, we check if the message is from the user that sent the command. We simply use `message.author == ctx.author`. This will check if the author of the message was the person who invoked the command. \ No newline at end of file diff --git a/docs/getting-started/markdown.mdx b/docs/getting-started/markdown.mdx new file mode 100644 index 00000000..54bcf955 --- /dev/null +++ b/docs/getting-started/markdown.mdx @@ -0,0 +1,160 @@ +--- +title: Markdown +description: Markdown syntax usable to format text on Discord. +--- + +# Markdown +Markdown is a type of markup language that's limited in terms of formatting yet simple. Discord allows +for a watered-down version of markdown to be in their messages. + +## Text Markdown + +Text formatting can be used in messages and in most embed parts, +as explained in the dedicated section below. + + + + + + + + + + + + + + + + + + + + +
*italics*__*underlined italics*__
**bold**__**underlined bold**__
***bold italics***__***underlined bold italics***__
__underlined__~~strikethrough~~
+ +## Code Markdown + +To create a single-line code block without syntax highlight, wrap the text between single backticks. +This code block will only add a dark background to the text. + +``` +`print("Hello world!")` +``` + +To create a multi-line code block without syntax highlight, wrap the text between triple backticks +on first and last line. This type of code block will encase the code inside a box. + +```` +``` +message = "Hello world!" +print(message) +``` +```` + +To create a multi-line block with syntax highlight, add the name of the language you are using right after +the triple backticks on the first line. For example, for Python you can write either "python" or "py". + +```` +```python +message = "Hello world!" +print(message) +``` +```` + +If you want to use syntax highlight for a single line of code, you still have to format it +like a multi-line block but the code must be on a separate line than the triple backticks. + +## Quote Markdown + +To create a single-line quote block, start the line with `>` followed by a space. + +``` +> This is a single-line quote. +``` + +To create a multi-line quote block, write `>>>` followed by a space. All text +from that point onwards will be included in that quote block. + +``` +>>> This is a +multi-line quote. +``` + +## Spoiler Markdown + +To hide a spoiler, encase the text between double pipes. The users +will have to click on it before being able to see the text contained in it. + +``` +||spoiler|| +``` + +#### Link Markdown + +Link formatting only works in embeds and messages sent through webhooks, +by using the following syntax: + +``` +[Pycord](https://pycord.dev/) +``` + +Inside the supported elements that have just been mentioned, +the example above will look like this: [`Pycord`](https://pycord.dev/) + +Outside of them, the link will still be clickable but the formatting will be ignored, +therefore the example above will look similarly to this: `[Pycord](https://pycord.dev/)` + +## Embed Markdown + +Adding markdown to your embeds or messages will give your bot the sparkle it needs, +however, markdown is limited inside embeds. Use the following table as a reference +and keep in mind that embed title and filed names will always show in **bold**. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PartTextLink
Embed AuthorNoNo
Embed TitleYesNo
Embed DescriptionYesYes
Field NameYesNo
Field ValueYesYes
Embed FooterNoNo
+ +:::info Related Topics + +- [Embeds](embeds) + +::: \ No newline at end of file From 864c32fa649e8c25bb24f7a5361684b4373e850d Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Sun, 16 Oct 2022 21:11:25 +0200 Subject: [PATCH 02/15] Fix end of files --- docs/getting-started/embeds.mdx | 2 +- docs/getting-started/events.mdx | 2 +- docs/getting-started/markdown.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting-started/embeds.mdx b/docs/getting-started/embeds.mdx index 10c8f44c..8683bcda 100644 --- a/docs/getting-started/embeds.mdx +++ b/docs/getting-started/embeds.mdx @@ -174,4 +174,4 @@ There are a lot more methods and attributes you can use to configure embeds. Her - [Markdown](markdown) -::: \ No newline at end of file +::: diff --git a/docs/getting-started/events.mdx b/docs/getting-started/events.mdx index 20ee2943..f9dd7abf 100644 --- a/docs/getting-started/events.mdx +++ b/docs/getting-started/events.mdx @@ -53,4 +53,4 @@ We pass a keyword argument to `wait_for` called `check`. The function may look c The lambda function takes one parameter, `message`. When Pycord receives a message, it passes it to the `check` function. If the function returns `True`, the message is returned. If the function returns `False`, the message is ignored and the bot waits for another message. -Here, we check if the message is from the user that sent the command. We simply use `message.author == ctx.author`. This will check if the author of the message was the person who invoked the command. \ No newline at end of file +Here, we check if the message is from the user that sent the command. We simply use `message.author == ctx.author`. This will check if the author of the message was the person who invoked the command. diff --git a/docs/getting-started/markdown.mdx b/docs/getting-started/markdown.mdx index 54bcf955..4140c2a8 100644 --- a/docs/getting-started/markdown.mdx +++ b/docs/getting-started/markdown.mdx @@ -157,4 +157,4 @@ and keep in mind that embed title and filed names will always show in **bold**. - [Embeds](embeds) -::: \ No newline at end of file +::: From c300cffc20876dec9f676e82692564dc71583663 Mon Sep 17 00:00:00 2001 From: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Date: Mon, 17 Oct 2022 16:28:19 -0500 Subject: [PATCH 03/15] New category + md examples --- .../styling-messages/_category_.json | 6 ++ .../{ => styling-messages}/embeds.mdx | 2 +- .../{ => styling-messages}/markdown.mdx | 94 ++++++++++++++++++- src/scss/main.scss | 19 ++++ 4 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 docs/getting-started/styling-messages/_category_.json rename docs/getting-started/{ => styling-messages}/embeds.mdx (99%) rename docs/getting-started/{ => styling-messages}/markdown.mdx (65%) diff --git a/docs/getting-started/styling-messages/_category_.json b/docs/getting-started/styling-messages/_category_.json new file mode 100644 index 00000000..8fa27b2b --- /dev/null +++ b/docs/getting-started/styling-messages/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Styling Messages", + "link": { + "type": "generated-index" + } +} diff --git a/docs/getting-started/embeds.mdx b/docs/getting-started/styling-messages/embeds.mdx similarity index 99% rename from docs/getting-started/embeds.mdx rename to docs/getting-started/styling-messages/embeds.mdx index 8683bcda..6a8cd289 100644 --- a/docs/getting-started/embeds.mdx +++ b/docs/getting-started/styling-messages/embeds.mdx @@ -13,7 +13,7 @@ import { } from "discord-message-components/packages/react"; import "discord-message-components/packages/react/dist/style.css"; -import DiscordComponent from "../../src/components/DiscordComponent"; +import DiscordComponent from "../../../src/components/DiscordComponent"; # Embeds diff --git a/docs/getting-started/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx similarity index 65% rename from docs/getting-started/markdown.mdx rename to docs/getting-started/styling-messages/markdown.mdx index 4140c2a8..5876fe13 100644 --- a/docs/getting-started/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -3,6 +3,19 @@ title: Markdown description: Markdown syntax usable to format text on Discord. --- +import { + DiscordInteraction, + DiscordMessage, + DiscordMessages, + DiscordEmbed, + DiscordEmbedField, + DiscordEmbedFields, + DiscordMarkdown, +} from "discord-message-components/packages/react"; +import "discord-message-components/packages/react/dist/style.css"; + +import DiscordComponent from "../../../src/components/DiscordComponent"; + # Markdown Markdown is a type of markup language that's limited in terms of formatting yet simple. Discord allows for a watered-down version of markdown to be in their messages. @@ -42,6 +55,16 @@ This code block will only add a dark background to the text. `print("Hello world!")` ``` + + + + `print("Hello world!")` + + + + +
+ To create a multi-line code block without syntax highlight, wrap the text between triple backticks on first and last line. This type of code block will encase the code inside a box. @@ -52,6 +75,19 @@ print(message) ``` ```` + + + +``` +message = "Hello world!" +print(message) +``` + + + + +
+ To create a multi-line block with syntax highlight, add the name of the language you are using right after the triple backticks on the first line. For example, for Python you can write either "python" or "py". @@ -62,6 +98,19 @@ print(message) ``` ```` + + + +```python +message = "Hello world!" +print(message) +``` + + + + +
+ If you want to use syntax highlight for a single line of code, you still have to format it like a multi-line block but the code must be on a separate line than the triple backticks. @@ -69,10 +118,20 @@ like a multi-line block but the code must be on a separate line than the triple To create a single-line quote block, start the line with `>` followed by a space. -``` +```text > This is a single-line quote. ``` + + + + > This is a single-line quote. + + + + +
+ To create a multi-line quote block, write `>>>` followed by a space. All text from that point onwards will be included in that quote block. @@ -81,6 +140,17 @@ from that point onwards will be included in that quote block. multi-line quote. ``` + + + + >>> This is a + multi-line quote. + + + + +
+ ## Spoiler Markdown To hide a spoiler, encase the text between double pipes. The users @@ -90,6 +160,16 @@ will have to click on it before being able to see the text contained in it. ||spoiler|| ``` + + + + ||spoiler|| + + + + +
+ #### Link Markdown Link formatting only works in embeds and messages sent through webhooks, @@ -99,10 +179,18 @@ by using the following syntax: [Pycord](https://pycord.dev/) ``` + + + Pycord + + + +
+ Inside the supported elements that have just been mentioned, -the example above will look like this: [`Pycord`](https://pycord.dev/) +the example above will create a link with the text "Pycord" and the URL "https://pycord.dev/". -Outside of them, the link will still be clickable but the formatting will be ignored, +Outside them, the link will still be clickable but the formatting will be ignored, therefore the example above will look similarly to this: `[Pycord](https://pycord.dev/)` ## Embed Markdown diff --git a/src/scss/main.scss b/src/scss/main.scss index 85efe5ca..a43969be 100644 --- a/src/scss/main.scss +++ b/src/scss/main.scss @@ -272,6 +272,25 @@ body { // We Should be able to remove everything below here, but for some reason it doesn't work without it. Also, some // of it hasn't been added to the component package yet anyways so that needs to be done. .discord-message { + .discord-markdown .discord-markdown-content { + & > code { + border: unset; + vertical-align: unset; + } + & > pre { + background-color: unset; + color: unset; + font: unset; + overflow: unset; + padding: unset; + } + & > blockquote { + border-left: unset; + box-shadow: unset; + color: unset; + font-size: unset; + } + } .discord-author-info { .discord-author-username { letter-spacing: unset; From 7490f691d864f05e9f1e6523d36ea2f51fa887ac Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Tue, 18 Oct 2022 00:37:55 +0200 Subject: [PATCH 04/15] Fix syntax highlight, sections, examples, and some sentences Add the "text" flag to code blocks that aren't supposed to show with syntax highlight as they are about an example without it. Split the Code Block and Quote Block sections into paragraphs. Add an example for single-line code block with syntax highlight. Improve some sentences here and there. --- .../styling-messages/embeds.mdx | 2 +- .../styling-messages/markdown.mdx | 52 ++++++++++++++++--- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/docs/getting-started/styling-messages/embeds.mdx b/docs/getting-started/styling-messages/embeds.mdx index 6a8cd289..7c4e879a 100644 --- a/docs/getting-started/styling-messages/embeds.mdx +++ b/docs/getting-started/styling-messages/embeds.mdx @@ -148,7 +148,7 @@ embed.add_field(title="Inline Field 3", value="Inline Field 3", inline=True) This small section shows off embed fields. You can add up to 25 fields to embeds with the [`add_field` method](https://docs.pycord.dev/en/master/api.html#discord.Embed.add_field) of the [`discord.Embed`](https://docs.pycord.dev/en/master/api.html#embed) class. These consist of three -keyword arguments: `title`, `value`, and `inline`. `title` and `value` are both required arguments, which inline defaults to `False` if it's not defined. The `inline` argument specifies whether or not space will be divided among the inline fields. There could be a mix of fields where inline has different values too. +keyword arguments: `title`, `value`, and `inline`. `title` and `value` are both required arguments, whereas `inline` is optional and defaults to `False` when not defined. The `inline` argument specifies whether or not space will be divided among the inline fields. There could be a mix of fields where inline has different values too. ```py embed.set_footer(text="Footer! No markdown here.") # footers can have icons too diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 5876fe13..8690a496 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -48,10 +48,15 @@ as explained in the dedicated section below. ## Code Markdown +This formatting can be used not only for code but also for normal text, +when you want the text to have a different background or to be encased in a box. + +### Single-Line Code Block + To create a single-line code block without syntax highlight, wrap the text between single backticks. This code block will only add a dark background to the text. -``` +```text `print("Hello world!")` ``` @@ -65,10 +70,16 @@ This code block will only add a dark background to the text.
+### Multi-Line Code Block + +This type of code block, created by using triple backticks, will encase the text inside a box. + +#### Without Syntax Highlight + To create a multi-line code block without syntax highlight, wrap the text between triple backticks -on first and last line. This type of code block will encase the code inside a box. +on first and last line. -```` +````text ``` message = "Hello world!" print(message) @@ -88,6 +99,8 @@ print(message)
+#### With Syntax Highlight + To create a multi-line block with syntax highlight, add the name of the language you are using right after the triple backticks on the first line. For example, for Python you can write either "python" or "py". @@ -111,11 +124,34 @@ print(message)
+### Single-Line Code Block + If you want to use syntax highlight for a single line of code, you still have to format it -like a multi-line block but the code must be on a separate line than the triple backticks. +like a multi-line block, however, you cannot start writing the encased text on the same line +where you declare which language to use. + +```` +```python +print("Hello world!") +``` +```` + + + + +```python +print("Hello world!") +``` + + + + +
## Quote Markdown +### Single-Line Quote Block + To create a single-line quote block, start the line with `>` followed by a space. ```text @@ -132,10 +168,12 @@ To create a single-line quote block, start the line with `>` followed by a space
+### Multi-Line Quote Block + To create a multi-line quote block, write `>>>` followed by a space. All text from that point onwards will be included in that quote block. -``` +```text >>> This is a multi-line quote. ``` @@ -189,9 +227,7 @@ by using the following syntax: Inside the supported elements that have just been mentioned, the example above will create a link with the text "Pycord" and the URL "https://pycord.dev/". - -Outside them, the link will still be clickable but the formatting will be ignored, -therefore the example above will look similarly to this: `[Pycord](https://pycord.dev/)` +Outside of them, the link will still be clickable but the formatting will be ignored. ## Embed Markdown From 53e726d759ce9cb2369c70ac393de68e060191ed Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Wed, 19 Oct 2022 16:55:11 +0200 Subject: [PATCH 05/15] Fix internal link --- docs/getting-started/styling-messages/embeds.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/styling-messages/embeds.mdx b/docs/getting-started/styling-messages/embeds.mdx index 7c4e879a..e231647c 100644 --- a/docs/getting-started/styling-messages/embeds.mdx +++ b/docs/getting-started/styling-messages/embeds.mdx @@ -121,7 +121,7 @@ bot.run("TOKEN")
-This simple command sends replies to a [slash command](../interactions/application-commands/slash-commands) with an embed. +This simple command sends replies to a [slash command](../../interactions/application-commands/slash-commands) with an embed. Let's break it down: ```py From db48c646e3cd7d642152f444720c2e12b7d44556 Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Wed, 19 Oct 2022 16:56:17 +0200 Subject: [PATCH 06/15] Fix examples --- docs/getting-started/styling-messages/markdown.mdx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 8690a496..ae6c35f9 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -160,9 +160,7 @@ To create a single-line quote block, start the line with `>` followed by a space - - > This is a single-line quote. - + > This is a single-line quote. @@ -180,10 +178,8 @@ multi-line quote. - - >>> This is a - multi-line quote. - + >>> This is a + multi-line quote. @@ -200,9 +196,7 @@ will have to click on it before being able to see the text contained in it. - - ||spoiler|| - + ||spoiler|| From 40031e05d500da613926d9d7104377c9294e8754 Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Wed, 19 Oct 2022 16:56:39 +0200 Subject: [PATCH 07/15] Refactor indentation --- .../styling-messages/markdown.mdx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index ae6c35f9..1239a496 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -63,7 +63,7 @@ This code block will only add a dark background to the text. - `print("Hello world!")` + `print("Hello world!")` @@ -89,10 +89,10 @@ print(message) -``` -message = "Hello world!" -print(message) -``` + ``` + message = "Hello world!" + print(message) + ``` @@ -114,10 +114,10 @@ print(message) -```python -message = "Hello world!" -print(message) -``` + ```python + message = "Hello world!" + print(message) + ``` @@ -139,9 +139,9 @@ print("Hello world!") -```python -print("Hello world!") -``` + ```python + print("Hello world!") + ``` From 9e2b07b63424689c6a32a0ddd8087b3a5f1e12ed Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Wed, 19 Oct 2022 17:10:35 +0200 Subject: [PATCH 08/15] Fix multi-line quote example The syntax isn't exactly the one explained immediately above but the final result looks exactly the same and we hopefully no longer get any warning there. --- docs/getting-started/styling-messages/markdown.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 1239a496..c65e6fad 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -178,8 +178,8 @@ multi-line quote. - >>> This is a - multi-line quote. + > This is a + > multi-line quote. From f267fd677fe653aeccccd330ca833a5a498f4f2e Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Thu, 20 Oct 2022 00:38:32 +0200 Subject: [PATCH 09/15] Revert "Fix examples" --- docs/getting-started/styling-messages/markdown.mdx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index c65e6fad..4f148ce7 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -160,7 +160,9 @@ To create a single-line quote block, start the line with `>` followed by a space - > This is a single-line quote. + + > This is a single-line quote. + @@ -178,8 +180,10 @@ multi-line quote. - > This is a - > multi-line quote. + + > This is a + > multi-line quote. + @@ -196,7 +200,9 @@ will have to click on it before being able to see the text contained in it. - ||spoiler|| + + ||spoiler|| + From 0627433dbd8109f7a155615281f9ccb522e7367e Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Thu, 20 Oct 2022 09:45:57 +0200 Subject: [PATCH 10/15] Fix examples --- .../styling-messages/markdown.mdx | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 4f148ce7..86985967 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -63,7 +63,7 @@ This code block will only add a dark background to the text. - `print("Hello world!")` +`print("Hello world!")` @@ -89,10 +89,10 @@ print(message) - ``` - message = "Hello world!" - print(message) - ``` +``` +message = "Hello world!" +print(message) +``` @@ -114,10 +114,10 @@ print(message) - ```python - message = "Hello world!" - print(message) - ``` +```python +message = "Hello world!" +print(message) +``` @@ -139,9 +139,9 @@ print("Hello world!") - ```python - print("Hello world!") - ``` +```python +print("Hello world!") +``` @@ -161,7 +161,7 @@ To create a single-line quote block, start the line with `>` followed by a space - > This is a single-line quote. +> This is a single-line quote. @@ -181,8 +181,8 @@ multi-line quote. - > This is a - > multi-line quote. +>>> This is a +multi-line quote. @@ -201,7 +201,7 @@ will have to click on it before being able to see the text contained in it. - ||spoiler|| +||spoiler|| @@ -210,7 +210,7 @@ will have to click on it before being able to see the text contained in it. #### Link Markdown -Link formatting only works in embeds and messages sent through webhooks, +Link formatting only works in messages sent through webhooks end embeds, by using the following syntax: ``` @@ -226,7 +226,7 @@ by using the following syntax:
Inside the supported elements that have just been mentioned, -the example above will create a link with the text "Pycord" and the URL "https://pycord.dev/". +the example above will create a link with the text `Pycord` and the URL `https://pycord.dev/`. Outside of them, the link will still be clickable but the formatting will be ignored. ## Embed Markdown From b1182efe660d4e0b9f155ce32f4b73eb2b3366ed Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Thu, 20 Oct 2022 09:56:58 +0200 Subject: [PATCH 11/15] Fix titles and multi-line quote example --- docs/getting-started/styling-messages/markdown.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 86985967..286bf036 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -181,8 +181,8 @@ multi-line quote. ->>> This is a -multi-line quote. +> This is a +> multi-line quote. @@ -208,7 +208,7 @@ will have to click on it before being able to see the text contained in it.
-#### Link Markdown +## Link Markdown Link formatting only works in messages sent through webhooks end embeds, by using the following syntax: From 3f3d1433f8a6991133bfe79cb8db10f39b6ebddb Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Thu, 20 Oct 2022 10:01:36 +0200 Subject: [PATCH 12/15] Remove non-working language names from code block examples --- docs/getting-started/styling-messages/markdown.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 286bf036..089b3f3d 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -114,7 +114,7 @@ print(message) -```python +``` message = "Hello world!" print(message) ``` @@ -139,7 +139,7 @@ print("Hello world!") -```python +``` print("Hello world!") ``` From ccd56bda7ebe28b031fe4180969b3f7c9abc16f4 Mon Sep 17 00:00:00 2001 From: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Date: Thu, 20 Oct 2022 07:20:19 -0500 Subject: [PATCH 13/15] Update docs/getting-started/styling-messages/markdown.mdx --- docs/getting-started/styling-messages/markdown.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 089b3f3d..8959f9be 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -114,7 +114,7 @@ print(message) -``` +```python message = "Hello world!" print(message) ``` From fae2951a8fc233211c4070c34dc52f033aac30f7 Mon Sep 17 00:00:00 2001 From: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Date: Thu, 20 Oct 2022 07:20:25 -0500 Subject: [PATCH 14/15] Update docs/getting-started/styling-messages/markdown.mdx --- docs/getting-started/styling-messages/markdown.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 8959f9be..286bf036 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -139,7 +139,7 @@ print("Hello world!") -``` +```python print("Hello world!") ``` From 884561de7e481e0fc8374975f4347645789a9f19 Mon Sep 17 00:00:00 2001 From: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Date: Thu, 20 Oct 2022 07:20:34 -0500 Subject: [PATCH 15/15] Update docs/getting-started/styling-messages/markdown.mdx --- docs/getting-started/styling-messages/markdown.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/styling-messages/markdown.mdx b/docs/getting-started/styling-messages/markdown.mdx index 286bf036..d55ca296 100644 --- a/docs/getting-started/styling-messages/markdown.mdx +++ b/docs/getting-started/styling-messages/markdown.mdx @@ -181,8 +181,8 @@ multi-line quote. -> This is a -> multi-line quote. +>>> This is a +multi-line quote.