forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.2 KiB
Plaintext
88 lines
2.2 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Discord\n",
|
|
"\n",
|
|
"You can follow the below steps to download your Discord data:\n",
|
|
"\n",
|
|
"1. Go to your **User Settings**\n",
|
|
"2. Then go to **Privacy and Safety**\n",
|
|
"3. Head over to the **Request all of my Data** and click on **Request Data** button\n",
|
|
"\n",
|
|
"It might take 30 days for you to receive your data. You'll receive an email at the address which is registered with Discord. That email will have a download button using which you would be able to download your personal Discord data."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"import os"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"path = input(\"Please enter the path to the contents of the Discord \\\"messages\\\" folder: \")\n",
|
|
"li = []\n",
|
|
"for f in os.listdir(path):\n",
|
|
" expected_csv_path = os.path.join(path, f, 'messages.csv')\n",
|
|
" csv_exists = os.path.isfile(expected_csv_path)\n",
|
|
" if csv_exists:\n",
|
|
" df = pd.read_csv(expected_csv_path, index_col=None, header=0)\n",
|
|
" li.append(df)\n",
|
|
"\n",
|
|
"df = pd.concat(li, axis=0, ignore_index=True, sort=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from langchain.document_loaders.discord import DiscordChatLoader"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"loader = DiscordChatLoader(df, user_id_col=\"ID\")\n",
|
|
"print(loader.load())"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.1"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|