I got this error after running the code: File "C:\BOT Music\BM.py", line 8, in bot = commands.Bot(command_prefix="!") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: BotBase.init() missing 1 required keyword-only argument: 'intents' I have tried over and over again many of the methods that Bard AI suggests but the above error always appears and this is my code copied from AI Bard:
import os
from dotenv import load_dotenv
from googleapiclient.discovery import build
from discord.ext import commands
from discord.utils import get
import discord_py_opus
DISCORD_TOKEN = os.getenv("...")
intents = discord.Intents.default()
intents.voice = True
bot = commands.Bot(command_prefix="!", intents=intents, token=DISCORD_TOKEN)
youtube = build("youtube", "v3", developerKey=os.getenv("DEVELOPER_KEY"))
current_song = None
opus = discord_py_opus.OpusEncoder()
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
....
bot.run()`
I hope it can be fixed
Bard knows very little. Always check the docs after you use AI, AI can hallucinate rather easily.
I cannot test your code or reproduce the error because it is a somewhat involved process to get a discord token.
Perusing the docs on Command and the API reference, I have noticed some things.
intents.message_content = True
.I also notice a stray backtic (`) in your code at the end, something AIs like bard put at the end of code examples a lot because code often occurrs in markdown blocks. This should also be removed.
I know this isn't much of an answer, but it's the best I've got under the circumstances.