From c3540ea7f288359fb331552f183a4fc93d857eea Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Jun 2023 22:32:16 +0200 Subject: [PATCH] Cleaned up a bit and updated README --- README.md | 4 ++- reginaldgptCog/__init__.py | 6 ----- reginaldgptCog/reginaldgpt.py | 48 ----------------------------------- 3 files changed, 3 insertions(+), 55 deletions(-) delete mode 100644 reginaldgptCog/__init__.py delete mode 100644 reginaldgptCog/reginaldgpt.py diff --git a/README.md b/README.md index 9a9d71a..0e71350 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,6 @@ ## Our Cogs: - [WelcomeCog](./welcomeCog) -- [TrafficCog](./trafficCog) \ No newline at end of file +- [TrafficCog](./trafficCog) +- [recruitmentCog](./recruitmentCog/) +- [reginaldCog](./reginaldCog/) \ No newline at end of file diff --git a/reginaldgptCog/__init__.py b/reginaldgptCog/__init__.py deleted file mode 100644 index c4c2a5e..0000000 --- a/reginaldgptCog/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from redbot.core.bot import Red -from .reginaldgpt import ReginaldGptCog - -def setup(bot: Red): - cog = ReginaldGptCog(bot) - bot.add_cog(cog) \ No newline at end of file diff --git a/reginaldgptCog/reginaldgpt.py b/reginaldgptCog/reginaldgpt.py deleted file mode 100644 index 04e1f4a..0000000 --- a/reginaldgptCog/reginaldgpt.py +++ /dev/null @@ -1,48 +0,0 @@ -import discord -import os -from redbot.core import Config, checks, commands -import openai - -class ReginaldGptCog(commands.Cog): - def __init__(self, bot): - self.bot = bot - self.config = Config.get_conf(self, identifier=71717171171717) - self.config.register_global(api_key=None) - - @commands.guild_only() - @checks.admin_or_permissions(manage_guild=True) - async def reginaldgpt(self, ctx, *, message): - try: - api_key = await self.config.api_key() - openai.api_key = api_key - - response = openai.ChatCompletion.create( - model="gpt-3.5-turbo", - messages=[ - {"role": "system", "content": "You are a helpful assistant who responds succinctly"}, - {"role": "user", "content": message} - ] - ) - - content = response['choices'][0]['text'] - finish_reason = response['choices'][0]['finish_reason'] - - if finish_reason == 'stop': - await ctx.send(content) - else: - await ctx.send(f"Response not completed. Finish reason: {finish_reason}") - - except Exception as e: - await ctx.send("As an AI robot, I errored out.") - - @commands.guild_only() - @checks.admin_or_permissions(manage_guild=True) - @commands.command() - async def setreginaldgptapikey(self, ctx, api_key): - await self.config.api_key.set(api_key) - openai.api_key = api_key - await ctx.send("ReginaldGpt API key has been set.") - -def setup(bot): - cog = ReginaldGptCog(bot) - bot.add_cog(cog) \ No newline at end of file