fix: add commands
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord import app_commands
|
||||
|
||||
class Ping(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
print("✅ Ping command loaded")
|
||||
|
||||
# ✅ Slash command
|
||||
@app_commands.command(name="ping", description="Shows bot latency")
|
||||
async def ping(self, interaction: discord.Interaction):
|
||||
latency = round(self.bot.latency * 1000)
|
||||
await interaction.response.send_message(f"Pong! {latency}ms")
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(Ping(bot))
|
||||
Reference in New Issue
Block a user