Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guides improvements #2

Merged
merged 5 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/content/docs/guides/attachments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ luau supports sending these attachments through the `AttachmentBuilder` object.
```
</details>

:::caution
Remember to enable the message content intent on the [Discord Developer Portal](https://discord.com/developers) when the `DiscordClient.eventManager.onMessage` event is used.

If the intent is not enabled, the bot won't have access to the message content!
:::

That's all! For more details, refer to the relevant docs;

- [DiscordAttachment](/classes/objects/discordattachment/)
Expand Down
14 changes: 10 additions & 4 deletions src/content/docs/guides/embeds.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ within a message.
DiscordClient:connectAsync()
```

2. Create a Discord embed that we can respond with:
2. Allow the bot to check messages:

- Go to the [Discord Developer Portal](https://discord.com/developers/applications)
- Choose your bot application in the `Applications` tab
- Go to the `Bot` tab and enable `MESSAGE CONTENT INTENT`

3. Create a Discord embed that we can respond with:

```lua
local responseEmbed = DiscordLuau.EmbedBuilder.new()
Expand All @@ -47,7 +53,7 @@ within a message.
:setFooter("This is a footer")
```

3. Reply to the message with the newly created embed:
4. Reply to the message with the newly created embed:

```lua
local responseMessage = DiscordLuau.MessageBuilder.new()
Expand All @@ -59,7 +65,7 @@ within a message.
:addField("Field 2", "Value 2", true)
:setFooter("This is a footer")

message:replyAsync(responseMessage:setEmbed(responseEmbed))
message:replyAsync(responseMessage:addEmbed(responseEmbed))
```
</Steps>

Expand All @@ -83,7 +89,7 @@ within a message.
:addField("Field 2", "Value 2", true)
:setFooter("This is a footer")

message:replyAsync(responseMessage:setEmbed(responseEmbed))
message:replyAsync(responseMessage:addEmbed(responseEmbed))
end
end)

Expand Down