Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

discord bot slash

import discord											# Imports 
from discord.ext import commands						# Imports 
from discord_slash import SlashCommand, SlashContext	# Imports 

bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())	# Creates client
slash = SlashCommand(bot)

@slash.slash(name="test")							# Sets the name of the command
async def _test(ctx: SlashContext):					# When command "test" is used
    embed = discord.Embed(title="embed test")		# Creates a embed
    await ctx.send(content="test", embeds=[embed])	# Sends the embed

bot.run("discord_token")	# Put your token here
Source by discord.com #
 
PREVIOUS NEXT
Tagged: #discord #bot #slash
ADD COMMENT
Topic
Name
7+2 =