From 4dc40e25459a46d7990f5ee60a64b7fa6663ee59 Mon Sep 17 00:00:00 2001 From: Hardikkr Date: Sat, 10 Apr 2021 15:26:11 +0530 Subject: [PATCH] Added clear/kick/ban commands and join/leave events --- husky.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/husky.py b/husky.py index 53a150f..77c401a 100644 --- a/husky.py +++ b/husky.py @@ -6,8 +6,10 @@ from Private import private_keys -#? Setting Prefix -Husky = commands.Bot(command_prefix="!") +#? Setting up Husky +intents = discord.Intents.default() +intents.members = True +Husky = commands.Bot(command_prefix="!", intents=intents) #? Husky details @@ -23,6 +25,18 @@ async def on_ready(): print(f"\nHusky is ready \nusername: {husky_username} \navatar_url: {husky_avatar_url}") +#? On Joining a new Member +@Husky.event +async def on_member_join(member): + print(f"{member} has joined") + + +#? On Leaving a Member +@Husky.event +async def on_member_remove(member): + print(f"{member} has left") + + #? Basic Registration Inforation @Husky.command() async def husky(ctx): @@ -129,5 +143,23 @@ async def register(ctx, *, text): # "*" will take the full sentence await ctx.send(embed = embed) +#? Clearing messages +@Husky.command() +async def clear(ctx, ammount=2): # By default it'll delete 2 messages + await ctx.channel.purge(limit=ammount) + + +#? Kick Member +@Husky.command() +async def kick(ctx, member: discord.member, *, reason=None): + await ctx.kick(reason=reason) + + +#? Ban Member +@Husky.command() +async def ban(ctx, member: discord.member, *, reason=None): + await ctx.ban(reason=reason) + + #? Activate the bot(Husky) Husky.run(private_keys.discord_token)