hallo i wanted an command to be compatible on a prefix and slash but it somehow stops my bot here's the command
@bot.command(name="watch")
@bot.slash_command(name="watch", description="Search for a movie/show and get a watch link.")
async def watch(ctx_or_interaction, *, query=None):
if isinstance(ctx_or_interaction, nextcord.Interaction):
if query is None:
await ctx_or_interaction.response.send_message("❌ Please provide a search query.", ephemeral=True)
return
is_slash = True
else:
is_slash = False
result = await search_tmdb(query)
if not result:
if is_slash:
await ctx_or_interaction.response.send_message("❌ No results found", ephemeral=True)
else:
await ctx_or_interaction.send("❌ No results found")
return
watch_link, poster_url, title, rating, release_date = result
embed = nextcord.Embed(title=f"🎬 {title}", color=nextcord.Color.blue(), url=watch_link)
if poster_url:
embed.set_image(url=poster_url)
embed.add_field(name="Rating", value=f" ⭐ {rating}/10", inline=True)
embed.add_field(name="🗓️ Release Date", value=release_date, inline=True)
embed.add_field(name="🤸🏻 Watch Now", value=f"[Click here]({watch_link})", inline=False)
if is_slash:
await ctx_or_interaction.response.send_message(embed=embed)
else:
await ctx_or_interaction.send(embed=embed)
```