Skip to content

Commit d40240c

Browse files
committed
bug fix
1 parent 40089c5 commit d40240c

File tree

3 files changed

+87
-88
lines changed

3 files changed

+87
-88
lines changed

README.md

+76-74
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
<p align="center">
2-
<a href="https://discord.gg/8tcDQ89Ej2">
3-
<img src="https://dcbadge.vercel.app/api/server/8tcDQ89Ej2?style=flat" alt="Discord Follow">
2+
<a href="https://discord.gg/g36Mvyd8Gz">
3+
<img src="https://dcbadge.vercel.app/api/server/g36Mvyd8Gz?style=flat" alt="Discord Follow">
44
</a>
55

6-
<a href="https://github.com/RareMojo/discord-ai">
7-
<img src="https://img.shields.io/github/stars/RareMojo/discord-ai?style=social" alt="GitHub Repo stars">
8-
</a>
9-
10-
<a href="https://www.oracle.com/chatbots/what-is-a-chatbot/">
11-
<img src="https://img.shields.io/badge/Discord-Chatbot-5865F2" alt="Discord Chatbot">
6+
<a href="https://github.com/RareMojo/Discord-AI">
7+
<img src="https://img.shields.io/github/stars/RareMojo/Discord-AI?style=social" alt="GitHub Repo stars">
128
</a>
139

1410
<a href="https://github.com/langchain-ai">
@@ -18,11 +14,15 @@
1814
<a href="https://opensource.org/licenses/MIT">
1915
<img src="https://img.shields.io/badge/License-MIT-yellow" alt="LICENSE">
2016
</a>
17+
18+
<a href="https://discord.gg/8tcDQ89Ej2">
19+
<img src="https://dcbadge.vercel.app/api/server/8tcDQ89Ej2?style=flat" alt="Discord Follow">
20+
</a>
2121
</p>
2222

2323
<br/>
2424
<p align="center">
25-
<h2 align="center">discord-ai</h2><br>
25+
<h2 align="center">Discord-AI</h2><br>
2626

2727
<p align="center">
2828
<img align="center" width="275" height="275" src="https://i.imgur.com/7VclQXi.png">
@@ -36,56 +36,56 @@
3636

3737
<br>
3838

39-
## About discord-ai
39+
## About Discord-AI
4040

41-
discord-ai is a super smart and versatile AI assistant for Discord communities!
41+
Discord-AI is a super smart and versatile AI assistant for Discord communities!
4242

43-
Its primary objective is to serve the specific needs of the discord-ai Discord community. This version you see here is the open-source adaptation, allowing anyone to benefit from its awesome features!
43+
Its primary objective is to serve the specific needs of the GPT Engineer Discord community. This version you see here is the open-source adaptation, allowing anyone to benefit from its awesome features!
4444

45-
Whether you need information, want to chat, interact with documents, code, explore websites, or enjoy some cool Discord-only features, discord-ai has got your back. It's designed to be user-friendly, customizable, and open source – just the way you like it!
45+
Whether you need information, want to chat, interact with documents, code, explore websites, or enjoy some cool Discord-only features, Discord-AI has got your back. It's designed to be user-friendly, customizable, and open source – just the way you like it!
4646

47-
We're all about community here! Join us in making discord-ai even better. Your ideas and contributions are always welcome.
47+
We're all about community here! Join us in making our idea even better. Your thoughts and contributions are always welcome.
4848

49-
Let's level up your Discord experience with discord-ai, the friendly AI chatbot for everyone! 🤖💬
49+
Let's level up your Discord experience with Discord-AI, the friendly AI chatbot for everyone! 🤖💬
5050

5151
<br>
5252

5353
## Prerequisites
5454

5555
Before you begin, ensure you have met the following requirements:
5656

