Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

Commit 90fee55

Browse files
committed
Disable all OpenAI-related commands
It appears that these commands were causing the entire `utils` cog to fail, due to a broken OpenAI import. This led to NONE of the commands from the `utils` cog appearing, which led to the loss of many other commands too. This update aims to restore maximum functionality by preventing the missing OpenAI import for the AI commands to cause failure while loading the cog.
1 parent 5ecb499 commit 90fee55

1 file changed

Lines changed: 79 additions & 79 deletions

File tree

cogs/utils.py

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -181,86 +181,86 @@ async def status(self, ctx: ApplicationContext):
181181
localembed.set_footer(text=f"Requested by {ctx.author.name}", icon_url=ctx.author.avatar)
182182
await ctx.respond(embed=localembed)
183183

184-
@commands.slash_command(
185-
name="chatgpt",
186-
description="Talk to ChatGPT and get a response back."
187-
)
188-
@option(name="message", description="What do you want to send to ChatGPT?", type=str)
189-
@commands.cooldown(1, 1, commands.BucketType.user)
190-
async def chatgpt(self, ctx: ApplicationContext, message: str):
191-
"""Talk to ChatGPT and get a response back."""
192-
if str(ctx.author.id) not in chatgpt_conversation:
193-
chatgpt_conversation[str(ctx.author.id)] = [
194-
{
195-
"role": "system",
196-
"content": "You are a intelligent assistant."
197-
}
198-
]
199-
await ctx.defer()
200-
try:
201-
chatgpt_conversation[str(ctx.author.id)].append({"role": "user", "content": message})
202-
_chat = openai.ChatCompletion.create(
203-
model="gpt-3.5-turbo",
204-
messages=chatgpt_conversation[str(ctx.author.id)]
205-
)
206-
_reply = _chat.choices[0].message.content
207-
chatgpt_conversation[str(ctx.author.id)].append({"role": "assistant", "content": _reply})
208-
except openai.error.RateLimitError as e:
209-
print(f"Rate limit for OpenAI exceeded: {e}")
210-
return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True)
211-
except openai.error.ServiceUnavailableError:
212-
return await ctx.respond("The ChatGPT service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True)
213-
except openai.error.APIError:
214-
return await ctx.respond("ChatGPT encountered an internal error. Please try again.", ephemeral=True)
215-
except openai.error.Timeout:
216-
return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True)
217-
localembed = discord.Embed(description=f"{_reply}", color=discord.Color.random())
218-
localembed.set_author(name="ChatGPT", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png")
219-
localembed.set_footer(text="Powered by OpenAI")
220-
await ctx.respond(embed=localembed)
184+
# @commands.slash_command(
185+
# name="chatgpt",
186+
# description="Talk to ChatGPT and get a response back."
187+
# )
188+
# @option(name="message", description="What do you want to send to ChatGPT?", type=str)
189+
# @commands.cooldown(1, 1, commands.BucketType.user)
190+
# async def chatgpt(self, ctx: ApplicationContext, message: str):
191+
# """Talk to ChatGPT and get a response back."""
192+
# if str(ctx.author.id) not in chatgpt_conversation:
193+
# chatgpt_conversation[str(ctx.author.id)] = [
194+
# {
195+
# "role": "system",
196+
# "content": "You are a intelligent assistant."
197+
# }
198+
# ]
199+
# await ctx.defer()
200+
# try:
201+
# chatgpt_conversation[str(ctx.author.id)].append({"role": "user", "content": message})
202+
# _chat = openai.ChatCompletion.create(
203+
# model="gpt-3.5-turbo",
204+
# messages=chatgpt_conversation[str(ctx.author.id)]
205+
# )
206+
# _reply = _chat.choices[0].message.content
207+
# chatgpt_conversation[str(ctx.author.id)].append({"role": "assistant", "content": _reply})
208+
# except openai.error.RateLimitError as e:
209+
# print(f"Rate limit for OpenAI exceeded: {e}")
210+
# return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True)
211+
# except openai.error.ServiceUnavailableError:
212+
# return await ctx.respond("The ChatGPT service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True)
213+
# except openai.error.APIError:
214+
# return await ctx.respond("ChatGPT encountered an internal error. Please try again.", ephemeral=True)
215+
# except openai.error.Timeout:
216+
# return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True)
217+
# localembed = discord.Embed(description=f"{_reply}", color=discord.Color.random())
218+
# localembed.set_author(name="ChatGPT", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png")
219+
# localembed.set_footer(text="Powered by OpenAI")
220+
# await ctx.respond(embed=localembed)
221221

222-
@commands.slash_command(
223-
name="generate_image",
224-
description="Generate an image of your choice using the DALL-E modal."
225-
)
226-
@option(name="prompt", description="What image do you want the bot to generate?", type=str)
227-
@option(name="resolution", description="Set a custom resolution for your generated image", type=str, default="512x512", choices=["256x256", "512x512", "1024x1024"])
228-
@commands.cooldown(1, 10, commands.BucketType.user)
229-
async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: str = "512x512"):
230-
"""Generate an image of your choice using the DALL-E modal."""
231-
parsed_resolution: list = resolution.split("x")
232-
max_index: int = 0
233-
for index in parsed_resolution:
234-
max_index += 1
235-
if max_index < 2 or max_index > 2:
236-
return await ctx.respond("Your resolution format is malformed. Please check it and try again.", ephemeral=True)
237-
res_width = int(parsed_resolution[0])
238-
res_height = int(parsed_resolution[1])
239-
if res_width < 256 or res_height < 256:
240-
return await ctx.respond("Your custom resolution needs to be at least 256p or higher.", ephermeral=True)
241-
if res_width > 1024 or res_height > 1024:
242-
return await ctx.respond("Your image output resolution cannot exceed 1024p.", ephemeral=True)
243-
await ctx.defer()
244-
try:
245-
response = openai.Image.create(
246-
prompt=prompt,
247-
n=1,
248-
size=resolution
249-
)
250-
generated_image_url = response['data'][0]['url']
251-
except openai.error.RateLimitError:
252-
return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True)
253-
except openai.error.ServiceUnavailableError:
254-
return await ctx.respond("The OpenAI service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True)
255-
except openai.error.APIError:
256-
return await ctx.respond("DALL-E encountered an internal error. Please try again.", ephemeral=True)
257-
except openai.error.Timeout:
258-
return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True)
259-
localembed = discord.Embed(title="Here's an image generated using your prompt.", color=discord.Color.random())
260-
localembed.set_image(url=generated_image_url)
261-
localembed.set_author(name="DALL-E", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png")
262-
localembed.set_footer(text="Powered by OpenAI")
263-
await ctx.respond(embed=localembed)
222+
# @commands.slash_command(
223+
# name="generate_image",
224+
# description="Generate an image of your choice using the DALL-E modal."
225+
# )
226+
# @option(name="prompt", description="What image do you want the bot to generate?", type=str)
227+
# @option(name="resolution", description="Set a custom resolution for your generated image", type=str, default="512x512", choices=["256x256", "512x512", "1024x1024"])
228+
# @commands.cooldown(1, 10, commands.BucketType.user)
229+
# async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: str = "512x512"):
230+
# """Generate an image of your choice using the DALL-E modal."""
231+
# parsed_resolution: list = resolution.split("x")
232+
# max_index: int = 0
233+
# for index in parsed_resolution:
234+
# max_index += 1
235+
# if max_index < 2 or max_index > 2:
236+
# return await ctx.respond("Your resolution format is malformed. Please check it and try again.", ephemeral=True)
237+
# res_width = int(parsed_resolution[0])
238+
# res_height = int(parsed_resolution[1])
239+
# if res_width < 256 or res_height < 256:
240+
# return await ctx.respond("Your custom resolution needs to be at least 256p or higher.", ephermeral=True)
241+
# if res_width > 1024 or res_height > 1024:
242+
# return await ctx.respond("Your image output resolution cannot exceed 1024p.", ephemeral=True)
243+
# await ctx.defer()
244+
# try:
245+
# response = openai.Image.create(
246+
# prompt=prompt,
247+
# n=1,
248+
# size=resolution
249+
# )
250+
# generated_image_url = response['data'][0]['url']
251+
# except openai.error.RateLimitError:
252+
# return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True)
253+
# except openai.error.ServiceUnavailableError:
254+
# return await ctx.respond("The OpenAI service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True)
255+
# except openai.error.APIError:
256+
# return await ctx.respond("DALL-E encountered an internal error. Please try again.", ephemeral=True)
257+
# except openai.error.Timeout:
258+
# return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True)
259+
# localembed = discord.Embed(title="Here's an image generated using your prompt.", color=discord.Color.random())
260+
# localembed.set_image(url=generated_image_url)
261+
# localembed.set_author(name="DALL-E", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png")
262+
# localembed.set_footer(text="Powered by OpenAI")
263+
# await ctx.respond(embed=localembed)
264264

265265
@commands.slash_command(
266266
name="vote",

0 commit comments

Comments
 (0)