# as-loadingscreen

<https://alva-scripts.com/scripts/7243673>

#### Discord Feed Bridge&#x20;

#### Security (Re~~a~~d This)

**Golden rule:** Only give the bot access to channels you want to display publicly.\
Never allow the bot to view staff/private/ticket/log channels.

***

### Requirements

* Discord bot token

***

### Discord Bot Setup

#### 1) Create a bot

Create a new application + bot in the Discord Developer Portal:\
<https://discord.com/developers/applications?new_application=true>

#### 2) Invite the bot to your server

* The bot does **not** need special permissions
* Just ensure it can **View Channel** + **Read Message History** for the channels you want to expose

![Invite Bot Screenshot](https://i.imgur.com/I03Un23.png)

#### 3) Enable Message Content Intent

Enable **Message Content Intent** so message text is available reliably:

![Enable Message Content Intent Screenshot](https://i.imgur.com/A9Ta51O.png)

#### 4) Copy your bot token

Copy the token (marked as **(1)** in the screenshot above). Keep it secret.

#### 5) Edit your scripts config:

\
Next, you just have to insert the Bot token in the server/discord\_config.lua file!\
\
Here is how it looks:

```lua
local DiscordFeedConfig = {
    enabled = false,
    botToken = "YOUR_DISCORD_TOKEN",
    guildId = "1342863880879345716", -- optional, used to build message URLs/extra validation context
    cacheSeconds = 60,
    requestTimeoutMs = 10000,

    -- make sure the ids and channelIds match what config.js has!
    feeds = {
        { id = "news",   channelId = "1470413761406959732", limit = 25, enabled = true, showAvatars = true },
        { id = "devlog", channelId = "1464942754147598473", limit = 25, enabled = true, showAvatars = true },
        { id = "events", channelId = "1464942768223944725", limit = 15, enabled = true, showAvatars = true },
    }
}
```

Also make sure, that these feeds (channeld and id) match the feeds JSON block found in `build/config.js`&#x20;

```json
  feeds: [
    {
      id: "news",
      type: "discord",
      title: "News",
      subtitle: "Latest announcements",
      enabled: true,
      discord: {
        channelId: "1470413761406959732",
        pollMs: 1000 * 180, // how often to poll for new messages (unused)
        limit: 25,
        showAvatars: true,
      },
    },
    {
      id: "devlog",
      type: "discord",
      title: "Devlog",
      subtitle: "Development updates",
      enabled: true,
      discord: {
        channelId: "1464942754147598473",
        pollMs: 1000 * 180,
        limit: 25,
        showAvatars: true,
      },
    },
    {
      id: "events",
      type: "discord",
      title: "Events",
      subtitle: "Upcoming events",
      enabled: true,
      discord: {
        channelId: "1464942768223944725",
        pollMs: 1000 * 180,
        limit: 15,
        showAvatars: true,
      },
    },
  ],
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alva-scripts.gitbook.io/alva-scripts/as-loadingscreen.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
