How to make my Discord Bot sync to Group Chat or User DM? There is a Discord Bot able to use the commands without inviting to Discord Server, and it works in Discord Group Chat and User DM's. Is there a way to make my Slash Command sync to my own Group Chat?
Here is my Code:
@bot.event
async def on_ready():
await bot.tree.sync()
@bot.tree.command(name="randomness number",description="used to giveaway thing")
async def qr(interaction:discord.Interaction,amount:int):
await interaction.response.send_message(f"result is: {random.randint(1,amount)}")
And the Slash Command only works on invited Discord Server but not on my Group Chat or User DM. I already authorized my bot to my Discord Account, and it still doesn't show Slash Command.
Slash Command that works in Group Chat, Not my Discord Bot.png
In discord.py 2.4+ you can make slash commands be usable in DMs and Group DMs by:
@discord.app_commands.allowed_installs
decorator, andprivate_channels
) using @discord.app_commands.allowed_contexts
decoratorThis example allows a command to be installed and used everywhere:
@discord.app_commands.allowed_installs(guilds=True, users=True)
@discord.app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@bot.tree.command(name="randomness number", description="used to giveaway thing")
async def qr(interaction: discord.Interaction, amount: int):