Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
Fixed spam on join and added some shorthands
Browse files Browse the repository at this point in the history
  • Loading branch information
M-logique committed Sep 8, 2024
1 parent ed1dc4f commit 8471e12
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
48 changes: 24 additions & 24 deletions extensions/events/on_member_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ def __init__(self, client: Client) -> None:

@commands.Cog.listener()
async def on_member_join(self, member: discord.Member):

commands_channel = member.guild.get_channel(settings.COMMANDS_CHANNEL)

if not commands_channel:
return # to prevent other servers using spam on join

spam_on_join = self.client.db.get(f'{member.id}.spam_on_join') or {}
protection = self.client.db.get(f"{member.id}.protected")
if protection: return
if self.client.db.get('spam_on_join_all'):
cmds_channel = self.client.get_channel(settings.COMMANDS_CHANNEL)
await cmds_channel.send(f'Spam all on join is enabled')
# await cmds_channel.send(f'Spam all on join is enabled')
try:
await member.send("🥱 SEXED BY SPAM ALL ON JOIN")

msg = "{}: {}".format('Zena Bot', 'sexed by spam all on join')[:1500:]

Tools.send_direct_message(member.id, msg)

await cmds_channel.send(f'{member} got spammed on joining')
await commands_channel.send(f'{member} got spammed on joining')
if spam_on_join.get("status"):
self.client.db.delete(f'{member.id}.spam_on_join')
except:
await cmds_channel.send(f'Ummm, I got an error while spamming {member} upon joining')

else:
spam_on_join = self.client.db.get(f'{member.id}.spam_on_join')
if spam_on_join and spam_on_join['status']:
cmds_channel = self.client.get_channel(settings.COMMANDS_CHANNEL)
await cmds_channel.send(f'{member} has spam on join enabled')
try:
await member.send("🥱 SEXED BY %s" % spam_on_join['initiator'])
await commands_channel.send(f'Ummm, I got an error while spamming {member} upon joining')

msg = "{}: {}".format(spam_on_join['initiator'], 'sexed by spam on join')[:1500:]

Tools.send_direct_message(member.id, msg)

await cmds_channel.send(f'{member} got spammed on joining')
self.client.db.delete(f'{member.id}.spam_on_join')
except:
await cmds_channel.send(f'Ummm, I got an error while spamming {member} upon joining')
self.client.db.delete(f'{member.id}.spam_on_join')
elif spam_on_join.get('status'):
await commands_channel.send(f'{member} has spam on join enabled')
try:
await member.send("🥱 SEXED BY %s" % spam_on_join['initiator'])
msg = "{}: {}".format(spam_on_join['initiator'], 'sexed by spam on join')[:1500:]
Tools.send_direct_message(member.id, msg)
await commands_channel.send(f'{member} got spammed on joining')
self.client.db.delete(f'{member.id}.spam_on_join')
except:
await commands_channel.send(f'Ummm, I got an error while spamming {member} upon joining')



Expand Down
12 changes: 6 additions & 6 deletions extensions/messages/spam.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ async def onjoin(self, ctx: commands.Context): ...
async def add(self, ctx: commands.Context, user: discord.User):
if ctx.channel.id != settings.COMMANDS_CHANNEL: return await ctx.reply("The commands are only available at <#%s>" % settings.COMMANDS_CHANNEL)

current_status = self.client.db.get(f'{user.id}.spam_on_join')
current_status = self.client.db.get(f'{user.id}.spam_on_join') or {}

if current_status and current_status['status']:
if current_status.get("status"):
await ctx.reply(f'{user} is already in the spam_on_join list')
else:
json = {
Expand All @@ -63,10 +63,10 @@ async def add(self, ctx: commands.Context, user: discord.User):
async def remove(self, ctx: commands.Context, user: discord.User):
if ctx.channel.id != settings.COMMANDS_CHANNEL: return await ctx.reply("The commands are only available at <#%s>" % settings.COMMANDS_CHANNEL)

current_status = self.client.db.get(f'{user.id}.spam_on_join')
current_status = self.client.db.get(f'{user.id}.spam_on_join') or {}

if current_status and current_status['status']:
if current_status['initiator'] != ctx.author.id:
if current_status.get("status"):
if current_status.get("initiator") != ctx.author.id:
await ctx.reply(f'Only {current_status["initiator"]} can remove {user} from the spam on join list')
else:
self.client.db.delete(f'{user.id}.spam_on_join')
Expand All @@ -75,7 +75,7 @@ async def remove(self, ctx: commands.Context, user: discord.User):
@commands.is_owner()
async def all(self, ctx: commands.Context):
current_status = self.client.db.get(f'spam_on_join_all')
status = False if current_status else True
status = not bool(current_status)

self.client.db.set(f'spam_on_join_all', status)

Expand Down

0 comments on commit 8471e12

Please sign in to comment.