Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

PROTECTED_ROLE_ID = int(os.getenv("PROTECTED_ROLE_ID"))
IMMUNE_BYPASS_ROLE_ID = int(os.getenv("IMMUNE_BYPASS_ROLE_ID"))
BOT_USER_ID = 1522945518932725810
TIMED_BANS_PATH = os.path.join(os.path.dirname(__file__), "timed_bans.json")
scheduled_unban_tasks = {}
timed_bans_restored = False
Expand Down Expand Up @@ -284,7 +285,7 @@ async def hi(ctx):
await ctx.reply("wassup")

@bot.command()
@commands.has_permission(kick_members=True)
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason="No reason provided"):
if not can_ban_target(ctx.author, member):
await ctx.reply("You do not have permission to kick this member.")
Expand All @@ -297,7 +298,7 @@ async def kick(ctx, member: discord.Member, *, reason="No reason provided"):
await ctx.send(f"Kicked {member} | Reason: {reason}")

@bot.command()
@commands.has_permission(ban_members=True)
@commands.has_permissions(ban_members=True)
async def unban(ctx, user: discord.User, *, reason="No reason provided"):
try:
await ctx.guild.fetch_ban(user)
Expand Down Expand Up @@ -427,4 +428,21 @@ async def kban(ctx, user: discord.User, *, reason="N/A"):
await ctx.guild.ban(user, reason=ban_reason)
await ctx.send(f"Knowledgeban given to {user} | Reason: {ban_reason}")

@bot.command()
@commands.has_any_role(IMMUNE_BYPASS_ROLE_ID)
async def speak(ctx, *, msg="Please provide a message to send."):
Comment on lines +431 to +433
await ctx.send(msg)
Comment on lines +433 to +434

@bot.command()
@commands.has_any_role(PROTECTED_ROLE_ID)
Comment on lines +436 to +437
async def purge(ctx, limit: int):
if limit < 1:
await ctx.reply("Please provide a valid number of messages to purge.")
return
deleted = await ctx.channel.purge(
limit=(limit + 1),
check=lambda message: message.author.id != BOT_USER_ID and not message.pinned,
)
await ctx.send(f"Purged {len(deleted)} message(s), I skipped any of my own", delete_after=5)

bot.run(TOKEN)