Skip to content
← Back to Community
Discord.py Slash Commands Bot Starter
Profile icon
hacker
has Hacker Plan
CoolCoderSJ

Slash commands are all the rage nowadays, (Not really) so it's cool to integrate them into your own bot, right? This template makes that easy.

Step 1- Fork template

Step 2 - Customize it

Step 3 - Insert Token

Step 4 - Invite bot

MAKE SURE YOU INVITE THE BOT WITH THE FOLLOWING SCOPE - applications.commands

Enjoy!

Voters
Profile icon
SITHUM1
Profile icon
vicuuu
Profile icon
VUSTUR
Profile icon
shkeffy
Profile icon
LGaming822
Profile icon
IceFire03
Profile icon
KSSSSSSSS
Profile icon
sonicclassic
Profile icon
nassemyoutuber
Profile icon
rexjohannes
Comments
hotnewtop
Profile icon
GameMaker4

This is my error, and my code. Please try to help me
My error
image

My code

import random import os from keep_alive import keep_alive import discord.ext from discord.ext import commands from discord_slash import SlashCommand from discord_slash import SlashContext from discord_slash.utils import manage_commands paint=[0xff0000 , 0x0000ff , 0x000000 , 0x00ffff , 0xffffff , 0xffd700 , 0x4b0082] number=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50] heads_tails = 'Heads', 'Tails' prefix = ['-'] client = commands.Bot(prefix) slash = SlashCommand(client, sync_commands=True) client.remove_command('help') @client.event async def on_ready(): await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="GameMaker_YT on youtube!")) print("Ready to hack you bitch.") @slash.slash(name="help", description="Need some help?") async def _help(ctx: SlashContext): embedVar = discord.Embed( title="Help arrived!", description="Here are a list of commands for your help", colour=(0xff0000)) embedVar.add_field(name="Bot Prefix", value="-", inline=False) embedVar.add_field(name="Moderation Commands", value="help, say, mute", inline=True) embedVar.add_field(name="Fun commands", value="toss, randomnumber", inline=True) embedVar.set_thumbnail( url= "https://media.discordapp.net/attachments/923531605660815373/974248483479494686/charizard-mega-charizard-y.gif" ) print(f'help used by {ctx.author}') await ctx.channel.send(embed=embedVar) @client.command() @commands.has_permissions(administrator=True) async def mute(ctx, member: discord.Member): role = discord.utils.get(ctx.guild.roles, name="Muted") await member.add_roles(role) embedVar1 = discord.Embed( title="User Muted", description=(f"Sucessfully muted {member}"), colour=(0xff0000)) print(f'mute used by {ctx.author}') await ctx.send(embed=embedVar1) @mute.error async def mute_error(ctx, error): if isinstance(error, commands.MissingRole): await ctx.send("You don't have the 'staff' role") @mute.error async def mute_error(ctx, error): if isinstance(error, commands.BadArgument): await ctx.send("That is not a valid member") @client.command() @commands.has_permissions(administrator=True) async def unmute(ctx, member: discord.Member): role = discord.utils.get(ctx.guild.roles, name="Muted") await member.remove_roles(role) embedVar2 = discord.Embed( title="User Unmuted", description=(f"Sucessfully unmuted {member}"), colour=(0xff0000)) print(f'unmute used by {ctx.author}') await ctx.send(embed=embedVar2) @mute.error async def unmute_error(ctx, error): if isinstance(error, commands.MissingRole): await ctx.send("You don't have the 'staff' role") @mute.error async def unmute_error(ctx, error): if isinstance(error, commands.BadArgument): await ctx.send("That is not a valid member") @client.command() @commands.has_permissions(manage_messages = True) async def clear(ctx , amount=5): await ctx.channel.purge(limit=amount + 1) @client.command() @commands.has_permissions(manage_channels=True) async def lockdown(ctx): await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False) embedVar1 = discord.Embed( title="Locked", description=(f'{ctx.channel.mention} ***has been locked.***'), colour=(0x0000ff)) await ctx.send(embed=embedVar1) @client.command() @commands.has_permissions(manage_channels=True) async def unlock(ctx): await ctx.channel.set_permissions(ctx.guild.default_role, send_messages=True) embedVar2 = discord.Embed( title="Unlocked", description=(f'{ctx.channel.mention} ***has been unlocked.***'), colour=(0x0000ff)) await ctx.send(embed=embedVar2) @client.command() async def randomnumber(ctx): embedVar = discord.Embed( title="Random Number", description=(f'You got {random.choice(number)}'), colour=(0x0000ff)) print(f'randomnumber used by {ctx.author}') await ctx.channel.send(embed=embedVar) @client.command() async def toss(ctx): embed = discord.Embed( title="Flipping the coin!", description=(f'You got {random.choice(heads_tails)}!'), colour=(0x4b0082)) print(f'toss used by {ctx.author}') await ctx.channel.send(embed=embed) @client.command(name='say') @commands.has_permissions(administrator=True) async def audit(ctx, top=None ,msg=None): if msg and top is not None: embedVar = discord.Embed( title=(f'{top}'), description=(f'{msg}'), colour=(0x0000ff)) print(f'say used by {ctx.author}') await ctx.channel.send(embed=embedVar) await ctx.message.delete() keep_alive() client.run(os.getenv('RealToken'))```
Profile icon
Coolboy62ksi

ive already got a discord bot how would i integrate
this into it

Profile icon
Amarabandu

This file cannot be displayed:

Profile icon
GodlyApple

hacker plan go brrrrrrr

Profile icon
moved

@GodlyApple
you can just use uptimerobot.com to keep your repl running, you don't need hacker plan

Profile icon
GodlyApple

@Tim135790
i know