greet.py 542 B

123456789101112131415161718192021
  1. import discord
  2. from discord.ext import commands
  3. from discord.commands import Option
  4. from discord.commands import slash_command
  5. import os
  6. from dotenv import load_dotenv
  7. class greet(commands.Cog):
  8. def __init__(self, bot: discord.Bot):
  9. self.bot = bot
  10. #Command initialization
  11. @slash_command(description="Greet a User")
  12. async def greet(self, ctx, user: str = Option(discord.User, "The user, you want to greet")):
  13. await ctx.respond(f"Hello {user.mention}")
  14. def setup(bot: discord.Bot):
  15. bot.add_cog(greet(bot))