Skip to content

Instantly share code, notes, and snippets.

@Malarne
Created December 23, 2020 20:15
Show Gist options
  • Save Malarne/61b4d3fe98d75fee307e77c2ec1c3200 to your computer and use it in GitHub Desktop.
Save Malarne/61b4d3fe98d75fee307e77c2ec1c3200 to your computer and use it in GitHub Desktop.
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from discord_slash import SlashContext
from discord_slash.utils.manage_commands import add_slash_command
import asyncio
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
slash = SlashCommand(bot)
token = ""
@slash.slash(name="ping")
async def _test(ctx: SlashContext):
embed = discord.Embed(title="Slash command !", description="Pong !")
await ctx.send(content="\u200b", embeds=[embed])
async def register():
return await add_slash_command(353176642543419392 , token, None, "ping", "Pong !")
async def main():
r = await register()
print(r)
asyncio.run(main())
bot.run(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment