Skip to content

Commit 7914ce0

Browse files
committed
added ban and unban
1 parent b92948f commit 7914ce0

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

DiscordBot/main.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,26 @@
1010
bot = commands.Bot(command_prefix="!")
1111

1212

13+
@bot.event
14+
async def on_ready():
15+
print("bot started")
16+
17+
18+
@commands.has_permissions(ban_members=True)
19+
@bot.command()
20+
async def ban(ctx, user: discord.Member):
21+
"""Ban the given user"""
22+
await ctx.guild.ban(user, delete_message_days=0)
23+
await ctx.send(f"banned user {user}")
24+
25+
26+
@commands.has_permissions(ban_members=True)
27+
@bot.command()
28+
async def unban(ctx, user: discord.User):
29+
"Unban the given user"
30+
await ctx.guild.unban(user)
31+
await ctx.send(f"unbanned user {user}")
32+
33+
1334
if __name__ == "__main__":
1435
bot.run(TOKEN)

0 commit comments

Comments
 (0)