Closed lamps-dev closed 1 month ago
Please confirm that you have only the py-cord library installed. Having other discord libraries such as discord.py installed will break py-cord (and is unnecessary). Uninstall any of those libraries and then uninstall py-cord then reinstall py-cord. Then restart your IDE.
it worked thanks a lot
Summary
I cannot fix this at all, tried going outside of the environment, same thing.
Reproduction Steps
Paste this code: import client_settings import discord from dotenv import load_dotenv from os import getenv from random import randint
load_dotenv()
token = str(getenv("TOKEN"))
intents = discord.Intents.all()
client = discord.Bot(intents=intents)
async def connect_nodes():
@client.event async def on_ready(): print(f'{client.user} has logged in!')
await connect_nodes()
@client.event
async def on_wavelink_node_ready(payload: wavelink.NodeReadyEventPayload):
@client.message_command(name="Reverse message") async def reverse_message(ctx, message: discord.Message): await ctx.respond(f"The reversed message is: {message.content[::-1]}")
@client.user_command(name="Member Info") async def member_info(ctx, member: discord.Member): memberinfoembed = discord.Embed( title=f"Username: {member.name}.", description=f"ID: {member.id}.", color=discord.Colour.blue(), ) memberinfoembed.add_field(name="Profile", value=f"Account Creation Date: {member.created_at}\nServer Join Date: {member.joined_at}\nActivity: {member.activity}\nStatus: {member.status}\nRoles: {member.roles}\nServer Nick: {member.nick}\nCurrent guild perms: {member.guild_permissions}", inline=True) memberinfoembed.set_thumbnail(url=f"{member.guild.icon}") memberinfoembed.set_image(url=f"{member.avatar}") await ctx.respond(embed=memberinfoembed)
@client.slash_command(name="help", description="All of the commands.") async def help(ctx: discord.ApplicationContext): embed = discord.Embed( title="Help | All commands.", description="Heres all of the bot's commands.", color=discord.Colour.blue(), ) embed.add_field(name="Fun", value="/dice num1 num2 Rolls a dice.\n/badtranslate text Bad translate some text.\n/anim Uses the anim python lib to anim the 10 latest messages sent in the current channel.", inline=True) embed.add_field(name="Utilities", value="/help Shows this
messageembed.", inline=True) embed.addfield(name=" _", value="Support Server - Source Code", inline=False) embed.setfooter(text="Bot made by <@1056952213056004118>") await ctx.respond(" _", embed=embed)@client.slash_command(name="dice", description="Rolls a dice.") @discord.option("num1", type=discord.SlashCommandOptionType.integer) @discord.option("num2", type=discord.SlashCommandOptionType.integer) async def dice(ctx: discord.ApplicationContext, num1: int, num2: int): dicenum = randint(num1, num2) diceembed = discord.Embed( title="Dice", description=f"Dice rolled from {num1} to {num2} and the dice rolled on {dicenum}!", color=discord.Colour.blue(), ) diceembed.set_author(name="Lampyt", icon_url="https://lamps-dev.is-a.dev/pfp.png")
class MyView(discord.ui.View): @discord.ui.button(label="Announce", style=discord.ButtonStyle.primary, emoji="📢") async def button_callback(self, button, interaction): await interaction.response.send_message("Clicked.")
@client.slash_command(name="announcement", description="Send an announcement as the bot in a specified channel and ping a specified role or user.") async def announcement(ctx: discord.ApplicationContext): await ctx.respond("Click the announce button to fill a form and to announce your message.", view=MyView())
client.run(token)
Uncomment the connect_nodes and wavelink parts, run the bot. (This could just be an issue with me.)
Minimal Reproducible Code
Expected Results
Work as normal and start the bot.
Actual Results
Traceback (most recent call last): File "H:\pycord assistant bot\main.py", line 13, in
client = discord.Bot(intents=intents)
^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Bot'
Intents
all
System Information
Checklist
Additional Context
I tried adding song playing support from the docs and right after i run the python script, it errored the same thing but even tho i removed the line of code for playing songs, i still get the error.