Fix outright failure to send DM on ban
This commit is contained in:
parent
1f552d7d32
commit
0496e288c2
2 changed files with 7 additions and 14 deletions
|
@ -14,15 +14,8 @@ from psutil import Process
|
|||
from jarvis import logo, utils
|
||||
from jarvis.config import get_config
|
||||
from jarvis.db import DBManager
|
||||
from jarvis.db.types import (
|
||||
Autopurge,
|
||||
Autoreact,
|
||||
Ban,
|
||||
Lock,
|
||||
Mute,
|
||||
Setting,
|
||||
Warning,
|
||||
)
|
||||
from jarvis.db.types import (Autopurge, Autoreact, Ban, Lock, Mute, Setting,
|
||||
Warning)
|
||||
from jarvis.utils import build_embed
|
||||
from jarvis.utils.field import Field
|
||||
|
||||
|
@ -44,7 +37,7 @@ jarvis = commands.Bot(
|
|||
)
|
||||
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
|
||||
jarvis_self = Process()
|
||||
__version__ = "1.5.6"
|
||||
__version__ = "1.5.7"
|
||||
|
||||
|
||||
db = DBManager(get_config().mongo).mongo
|
||||
|
|
|
@ -136,16 +136,16 @@ class AdminCog(commands.Cog):
|
|||
if mtype == "temp":
|
||||
user_message += f"\nDuration: {duration} hours"
|
||||
|
||||
try:
|
||||
await user.send(user_message)
|
||||
except Exception:
|
||||
send_failed = True
|
||||
try:
|
||||
await ctx.guild.ban(user, reason=reason)
|
||||
except Exception as e:
|
||||
await ctx.send(f"Failed to ban user:\n```\n{e}\n```", hidden=True)
|
||||
return
|
||||
send_failed = False
|
||||
try:
|
||||
await user.send(user_message)
|
||||
except Exception:
|
||||
send_failed = True
|
||||
if mtype == "soft":
|
||||
await ctx.guild.unban(user, reason="Ban was softban")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue