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)
|
@loop(minutes=1)
|
||||||
async def unmute():
|
async def unmute():
|
||||||
db = DBManager(get_config().mongo).mongo
|
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(
|
mute_roles = list(
|
||||||
db.jarvis.settings.find({"setting": "mute"}).sort(
|
db.jarvis.settings.find({"setting": "mute"}).sort(
|
||||||
[("guild", pymongo.ASCENDING)]
|
[("guild", pymongo.ASCENDING)]
|
||||||
|
@ -95,13 +95,15 @@ async def unmute():
|
||||||
db.jarvis.mutes.bulk_write(updates)
|
db.jarvis.mutes.bulk_write(updates)
|
||||||
|
|
||||||
|
|
||||||
@loop(minutes=30)
|
@loop(minutes=10)
|
||||||
async def unban():
|
async def unban():
|
||||||
db = DBManager(get_config().mongo).mongo
|
db = DBManager(get_config().mongo).mongo
|
||||||
bans = list(db.jarvis.bans.find({"active": True, "type": "temp"}))
|
bans = list(db.jarvis.bans.find({"active": True, "type": "temp"}))
|
||||||
updates = []
|
updates = []
|
||||||
for ban in bans:
|
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"])
|
guild = await jarvis.fetch_guild(ban["guild"])
|
||||||
user = jarvis.fetch_user(ban["user"])
|
user = jarvis.fetch_user(ban["user"])
|
||||||
if user:
|
if user:
|
||||||
|
|
|
@ -45,7 +45,7 @@ class AdminCog(commands.Cog):
|
||||||
+ " Reason:\n{reason}"
|
+ " Reason:\n{reason}"
|
||||||
)
|
)
|
||||||
if mtype == "temp":
|
if mtype == "temp":
|
||||||
user_message += f"\nDuration: {length} days"
|
user_message += f"\nDuration: {length} hours"
|
||||||
|
|
||||||
await user.send(user_message)
|
await user.send(user_message)
|
||||||
await ctx.guild.ban(user, reason=reason)
|
await ctx.guild.ban(user, reason=reason)
|
||||||
|
@ -103,7 +103,7 @@ class AdminCog(commands.Cog):
|
||||||
),
|
),
|
||||||
create_option(
|
create_option(
|
||||||
name="duration",
|
name="duration",
|
||||||
description="Ban duration in days if temporary",
|
description="Ban duration in hours if temporary",
|
||||||
required=False,
|
required=False,
|
||||||
option_type=4,
|
option_type=4,
|
||||||
),
|
),
|
||||||
|
@ -116,7 +116,7 @@ class AdminCog(commands.Cog):
|
||||||
user: User = None,
|
user: User = None,
|
||||||
type: str = "perm",
|
type: str = "perm",
|
||||||
reason: str = None,
|
reason: str = None,
|
||||||
length: int = 1,
|
length: int = 12,
|
||||||
):
|
):
|
||||||
await self._ban(ctx, user, type, reason, length)
|
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):
|
async def _mute(self, ctx, user: Member, reason: str, length: int = 30):
|
||||||
mute_setting = self.db.jarvis.settings.find_one(
|
mute_setting = self.db.jarvis.settings.find_one(
|
||||||
{"guild": ctx.guild.id, "setting": "mute"}
|
{"guild": ctx.guild.id, "setting": "mute"}
|
||||||
|
|
Loading…
Add table
Reference in a new issue