📌  相关文章
📜  不和谐机器人斜线 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:15.346000             🧑  作者: Mango

代码示例1
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