Discord loader (#976)

This commit is contained in:
Sidharth Mohanty
2023-11-29 23:37:05 +05:30
committed by GitHub
parent 141a23fb1e
commit 38426a7af1
6 changed files with 185 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
---
title: "💬 Discord"
---
To add any Discord channel messages to your app, just add the `channel_id` as the source and set the `data_type` to `discord`.
<Note>
This loader requires a Discord bot token with read messages access.
To obtain the token, follow the instructions provided in this tutorial:
<a href="https://www.writebots.com/discord-bot-token/">How to Get a Discord Bot Token?</a>.
</Note>
```python
import os
from embedchain import Pipeline as App
# add your discord "BOT" token
os.environ["DISCORD_TOKEN"] = "xxx"
app = App()
app.add("1177296711023075338", data_type="discord")
response = app.query("What is Joe saying about Elon Musk?")
print(response)
# Answer: Joe is saying "Elon Musk is a genius".
```

View File

@@ -24,6 +24,7 @@ Embedchain comes with built-in support for various data sources. We handle the c
<Card title="🐬 MySQL" href="/data-sources/mysql"></Card>
<Card title="🤖 Slack" href="/data-sources/slack"></Card>
<Card title="🗨️ Discourse" href="/data-sources/discourse"></Card>
<Card title="💬 Discord" href="/data-sources/discord"></Card>
</CardGroup>
<br/ >

View File

@@ -89,7 +89,8 @@
"data-sources/openapi",
"data-sources/youtube-video",
"data-sources/discourse",
"data-sources/substack"
"data-sources/substack",
"data-sources/discord"
]
},
"data-sources/data-type-handling"