Skip to content

Commit

Permalink
L A Z E R B E A M
Browse files Browse the repository at this point in the history
  • Loading branch information
yungcomputerchair committed Oct 26, 2022
1 parent ce88346 commit bfddaec
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ async def on_member_join(member):
f"Welcome to Cyber Security Club @ Ohio State!\n\nIf you are an OSU student, go to https://auth.osucyber.club to:\n- Link your Discord account. This will give you access to non-public channels.\n-Signup for the mailing list. (You can also signup at http://mailinglist.osucyber.club)\n\n"
)

async def iterate_history(channel, sender):
count = 0
async for msg in channel.history(limit=None):
if msg.author == sender:
count += 1
await msg.delete()
return count

@client.event
async def on_message(message):
Expand Down Expand Up @@ -255,6 +262,26 @@ async def on_message(message):
embed=create_embed(f"Could not find live CTF channel {ctf}. Was it accidentally moved?")
)
return
if split[0] == "!lazerbeam":
sender = message.author
if not check_has_role(sender, "Officers"):
return
await message.channel.send(
embed=create_embed(f"Ok, {sender.name}, I'll start lazer beaming your messages. This will take a while; I'll let you know when I'm done.")
)
count = 0
for chan in guild.channels:
if isinstance(chan, discord.TextChannel):
try:
count_chan = await iterate_history(chan, sender)
#print(f"Found {count_chan} messages in channel #{chan.name}")
count += count_chan
except:
print(f"Failed to lazer beam {chan.name} for {sender.name}")
await message.channel.send(
embed=create_embed(f"Lazer beam'd {count} messages from {sender.name}")
)
return
return


Expand Down

0 comments on commit bfddaec

Please sign in to comment.