57-
- [Python 3.10+](https://www.python.org/downloads/)
58-
- **Windows/Linux/MacOS**
59-
- [Discord App](https://discordpy.readthedocs.io/en/stable/discord.html)
57+
- [Python 3.10+](https://www.python.org/downloads/)
58+
- **Windows/Linux/MacOS**
59+
- [Discord App](https://discordpy.readthedocs.io/en/stable/discord.html)
6060

6161
<br>
6262

6363
### OpenAI API Key
6464

65-
1. **Sign up at OpenAI**: Visit the [OpenAI website](https://www.openai.com/) and sign up for an account.
66-
2. **Obtain your API key**: Click your profile icon and select "**View API keys**" from the dropdown menu. Then, click the "**Create new secret key**" button to generate a new API key.
65+
1. **Sign up at OpenAI**: Visit the [OpenAI website](https://www.openai.com/) and sign up for an account.
66+
2. **Obtain your API key**: Click your profile icon and select "**View API keys**" from the dropdown menu. Then, click the "**Create new secret key**" button to generate a new API key.
6767

6868
<br>
6969

7070
### Pinecone DB
7171

72-
1. **Sign up for Pinecone**: Visit the [Pinecone website](https://www.pinecone.io/) and sign up for an account.
73-
2. **Get your Pinecone API key**: After signing up, navigate to your dashboard and obtain your **Pinecone API key, index, and environment**. Watch this [Video Tutorial](https://youtu.be/dnEfQhjZgw0?t=328) for assistance.
72+
1. **Sign up for Pinecone**: Visit the [Pinecone website](https://www.pinecone.io/) and sign up for an account.
73+
2. **Get your Pinecone API key**: After signing up, navigate to your dashboard and obtain your **Pinecone API key, index, and environment**. Watch this [Video Tutorial](https://youtu.be/dnEfQhjZgw0?t=328) for assistance.
7474

7575
<br>
7676

7777
### MongoDB
7878

79-
1. **Sign up for Railway**: Visit the [Railway.app website](https://railway.app/) and sign up for an account.
80-
2. **Create a new project**: Follow the [official Railway documentation](https://docs.railway.app/getting-started#create-a-project) to create a new project.
81-
3. **Add MongoDB plugin**: In your Railway project, add the MongoDB plugin by following the [official Railway documentation](https://docs.railway.app/getting-started).
82-
4. **Get your MongoDB URI**: After adding the MongoDB plugin, navigate to the plugin settings and obtain your **MongoDB URI**. Watch this [Video Tutorial](https://www.youtube.com/watch?v=tp0bQNDtLPc&t=88s) for assistance.
79+
1. **Sign up for Railway**: Visit the [Railway.app website](https://railway.app/) and sign up for an account.
80+
2. **Create a new project**: Follow the [official Railway documentation](https://docs.railway.app/getting-started#create-a-project) to create a new project.
81+
3. **Add MongoDB plugin**: In your Railway project, add the MongoDB plugin by following the [official Railway documentation](https://docs.railway.app/getting-started).
82+
4. **Get your MongoDB URI**: After adding the MongoDB plugin, navigate to the plugin settings and obtain your **MongoDB URI**. Watch this [Video Tutorial](https://www.youtube.com/watch?v=tp0bQNDtLPc&t=88s) for assistance.
8383

8484
<br>
8585

8686
## Installation
8787

88-
To install discord-ai, follow these steps:
88+
To install Discord-AI, follow these steps:
8989

9090
<br>
9191

@@ -143,37 +143,35 @@ To install discord-ai, follow these steps:
143143

144144
2. `configs\config.json`:
145145

146-
- You will be prompted to fill out the required parts of this during setup automatically.
147-
- You may directly edit this file to change anything as well.
148-
- If you change something that should be updated with the Discord servers, change `update_bot` to true.
149-
- You can also edit most of the config values via the bot terminal.
146+
- You will be prompted to fill out the required parts of this during setup automatically.
147+
- You may directly edit this file to change anything as well.
148+
- If you change something that should be updated with the Discord servers, change `update_bot` to true.
149+
- You can also edit most of the config values via the bot terminal.
150150

151151
<br>
152152

153153
3. `configs\preprompts`:
154154

155-
<br>
156-
157-
- This is a small preprompt that is injected before chat interactions.
158-
- It maintains small details such as the bot's name and personality.
159-
- You may directly edit this to fit your needs.
155+
- This is a small preprompt that is injected before chat interactions.
156+
- It maintains small details such as the bot's name and personality.
157+
- You may directly edit this to fit your needs.
160158

161159
<br>
162160

163161
4. `TMUX (Optional)`:
164162

165-
- This is used to run the bot like a service in a separate terminal.
166-
- You can install it by running `sudo apt install tmux` on Linux.
167-
- Feel free to use other methods of running the bot in the background.
168-
- [TMUX Tutorial](https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/)
163+
- This is used to run the bot like a service in a separate terminal.
164+
- You can install it by running `sudo apt install tmux` on Linux.
165+
- Feel free to use other methods of running the bot in the background.
166+
- [TMUX Tutorial](https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/)
169167

170168
<br>
171169

172170
## Usage
173171

174-
After installation and configuration, the bot will run automatically.
175-
It uses the GPT model to interact with users in the specified Discord channel.
176-
Currently, it can ingest ReadTheDocs URLs and provide help using it as context.
172+
After installation and configuration, the bot will run automatically.<br>
173+
It uses the GPT model to interact with users in the specified Discord channel.<br>
174+
Currently, it can ingest ReadTheDocs URLs and provide help using it as context.<br>
177175

178176
<br>
179177

@@ -182,71 +180,75 @@ Here is a step-by-step guide on how to use the bot:
182180
<br>
183181

184182
1. **Channel Setup**:
185-
- The bot can be set up in any channel of your Discord server. This is an example of a proper setup. Copy the category ID and paste it in the `.env` file.
186-
- You do not need to have the same names or exact setup. This is just recommended. Just make certain you use the correct channel IDs.
187183

188-
![Channel Setup](https://i.imgur.com/ex0aM7t.png)
184+
- The bot can be set up in any channel of your Discord server.
185+
- This is an example of a proper setup. Copy the category ID and paste it in the `.env` file.
186+
- Yours does not need to be the same. Just make certain you use the correct channel IDs.
187+
188+
![Channel Setup](https://i.imgur.com/ex0aM7t.png)
189189

190190
<br>
191191

192192
2. **Thread Listing**:
193-
- This is an example of the thread listing within the threads section that is to be used for generic agent interaction.
194-
- Copy the thread channel ID and paste it in the `.env` file.
195193

196-
![Thread Listing](https://i.imgur.com/iImvMSV.png)
194+
- This is an example of the thread listing within the threads section that is to be used for generic agent interaction.
195+
- Copy the thread channel ID and paste it in the `.env` file.
196+
197+
![Thread Listing](https://i.imgur.com/iImvMSV.png)
197198

198199
<br>
199200

200201
3. **Help DB**:
201-
- The bot can provide help related to database commands.
202-
- Use the `/helpdb` command to get a list of all database related commands.
203202

204-
![Help DB](https://i.imgur.com/zlTwiwT.png)
203+
- The bot can provide help related to database commands.
204+
- Use the `/helpdb` command to get a list of all database related commands.
205+
206+
![Help DB](https://i.imgur.com/zlTwiwT.png)
205207

206208
<br>
207209

208210
4. **Ingest DB**:
209-
- The bot can ingest data into the database.
210-
- Currently, the only supported data type is ReadTheDocs URLs.
211-
- Example: https://gpt-engineer.readthedocs.io/en/latest/
212-
- Use the `/ingestdb` command followed by the data you want to ingest and a name for the data.
213211

214-
![Ingest DB](https://i.imgur.com/UbnrjV4.png)
212+
- The bot can ingest data into the database.
213+
- Currently, the only supported data type is ReadTheDocs URLs.
214+
- Example: https://gpt-engineer.readthedocs.io/en/latest/
215+
- Use the `/ingestdb` command followed by the data you want to ingest and a name for the data.
216+
217+
![Ingest DB](https://i.imgur.com/UbnrjV4.png)
215218

216219
<br>
217220

218221
5. **List DB**:
219-
- The bot can list all the data in the database.
220-
- Use the `/listdb` command to get a list of all the data in the database.
221222

222-
![List DB](https://i.imgur.com/fgbQvrn.png)
223+
- The bot can list all the data in the database.
224+
- Use the `/listdb` command to get a list of all the data in the database.
225+
226+
![List DB](https://i.imgur.com/fgbQvrn.png)
223227

224228
<br>
225229

226230
6. **AI Chat**:
227-
- The bot can interact with users in the specified Discord channel.
228-
- Make a thread in the designated ai-chat thread, and the chatbot will automatically start interacting with you.
229231

230-
![AI Chat](https://i.imgur.com/tVVMnYP.png)
232+
- The bot can interact with users in the specified Discord channel.
233+
- Make a thread in the designated ai-chat thread, and the chatbot will automatically start interacting with you.
234+
235+
![AI Chat](https://i.imgur.com/tVVMnYP.png)
231236

232237
<br>
233238

234239
7. **Ask DB**:
235-
- The bot can fetch information from the database.
236-
- Use the `/askdb` command followed by your query and the db ID to get the required information.
237-
- The ID is set to the `gpt-engineer-docs` database by default.
238240

239-
![Ask DB](https://i.imgur.com/Y1enGPn.png)
240-
241-
<br>
241+
- The bot can fetch information from the database.
242+
- Use the `/askdb` command followed by your query and the db ID to get the required information.
243+
- The ID is set to the `gpt-engineer-docs` database by default.
242244

243-
Remember to replace the command prefix `/` with the prefix you have set for your bot. Enjoy interacting with your GPT Engineer Discord Bot!
245+
![Ask DB](https://i.imgur.com/Y1enGPn.png)
244246

245247
<br>
246248

247-
## Contributing to discord-ai
249+
## Contributing to Discord-AI
248250

249-
To contribute to discord-ai, follow these steps:
251+
To contribute to Discord-AI, follow these steps:
250252

251253
<br>
252254

@@ -273,7 +275,7 @@ Thank you, Haste171, for inspiring developers and allowing others to incorporate
273275
<br>
274276

275277
## License
276-
`discord-ai` is completely open source, licensed under the [MIT](https://opensource.org/licenses/MIT) license.
277-
See [LICENSE.md](https://github.com/RareMojo/discord-ai/blob/main/LICENSE.md) for more information.
278+
`Discord-AI` is completely open source, licensed under the [MIT](https://opensource.org/licenses/MIT) license.
279+
See [LICENSE.md](https://github.com/RareMojo/Discord-AI/blob/main/LICENSE.md) for more information.
278280

279281
Logo was made with the amazing and fun to use [Stable Diffusion](https://huggingface.co/stabilityai)

cogs/AskDB/deletedb_cog.py

+8-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, bot: "Bot"):
3232
bot (Bot): The bot instance.
3333
"""
3434
self.bot = bot
35-
35+
3636
@commands.hybrid_command()
3737
async def deletedb(self, ctx: commands.Context, db_id: str):
3838
"""
@@ -63,27 +63,24 @@ async def deletedb(self, ctx: commands.Context, db_id: str):
6363
if not handler.check_exists(db_id=db_id):
6464
await ctx.send(embed=discord.Embed(title="Error", color=embed_color_failure, description="The DB ID you provided does not exist."), ephemeral=True)
6565
return
66+
6667
await ctx.defer(ephemeral=True)
6768
user_id = str(ctx.author.id)
69+
db_name = handler.get_db_name(user_id=user_id, db_id=db_id)
6870
r = handler.delete_db(user_id=user_id, db_id=db_id)
69-
if r:
70-
db_name = handler.get_db_name(user_id=user_id, db_id=db_id)
71+
if r is True:
7172
log_debug(self.bot, f"Successfully deleted DB with ID: {db_id}")
7273
embed = discord.Embed(title="Status", color=embed_color_success)
7374
embed.add_field(
7475
name="Status",
7576
value=f"Successfully deleted!\n**DB name:** `{db_name}`\n**DB ID:** `{db_id}`",
7677
inline=True,
7778
)
79+
await ctx.send(embed=embed, ephemeral=True)
7880
else:
79-
log_debug(self.bot, f"DB with ID {db_id} not found.")
80-
embed = discord.Embed(title="Error", color=embed_color_failure)
81-
embed.add_field(
82-
name="Error",
83-
value=f"DB with ID {db_id} not found. No action was taken.",
84-
inline=True,
85-
)
86-
await ctx.send(embed=embed)
81+
log_debug(self.bot, f"Failed to delete DB with ID: {db_id}")
82+
await ctx.send(embed=discord.Embed(title="Error", color=embed_color_failure, description="Failed to delete the DB."), ephemeral=True)
83+
8784

8885

8986
async def setup(bot: "Bot") -> None:

discord_bot/logger.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class LoggerFormat(logging.Formatter):
9191
Examples:
9292
>>> formatter = LoggerFormat()
9393
>>> formatter.format(logging.LogRecord('my_logger', logging.INFO, 'my_message'))
94-
'(black)2020-09-09 12:00:00(reset) (levelcolor)INFO (black)[(reset)(purple)discord-ai(black)] >(reset) my_message'
94+
'(black)2020-09-09 12:00:00(reset) (levelcolor)INFO (black)[(reset)(purple)Discord-AI(black)] >(reset) my_message'
9595
"""
9696

9797
black = "\x1b[30m"
@@ -122,10 +122,10 @@ def format(self, record: logging.LogRecord):
122122
Examples:
123123
>>> formatter = LoggerFormat()
124124
>>> formatter.format(logging.LogRecord('my_logger', logging.INFO, 'my_message'))
125-
'(black)2020-09-09 12:00:00(reset) (levelcolor)INFO (black)[(reset)(purple)discord-ai(black)] >(reset) my_message'
125+
'(black)2020-09-09 12:00:00(reset) (levelcolor)INFO (black)[(reset)(purple)Discord-AI(black)] >(reset) my_message'
126126
"""
127127
log_color = self.COLORS[record.levelno]
128-
format = "(black){asctime}(reset) (levelcolor){levelname: <8}(black)[(reset)(purple)discord-ai(black)] >(reset) {message}"
128+
format = "(black){asctime}(reset) (levelcolor){levelname: <8}(black)[(reset)(purple)Discord-AI(black)] >(reset) {message}"
129129
format = format.replace("(black)", self.black + self.bold)
130130
format = format.replace("(reset)", self.reset)
131131
format = format.replace("(gray)", self.gray + self.bold)

0 commit comments

Comments
 (0)