parent
a940ba7aba
commit
c963dbd889
2 changed files with 60 additions and 19 deletions
|
@ -14,15 +14,8 @@ from psutil import Process
|
||||||
from jarvis import logo, utils
|
from jarvis import logo, utils
|
||||||
from jarvis.config import get_config
|
from jarvis.config import get_config
|
||||||
from jarvis.db import DBManager
|
from jarvis.db import DBManager
|
||||||
from jarvis.db.types import (
|
from jarvis.db.types import (Autopurge, Autoreact, Ban, Lock, Mute, Setting,
|
||||||
Autopurge,
|
Warning)
|
||||||
Autoreact,
|
|
||||||
Ban,
|
|
||||||
Lock,
|
|
||||||
Mute,
|
|
||||||
Setting,
|
|
||||||
Warning,
|
|
||||||
)
|
|
||||||
from jarvis.utils import build_embed
|
from jarvis.utils import build_embed
|
||||||
from jarvis.utils.field import Field
|
from jarvis.utils.field import Field
|
||||||
|
|
||||||
|
@ -44,7 +37,7 @@ jarvis = commands.Bot(
|
||||||
)
|
)
|
||||||
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
|
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
|
||||||
jarvis_self = Process()
|
jarvis_self = Process()
|
||||||
__version__ = "1.5.7"
|
__version__ = "1.5.8"
|
||||||
|
|
||||||
|
|
||||||
db = DBManager(get_config().mongo).mongo
|
db = DBManager(get_config().mongo).mongo
|
||||||
|
|
|
@ -175,10 +175,13 @@ class AdminCog(commands.Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
admin_embed.set_author(
|
admin_embed.set_author(
|
||||||
name=user.name + "#" + user.discriminator, icon_url=user.avatar_url
|
name=user.nick if user.nick else user.name,
|
||||||
|
icon_url=user.avatar_url,
|
||||||
)
|
)
|
||||||
admin_embed.set_thumbnail(url=user.avatar_url)
|
admin_embed.set_thumbnail(url=user.avatar_url)
|
||||||
admin_embed.set_footer(text=f"User ID: {user.id}")
|
admin_embed.set_footer(
|
||||||
|
text=f"{user.name}#{user.discriminator} | {user.id}"
|
||||||
|
)
|
||||||
|
|
||||||
await ctx.send(embed=admin_embed)
|
await ctx.send(embed=admin_embed)
|
||||||
if type != "temp":
|
if type != "temp":
|
||||||
|
@ -211,7 +214,19 @@ class AdminCog(commands.Cog):
|
||||||
admin=ctx.author.id,
|
admin=ctx.author.id,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
).insert()
|
).insert()
|
||||||
await ctx.send("User successfully unbanned.\nReason: " + reason)
|
|
||||||
|
embed = build_embed(
|
||||||
|
title="User Unbanned",
|
||||||
|
description=f"<@{user.id}> was unbanned",
|
||||||
|
fields=[Field(name="Reason", value=reason)],
|
||||||
|
)
|
||||||
|
embed.set_author(
|
||||||
|
name=user.name,
|
||||||
|
icon_url=user.avatar_url,
|
||||||
|
)
|
||||||
|
embed.set_thumbnail(url=user.avatar_url)
|
||||||
|
embed.set_footer(text=f"{user.name}#{user.discriminator} | {user.id}")
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@cog_ext.cog_slash(
|
@cog_ext.cog_slash(
|
||||||
name="unban",
|
name="unban",
|
||||||
|
@ -518,18 +533,19 @@ class AdminCog(commands.Cog):
|
||||||
send_failed = True
|
send_failed = True
|
||||||
await ctx.guild.kick(user, reason=reason)
|
await ctx.guild.kick(user, reason=reason)
|
||||||
|
|
||||||
|
fields = [Field(name="DM Sent?", value=str(not send_failed))]
|
||||||
embed = build_embed(
|
embed = build_embed(
|
||||||
title="User Kicked",
|
title="User Kicked",
|
||||||
description=f"Reason: {reason}",
|
description=f"Reason: {reason}",
|
||||||
fields=[],
|
fields=fields,
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.set_author(
|
embed.set_author(
|
||||||
name=user.name + "#" + user.discriminator,
|
name=user.nick if user.nick else user.name,
|
||||||
icon_url=user.avatar_url,
|
icon_url=user.avatar_url,
|
||||||
)
|
)
|
||||||
embed.set_thumbnail(url=user.avatar_url)
|
embed.set_thumbnail(url=user.avatar_url)
|
||||||
embed.set_footer(text=f"User ID: {user.id}")
|
embed.set_footer(text=f"{user.name}#{user.discriminator} | {user.id}")
|
||||||
|
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
_ = Kick(
|
_ = Kick(
|
||||||
|
@ -629,7 +645,19 @@ class AdminCog(commands.Cog):
|
||||||
duration=duration,
|
duration=duration,
|
||||||
active=True if duration >= 0 else False,
|
active=True if duration >= 0 else False,
|
||||||
).insert()
|
).insert()
|
||||||
await ctx.send(f"{user.mention} has been muted.\nReason: {reason}")
|
|
||||||
|
embed = build_embed(
|
||||||
|
title="User Muted",
|
||||||
|
description=f"{user.mention} has been muted",
|
||||||
|
fields=[Field(name="Reason", value=reason)],
|
||||||
|
)
|
||||||
|
embed.set_author(
|
||||||
|
name=user.nick if user.nick else user.name,
|
||||||
|
icon_url=user.avatar_url,
|
||||||
|
)
|
||||||
|
embed.set_thumbnail(url=user.avatar_url)
|
||||||
|
embed.set_footer(text=f"{user.name}#{user.discriminator} | {user.id}")
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@cog_ext.cog_slash(
|
@cog_ext.cog_slash(
|
||||||
name="unmute",
|
name="unmute",
|
||||||
|
@ -665,7 +693,18 @@ class AdminCog(commands.Cog):
|
||||||
for mute in mutes:
|
for mute in mutes:
|
||||||
mute.active = False
|
mute.active = False
|
||||||
mute.update()
|
mute.update()
|
||||||
await ctx.send(f"{user.mention} has been unmuted.")
|
embed = build_embed(
|
||||||
|
title="User Unmwaruted",
|
||||||
|
description=f"{user.mention} has been unmuted",
|
||||||
|
fields=[],
|
||||||
|
)
|
||||||
|
embed.set_author(
|
||||||
|
name=user.nick if user.nick else user.name,
|
||||||
|
icon_url=user.avatar_url,
|
||||||
|
)
|
||||||
|
embed.set_thumbnail(url=user.avatar_url)
|
||||||
|
embed.set_footer(text=f"{user.name}#{user.discriminator} | {user.id}")
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
async def _lock_channel(
|
async def _lock_channel(
|
||||||
self,
|
self,
|
||||||
|
@ -998,12 +1037,18 @@ class AdminCog(commands.Cog):
|
||||||
else:
|
else:
|
||||||
fields = []
|
fields = []
|
||||||
for warn in active_warns:
|
for warn in active_warns:
|
||||||
|
admin = ctx.guild.get(warn.admin)
|
||||||
|
admin_name = "||`[redacted]`||"
|
||||||
|
if admin:
|
||||||
|
admin_name = f"{admin.name}#{admin.discriminator}"
|
||||||
fields.append(
|
fields.append(
|
||||||
Field(
|
Field(
|
||||||
name=warn.created_at.strftime(
|
name=warn.created_at.strftime(
|
||||||
"%Y-%m-%d %H:%M:%S UTC"
|
"%Y-%m-%d %H:%M:%S UTC"
|
||||||
),
|
),
|
||||||
value=warn.reason + "\n\u200b",
|
value=f"{warn.reason}\n"
|
||||||
|
+ f"Admin: {admin_name}\n"
|
||||||
|
+ "\u200b",
|
||||||
inline=False,
|
inline=False,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1019,6 +1064,9 @@ class AdminCog(commands.Cog):
|
||||||
icon_url=user.avatar_url,
|
icon_url=user.avatar_url,
|
||||||
)
|
)
|
||||||
embed.set_thumbnail(url=ctx.guild.icon_url)
|
embed.set_thumbnail(url=ctx.guild.icon_url)
|
||||||
|
embed.set_footer(
|
||||||
|
text=f"{user.name}#{user.discriminator} | {user.id}"
|
||||||
|
)
|
||||||
pages.append(embed)
|
pages.append(embed)
|
||||||
else:
|
else:
|
||||||
fields = []
|
fields = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue