最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

discord - how to stop commands from working in dms and only in servers - Stack Overflow

programmeradmin2浏览0评论

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)``` 

发布评论

评论列表(0)

  1. 暂无评论