题意:Discord.py v2.0: 集成 OpenAI API 的 Cog 组件中的斜杠命令
问题背景:
I have been making a Discord bot using discord.py v2.0 and OpenAI API to make a AI Bot for my personal server. So firstly I will share my code.
我一直在使用 discord.py v2.0 和 OpenAI API 制作一个 Discord 机器人,这个机器人将作为我个人服务器的 AI 助手。首先,我将分享我的代码。
This the main.py file:
这是 main.py
文件:
import os
import asyncio
import discord
from discord.ext import commands
intents = discord.Intents.all()
ceriumAI = commands.Bot(
command_prefix="<>",
intents=intents
)
@ceriumAI.event
async def on_ready():
print("CeriumAI is ready and online!")
@ceriumAI.command()
async def sync(ctx):
synced = await ceriumAI.tree.sync(