32 lines
763 B
Python
Executable File

from discord import option
from discord.ext import commands
class Gpt(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
@commands.slash_command(
guild_ids=None,
name="gpt",
description="Ask dalebot a question, he'll do his best to answer",
)
@option(
name="prompt",
description="What you want to ask dale-bot",
required=True,
)
async def gpt(self, ctx: commands.Context, prompt):
import gpt
# try:
await ctx.defer()
embed = gpt.answer_question(prompt, user=ctx.author.name)
await ctx.send_followup(embed=embed)
# except Exception as e:
# await ctx.send(e)
def setup(bot):
bot.add_cog(Gpt(bot))