Sorted, formatted, removed unused imports

This commit is contained in:
2023-05-06 18:56:01 +02:00
parent 640ab65e7a
commit 5ff49ed052
6 changed files with 49 additions and 41 deletions

View File

@@ -7,19 +7,20 @@ from modules.utils import config_get
class Logger(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_message(self, message: Message):
if (message.author != self.client.user) and (message.author.bot == False) and (message.author.system == False):
if (
(message.author != self.client.user)
and (message.author.bot == False)
and (message.author.system == False)
):
if col_users.find_one({"user": message.author.id}) is None:
user = {}
defaults = await config_get("user", "defaults")
user["user"] = message.author.id
for key in defaults:
@@ -29,21 +30,33 @@ class Logger(commands.Cog):
@commands.Cog.listener()
async def on_member_join(self, member: Member):
welcome_chan = ds_utils.get(
self.client.get_guild(await config_get("guild")).channels,
id=await config_get("welcome", "channels", "text"),
)
rules_chan = ds_utils.get(
self.client.get_guild(await config_get("guild")).channels,
id=await config_get("rules", "channels", "text"),
)
welcome_chan = ds_utils.get(self.client.get_guild(await config_get("guild")).channels, id=await config_get("welcome", "channels", "text"))
rules_chan = ds_utils.get(self.client.get_guild(await config_get("guild")).channels, id=await config_get("rules", "channels", "text"))
if (member != self.client.user) and (member.bot == False) and (member.system == False):
await welcome_chan.send(content=(await config_get("welcome", "messages")).format(mention=member.mention, rules=rules_chan.mention))
if (
(member != self.client.user)
and (member.bot == False)
and (member.system == False)
):
await welcome_chan.send(
content=(await config_get("welcome", "messages")).format(
mention=member.mention, rules=rules_chan.mention
)
)
if col_users.find_one({"user": member.id}) is None:
user = {}
defaults = await config_get("user", "defaults")
user["user"] = member.id
for key in defaults:
user[key] = defaults[key]
col_users.insert_one(document=user)
col_users.insert_one(document=user)