removed premium requirement for dalle

This commit is contained in:
phixxy 2024-03-09 21:26:09 -08:00
parent 0ae40e17e7
commit a7255a613f

View file

@ -16,7 +16,6 @@ class ChatGPT(commands.Cog):
self.API_KEY = os.getenv("openai.api_key")
self.working_dir = "tmp/chatgpt/"
self.data_dir = "data/chatgpt/"
self.premium_role = 1200943915579228170
self.folder_setup()
self.remind_me_loop.start()
self.http_session = self.create_aiohttp_session()
@ -190,15 +189,12 @@ class ChatGPT(commands.Cog):
brief="Get an answer"
)
async def question_gpt4(self, ctx):
if ctx.author.get_role(self.premium_role):
await ctx.send("One moment, let me think...")
question = ctx.message.content.split(" ", maxsplit=1)[1]
answer = await self.answer_question(question, "gpt-4-turbo-preview")
chunks = [answer[i:i+1999] for i in range(0, len(answer), 1999)]
for chunk in chunks:
await ctx.send(chunk)
else:
await ctx.send("Sorry you must be a premium member to use this command. (!donate)")
async def dalle_api_call(self, prompt: str, model: str="dall-e-2", quality: str="standard", size: str="1024x1024") -> tuple:
data = {
@ -228,7 +224,6 @@ class ChatGPT(commands.Cog):
async def generate_dalle_image(self, ctx, model, quality="standard", size="1024x1024") -> None:
if ctx.author.get_role(self.premium_role):
prompt = ctx.message.content.split(" ", maxsplit=1)[1]
await ctx.send(f"Please be patient this may take some time! Generating: {prompt}.")
resp_status, resp = await self.dalle_api_call(prompt, model=model, quality=quality, size=size)
@ -245,8 +240,6 @@ class ChatGPT(commands.Cog):
with open(f"{self.data_dir}logs/dalle3.log", 'a') as log_filepath:
log_filepath.writelines(log_data)
await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f)
else:
await ctx.send("Sorry you must be a premium member to use this command. (!donate)")
@commands.command(