PythonXeno/cogs/slashcmds.py
2024-10-26 04:47:45 -05:00

38 lines
1.2 KiB
Python

import json
import discord
from discord import app_commands
from discord.ext import commands
from discord.ext.commands import is_owner
if __name__ == "__main__":
print("This is a cog (addon) for the Xeno Discord bot. This file cannot be run standalone.")
exit()
## Xeno Discord PY Bot
### Slash Commands (test?)
extname = (f'SlashCmds')
class SlashCmds(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='syncslash')
@is_owner()
async def syncslash(self, ctx):
synced = await ctx.bot.tree.sync()
await ctx.reply(f"{len(synced)} slash commands were synced successfully.")
# @commands.hybrid_command()
# async def slashdebug(ctx, name):
# await ctx.send(f"Showing tag: {name}")
@app_commands.command(name="slashdebug2", description="Tests slash command functionality- DEDICATED")
async def slashdebug(self, interaction: discord.Interaction) -> None:
await interaction.response.send_message(f"You are super neat (dedicated command) :)")
#@app_commands.command(name="input",)
async def setup(bot):
print(f'Cog_{extname} was initialized')
await bot.add_cog(SlashCmds(bot))