So im trying to make a bot that accepts slash commands, as i didnt use slash commands before i copied some code from stackoverflow, i want to ask if this code will work since i can't test it now.
import discord
import discord.ext
# setting up the bot
intents = discord.Intents.all()
# if you don't want all intents you can do discord.Intents.default()
client = discord.Client(intents=intents)
tree = discord.app_commands.CommandTree(client)
# sync the slash command to your server
@client.event
async def on_ready():
await tree.sync(guild=discord.Object(id=1114436390843846737))
print("ready")
# make the slash command
@tree.command(name="name", description="description")
async def slash_command(interaction: discord.Interaction):
await interaction.response.send_message("command")