4

I'm trying to send slash commands with a selfbot ran on repl.it but they are sent as a normal message and not detected as slash commands.

I know discord selfbots are against TOS but for testing purposes how would i make it so that they detect as a slash command?

Here is the code:

import discord
import os
import keep_alive
from discord.ext import commands, tasks

bot = commands.Bot(command_prefix='!', self_bot=True, help_command=None)

@bot.event
async def on_ready():
    print("Bot presence t u r n e d on ( ͡° ͜ʖ ͡°)")
    test.start()

@tasks.loop(seconds=10)
async def test():
    channel = bot.get_channel(xxx)
    await channel.send('/nick test nick')

keep_alive.keep_alive()
bot.run(xxx, bot=False)

Thanks.

Saharsh
  • 39
  • 1
  • 12

1 Answers1

2

Discord detects slash commands as an interaction rather than an actual command. I found this code online for someone setting up a slash command in their server from March of 2022:

@tree.command(guild = discord.Object(id=guild_id), name = 'tester', description='testing') #guild specific slash command
async def slash2(interaction: discord.Interaction):
    await interaction.response.send_message(f"I am working! I was made with Discord.py!", ephemeral = True)
    ## Ephemeral being "true" means it will only display for the user running the command

I hope this is useful.

clxrity
  • 378
  • 2
  • 9