#slash command

1 messages · Page 1 of 1 (latest)

hallow mango
#
@commands.Cog.listener()
    async def on_ready(self):

        """Event handler for when the bot is ready."""
        # Start the status changing task
        self.change_status.start()

        # Display startup information in the console
        self.display_startup_info(self.user)

        # Load all cogs (extensions) for the bot
        await self.load_cogs()

        await self.tree.sync()
error:
discord.errors.HTTPException: 400 Bad Request (error code: 50240): You cannot remove this app's Entry Point command in a bulk update operation. Please include the Entry Point command in your update request or delete it separately.

#

Hey. could someone help me with this. I cant use tree.sync

nova olive
hallow mango
#

sorry. head over to the new one

lilac agate
#

I want create a command , name "cow suggest"
but it show me some error

ValueError: 'cow suggest' must be between 1-32 characters and contain only lower-case letters, numbers, hyphens, or underscores.
#

help >:(

sharp copper
#

code?

lilac agate
#
import discord,os
from discord import ui,app_commands 
guild_id = 858984157929144321
class aclient(discord.Client):
    def __init__(self):
        super().__init__(intents = discord.Intents.default())
        self.synced = False #we use this so the bot doesn't sync commands more than once

    async def on_ready(self):
        await self.wait_until_ready()
        if not self.synced: #check if slash commands have been synced 
            await tree.sync(guild = discord.Object(id=guild_id)) #guild specific: leave blank if global (global registration can take 1-24 hours)
            self.synced = True
        print(f"We have logged in as {self.user}.")

class MyModal(ui.Modal,title="cool"):
  answer = ui.TextInput(label="建議",style=discord.TextStyle.short,placeholder="我發現``太爛了...")

  async def on_submit(self, interaction: discord.Interaction):
    await interaction.response.send_message('哞!傳送成功!')
    user = await client.fetch_user("823122263552425984")
    await user.send(self.answer)

client = aclient()
tree = app_commands.CommandTree(client)

@tree.command(guild = discord.Object(id=guild_id), name = 'cow suggest', description='告訴我你想到的新功能') #guild specific slash command
async def slash2(interaction: discord.Interaction):
    await interaction.response.send_modal(MyModal()) 
  
      


client.run(os.environ['token'])
undone pumice
sharp copper
#

lmao the name

undone pumice
#

instead use the command group

lilac agate
#

command group...🤔

#

reading

sharp copper
#

Command groups are a nice idea

lilac agate
#

@app_commands.guild_only()
class MyGroup(app_commands.Group):
pass

#

ok

silent horizonBOT
#

This thread was archived by the user that opened it.

#

This thread was archived by the user that opened it.