i dont know how to make it so this only works in servers and not direct messages any help is appreciated thank you?
from discord import app_commands
async def setup(bot: discord.extmands.Bot):
@bot.treemand(name='invite', description='invite link')
async def invite(interaction: discord.Interaction):
try:
# Send the message in a single line with the word "authorizes" as a clickable link
message = (
"this is the [authorizes](link goes here) invite link, "
"to invite this you have to have the it whitelisted by the owner"
)
# Send the plain text response
await interaction.response.send_message(message)
except Exception as e:
await interaction.response.send_message(f"error: {e}", ephemeral=False)```