diff --git a/docs/images/discord-add-bot-to-server.png b/docs/images/discord-add-bot-to-server.png new file mode 100644 index 00000000..6aab6f2f Binary files /dev/null and b/docs/images/discord-add-bot-to-server.png differ diff --git a/docs/images/discord-change-bot-permissions-2.png b/docs/images/discord-change-bot-permissions-2.png new file mode 100644 index 00000000..89eb02e6 Binary files /dev/null and b/docs/images/discord-change-bot-permissions-2.png differ diff --git a/docs/images/discord-change-bot-permissions.png b/docs/images/discord-change-bot-permissions.png new file mode 100644 index 00000000..9cefcf78 Binary files /dev/null and b/docs/images/discord-change-bot-permissions.png differ diff --git a/docs/images/discord-copy-bot-token.png b/docs/images/discord-copy-bot-token.png new file mode 100644 index 00000000..97f4b528 Binary files /dev/null and b/docs/images/discord-copy-bot-token.png differ diff --git a/docs/images/discord-create-a-new-application.png b/docs/images/discord-create-a-new-application.png new file mode 100644 index 00000000..712516ee Binary files /dev/null and b/docs/images/discord-create-a-new-application.png differ diff --git a/docs/images/discord-get-all-guilds.png b/docs/images/discord-get-all-guilds.png new file mode 100644 index 00000000..0888dc1c Binary files /dev/null and b/docs/images/discord-get-all-guilds.png differ diff --git a/docs/images/discord-get-guild-channels.png b/docs/images/discord-get-guild-channels.png new file mode 100644 index 00000000..1d68f2a8 Binary files /dev/null and b/docs/images/discord-get-guild-channels.png differ diff --git a/docs/images/discord-install-link.png b/docs/images/discord-install-link.png new file mode 100644 index 00000000..bca202f3 Binary files /dev/null and b/docs/images/discord-install-link.png differ diff --git a/docs/images/discord-message-content-intent.png b/docs/images/discord-message-content-intent.png new file mode 100644 index 00000000..fb9b6c72 Binary files /dev/null and b/docs/images/discord-message-content-intent.png differ diff --git a/docs/images/discord-verify-bot.png b/docs/images/discord-verify-bot.png new file mode 100644 index 00000000..0cecd23e Binary files /dev/null and b/docs/images/discord-verify-bot.png differ diff --git a/docs/oracle-node/discord-data.md b/docs/oracle-node/discord-data.md index d5d28ea4..9450f0f1 100644 --- a/docs/oracle-node/discord-data.md +++ b/docs/oracle-node/discord-data.md @@ -31,10 +31,20 @@ The Service Manager assesses the request and delegates the task to the appropria ## Discord Endpoints -The API provides one endpoint for interacting with Discord user data: +### Getting Guild and Channel IDs + +To get all guilds (and their IDs) you can use the `/data/discord/guilds/all` endpoint. + +> ![Get Guilds](../images/discord-get-all-guilds.png) + +With the guild ID you can then use the `/data/discord/guilds/{guildID}/channels` endpoint to get all channels for that guild. + +> ![Get Channels](../images/discord-get-guild-channels.png) ### Retrieve User Profile +The API provides one endpoint for interacting with Discord user data: + The `/data/discord/users/{userID}` endpoint retrieves a Discord user's profile. This can be particularly useful for understanding user demographics, personalizing interactions, or for further analysis in combination with other data points. - **Endpoint:** `/data/discord/users/{userID}` @@ -63,6 +73,10 @@ Example response: ### Retrieve Messages from a Discord Channel +> **Important**: To retrieve message content, you must toggle "Message Content Intent" in the Discord Developer Portal under the `Bot` section. +> +> ![Message Content Intent](../images/discord-message-content-intent.png) + The `/data/discord/channels/{channelID}/messages` endpoint retrieves messages from a specified Discord channel. - **Endpoint:** `/data/discord/channels/{channelID}/messages` @@ -162,11 +176,11 @@ Imagine a decentralized AI agent, "CommunityEngageAI," designed to analyze engag ### How CommunityEngageAI Leverages AI -1. **Data Collection:** CommunityEngageAI sends queries to the various endpoints to fetch profiles of active community members, messages from channels, and other relevant data. +1 . **Data Collection:** CommunityEngageAI sends queries to the various endpoints to fetch profiles of active community members, messages from channels, and other relevant data. -2. **Engagement Analysis:** Upon retrieving the data, CommunityEngageAI employs AI models to analyze engagement patterns, identify key influencers, and understand user demographics. +2 . **Engagement Analysis:** Upon retrieving the data, CommunityEngageAI employs AI models to analyze engagement patterns, identify key influencers, and understand user demographics. -3. **Personalized Interactions:** Leveraging the insights gained, CommunityEngageAI customizes interactions with community members, tailoring messages and content to enhance engagement and user satisfaction. +3 . **Personalized Interactions:** Leveraging the insights gained, CommunityEngageAI customizes interactions with community members, tailoring messages and content to enhance engagement and user satisfaction. ### Conclusion diff --git a/docs/oracle-node/discord-sentiment.md b/docs/oracle-node/discord-sentiment.md index b838b550..dc6f9ecb 100644 --- a/docs/oracle-node/discord-sentiment.md +++ b/docs/oracle-node/discord-sentiment.md @@ -15,6 +15,10 @@ The Discord sentiment analysis feature extends the Masa Node's capabilities to i The sentiment analysis process begins by collecting Discord messages based on specific channel IDs, followed by sentiment evaluation using the chosen language models. The system is compatible with a variety of models, such as Claude and GPT variants, ensuring versatile and robust sentiment analysis. +> **Important**: To retrieve message content, you must toggle "Message Content Intent" in the Discord Developer Portal under the `Bot` section. +> +> ![Message Content Intent](../images/discord-message-content-intent.png) + ### Models ```go diff --git a/docs/worker-node/discord-worker.md b/docs/worker-node/discord-worker.md index 3ab47577..8d34edfd 100644 --- a/docs/worker-node/discord-worker.md +++ b/docs/worker-node/discord-worker.md @@ -24,18 +24,63 @@ As a worker in the Masa Oracle Node network, your primary function is to process To become a worker focused on Discord data requests, you need to: - Have your Masa Oracle Node staked as outlined in the [Staking Guide for Masa Oracle Node](staking-guide.md). +- Create a Discord bot as outlined in the [Creating a Discord Bot](#creating-a-discord-bot) section. - Add your Discord bot token to your node's `.env` file. This is crucial for authenticating with the Discord API and fetching data. - Ensure your Masa Oracle Node is up and running, with network accessibility for receiving and processing requests. -## Retrieving Your Discord Bot Token +## Creating a Discord Bot + +### Create a new Bot Application To start processing Discord data requests, you need to retrieve your Discord bot token, which is essential for authenticating with the Discord API. This token will allow your bot to collect data on your guild. Here's how to get your token: 1 . Go to the [Discord Developer Portal](https://discord.com/developers/applications). + 2 . Log in with your Discord account credentials. + 3 . Click on the "New Application" button. Give your application a name and confirm the creation. -4 . Navigate to the "Bot" tab on the left-hand side and click on "Reset Token". -5 . Under the "TOKEN" section, click on "Copy" to get your bot token. + +> ![Create a New Application](../images/discord-create-a-new-application.png) + +### Update Bot permissions and install + +1 . Go to the “Guild Install” section + +2 . Select on dropdown where is says “applications.commands and select “bot” + +> ![Update Bot Permissions](../images/discord-change-bot-permissions.png) + +3 . On the added permission dropdown after selecting bot, select “administrator” + +4 . Save changes on the bottom floating bar. + +> ![Save Bot Permissions](../images/discord-change-bot-permissions-2.png) + +5 . Copy the install link + +> ![Copy Install Link](../images/discord-install-link.png) + +6 . Go to a new tab on your browser and paste the link and then hit enter + +7 . You will go to Discord and see a modal click on add to server + +8 . Select add to server dropdown and select the guild to add your new bot to your guild. + +> Description + +9 . Click “Continue” + +10 . Click Authorize to add your bot. Congrats screen and should see Bot on Discord now! + +> ![Bot Added](../images/discord-verify-bot.png) + +### Retrieving Your Discord Bot Token + +1 . Navigate to the "Bot" tab on the left-hand side and click on "Reset Token". + +2 . Under the "TOKEN" section, click on "Copy" to get your bot token. + +> ![Copy Token](../images/discord-copy-bot-token.png) ### Adding Discord Credentials @@ -48,7 +93,7 @@ DISCORD_BOT_TOKEN='your_discord_bot_token' DISCORD_SCRAPER=true ``` -3 . Save the `.env` file and restart your node to apply the changes. +3 . Save the `.env` file and restart your node (`make run`) to apply the changes. ### 3) Verifying Node Configuration