Skip to content

Commit

Permalink
gpt4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mole1424 committed Apr 1, 2024
1 parent bffda96 commit becd18d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ openai = "~=0.27.2"
psycopg = {extras = ["binary"], version = "~=3.1"}
pytimeparse = "*"
markovify = "*"
deep-translator = "*"

[dev-packages]
black = "~=22.12"
Expand Down
10 changes: 9 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions cogs/commands/misc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random

import markovify
from deep_translator import GoogleTranslator
from discord.ext import commands
from discord.ext.commands import Bot, Context

Expand Down Expand Up @@ -129,8 +130,18 @@ async def babbage(self, ctx: Context):
)

@commands.hybrid_command()
async def chat(self, ctx: Context, message: str = None):
await ctx.send(self.model.make_sentence())
async def chat(self, ctx: Context, message: str = None, gpt4: bool = False):
message = self.model.make_sentence()
translated = (
GoogleTranslator(source="en", target="en").translate(message)
if gpt4
else message
)
await ctx.send(translated)

@commands.hybrid_command()
async def gpt4(self, ctx: Context, message: str):
await self.chat(ctx, message, True)


async def setup(bot: Bot):
Expand Down

0 comments on commit becd18d

Please sign in to comment.