Change default ban duration to 12 hours, fix perms, change unmute filters
This commit is contained in:
parent
0a12d8b7c8
commit
de60327670
2 changed files with 9 additions and 6 deletions
|
@ -68,7 +68,7 @@ async def on_guild_join(guild):
|
|||
@loop(minutes=1)
|
||||
async def unmute():
|
||||
db = DBManager(get_config().mongo).mongo
|
||||
mutes = list(db.jarvis.mutes.find({"active": True}))
|
||||
mutes = list(db.jarvis.mutes.find({"active": True, "length": {"$gt": 0}}))
|
||||
mute_roles = list(
|
||||
db.jarvis.settings.find({"setting": "mute"}).sort(
|
||||
[("guild", pymongo.ASCENDING)]
|
||||
|
@ -95,13 +95,15 @@ async def unmute():
|
|||
db.jarvis.mutes.bulk_write(updates)
|
||||
|
||||
|
||||
@loop(minutes=30)
|
||||
@loop(minutes=10)
|
||||
async def unban():
|
||||
db = DBManager(get_config().mongo).mongo
|
||||
bans = list(db.jarvis.bans.find({"active": True, "type": "temp"}))
|
||||
updates = []
|
||||
for ban in bans:
|
||||
if ban["time"] + timedelta(days=ban["length"]) < datetime.now():
|
||||
if ban["time"] + timedelta(
|
||||
hours=ban["length"]
|
||||
) < datetime.now() + timedelta(minutes=10):
|
||||
guild = await jarvis.fetch_guild(ban["guild"])
|
||||
user = jarvis.fetch_user(ban["user"])
|
||||
if user:
|
||||
|
|
|
@ -45,7 +45,7 @@ class AdminCog(commands.Cog):
|
|||
+ " Reason:\n{reason}"
|
||||
)
|
||||
if mtype == "temp":
|
||||
user_message += f"\nDuration: {length} days"
|
||||
user_message += f"\nDuration: {length} hours"
|
||||
|
||||
await user.send(user_message)
|
||||
await ctx.guild.ban(user, reason=reason)
|
||||
|
@ -103,7 +103,7 @@ class AdminCog(commands.Cog):
|
|||
),
|
||||
create_option(
|
||||
name="duration",
|
||||
description="Ban duration in days if temporary",
|
||||
description="Ban duration in hours if temporary",
|
||||
required=False,
|
||||
option_type=4,
|
||||
),
|
||||
|
@ -116,7 +116,7 @@ class AdminCog(commands.Cog):
|
|||
user: User = None,
|
||||
type: str = "perm",
|
||||
reason: str = None,
|
||||
length: int = 1,
|
||||
length: int = 12,
|
||||
):
|
||||
await self._ban(ctx, user, type, reason, length)
|
||||
|
||||
|
@ -234,6 +234,7 @@ class AdminCog(commands.Cog):
|
|||
),
|
||||
],
|
||||
)
|
||||
@commands.has_permissions(mute_members=True)
|
||||
async def _mute(self, ctx, user: Member, reason: str, length: int = 30):
|
||||
mute_setting = self.db.jarvis.settings.find_one(
|
||||
{"guild": ctx.guild.id, "setting": "mute"}
|
||||
|
|
Loading…
Add table
Reference in a new issue