From c2c24724079b0b6d51c5999f35fe954a427f57a1 Mon Sep 17 00:00:00 2001 From: Chosen-Fate <55001472+Chosen-Fate@users.noreply.github.com> Date: Fri, 9 Oct 2020 20:03:45 +0200 Subject: [PATCH] Clean up code --- main.py | 16 +++++++--------- outsources/util.py | 8 -------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index bcf3331b5..03f1bb52f 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,7 @@ from discord.ext import commands from outsources import functions, util from requests.auth import HTTPBasicAuth +from datetime import datetime mydb = config.DBdata @@ -183,14 +184,10 @@ async def serverinfo(ctx): async def userinfo(ctx, *, user: discord.Member = None): if not user: user = ctx.author - createmin = await util.minuteFormat(user.created_at.minute) - joinmin = await util.minuteFormat(user.joined_at.minute) roles = '' - userroles = reversed(user.roles) - for role in userroles: - if role.name == "@everyone": - continue - roles += f" {role.mention}" + for role in reversed(user.roles): + if role.name != "@everyone": + roles += f" {role.mention}" createday = user.created_at.day joinday = user.joined_at.day while joinday > 7: @@ -200,8 +197,9 @@ async def userinfo(ctx, *, user: discord.Member = None): embed = discord.Embed(color=user.color, description=f"{user.mention} {util.statusemoji.get(str(user.status))}") embed.set_author(name=user, icon_url=user.avatar_url) embed.set_thumbnail(url=user.avatar_url) - embed.add_field(name="Joined:", value=f"{util.weekdays[joinday]} {user.joined_at.day}.{user.joined_at.month}.{user.joined_at.year} {user.joined_at.hour}:{joinmin}", inline=True) - embed.add_field(name="Created at:", value=f"{util.weekdays[createday]} {user.created_at.day}.{user.created_at.month}.{user.created_at.year} {user.created_at.hour}:{createmin}", inline=True) + print(user.joined_at.strftime("%d.%m.%Y %H:%M")) + embed.add_field(name="Joined:", value=f"{util.weekdays[joinday]} {user.joined_at.strftime('%d.%m.%Y %H:%M')}", inline=True) + embed.add_field(name="Created at:", value=f"{util.weekdays[createday]} {user.created_at.strftime('%d.%m.%Y %H:%M')}", inline=True) if roles: embed.add_field(name=f"Roles [{len(user.roles)-1}]:", value=roles, inline=False) if user.voice: diff --git a/outsources/util.py b/outsources/util.py index d082900be..427825b43 100644 --- a/outsources/util.py +++ b/outsources/util.py @@ -7,11 +7,3 @@ "dnd": "<:dnd:764099993035997184>", "offline": "<:offline:764099989327970344>" } - - -async def minuteFormat(raw): - if raw < 10: - formatMin = f"0{raw}" - else: - formatMin = raw - return formatMin