added premium role to init

This commit is contained in:
phixxy 2024-01-27 16:54:58 -08:00
parent 309fe00962
commit 9c460d56b2

View file

@ -14,9 +14,11 @@ class ChatGPT(commands.Cog):
self.API_KEY = os.getenv("openai.api_key") self.API_KEY = os.getenv("openai.api_key")
self.working_dir = "tmp/chatgpt/" self.working_dir = "tmp/chatgpt/"
self.data_dir = "data/chatgpt/" self.data_dir = "data/chatgpt/"
self.premium_role = 1200943915579228170
self.folder_setup() self.folder_setup()
self.remind_me_loop.start() self.remind_me_loop.start()
def folder_setup(self): def folder_setup(self):
try: try:
if not os.path.exists(self.working_dir): if not os.path.exists(self.working_dir):
@ -163,7 +165,7 @@ class ChatGPT(commands.Cog):
brief="Get an answer" brief="Get an answer"
) )
async def question_gpt4(self, ctx): async def question_gpt4(self, ctx):
if ctx.author.get_role(1200943915579228170): if ctx.author.get_role(self.premium_role):
question = ctx.message.content.split(" ", maxsplit=1)[1] question = ctx.message.content.split(" ", maxsplit=1)[1]
answer = await self.answer_question(question, "gpt-4") answer = await self.answer_question(question, "gpt-4")
chunks = [answer[i:i+1999] for i in range(0, len(answer), 1999)] chunks = [answer[i:i+1999] for i in range(0, len(answer), 1999)]