Skip to content

Commit

Permalink
Update models.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CallocGD authored Dec 14, 2024
1 parent 60eae6e commit 4c564bd
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
# Prune Date After Joining guild, you can edit that as required
PRUNE_DATE = timedelta(days=1)

# Creation date After Creating discord account (About 1 month) If were dealing with those weird-ass scammers in the gd-programming server...
CREATION_DATE_LIMIT = timedelta(weeks=4)
# Creation date After Creating discord account (About 6 months)
CREATION_DATE_LIMIT = timedelta(weeks=26)




Expand Down Expand Up @@ -79,6 +80,7 @@ class PrunedMember(IDModel, table=True):

# I guess you can call this EvilCalloc if you'd like...


class LockdownChannel(IDModel, table=True):
"""A Channel that is considered to be on-lockdown"""
guild_id: int = Field(unique=True)
Expand Down Expand Up @@ -137,7 +139,7 @@ async def sync_guild(self, id:int):
return await self.tree.sync(guild=guildObject)


# 1146963932515414026

async def setup_hook(self):

async with aiofiles.open("config.yaml", "r") as cfg:
Expand Down Expand Up @@ -303,11 +305,22 @@ async def create_lockdown(self, guild:Guild, channel:discord.TextChannel):
await s.commit()
return ldc

async def get_lockdown(self, guild:Guild, channel:discord.TextChannel):
async with self.session() as s:
scalar = await s.exec(
select(LockdownChannel)
.where(LockdownChannel.guild_id == guild.id)
.where(LockdownChannel.channel_id == channel.id)
)
ld_channel = scalar.one_or_none()
return ld_channel


async def update_lockdown_role(self, ldc:LockdownChannel):
async with self.session() as s:
await s.merge(ldc)
await s.commit()


async def delete_lockdown(self, ldc:LockdownChannel):
"""Cleans up an entire lockdown along with all it's inner nodes..."""
Expand Down

0 comments on commit 4c564bd

Please sign in to comment.