Browse Source

datetime formatting is now standardised throughout the bot.

tags/v2.0.0
Roxie Gibson 5 years ago
parent
commit
78b91db9a3
3 changed files with 11 additions and 7 deletions
  1. +2
    -0
      roxbot/__init__.py
  2. +1
    -1
      roxbot/cogs/admin.py
  3. +8
    -6
      roxbot/logging.py

+ 2
- 0
roxbot/__init__.py View File

@@ -52,3 +52,5 @@ __description__ = """RoxBot, A Discord Bot made by a filthy Mercy Main. Built wi
[Say Thanks](https://saythanks.io/to/Roxxers)"""
__author__ = "Roxanne Gibson"
__version__ = "2.0.0a"

datetime_formatting = "{:%a %Y/%m/%d %H:%M:%S} UTC"

+ 1
- 1
roxbot/cogs/admin.py View File

@@ -194,7 +194,7 @@ class Admin:
warned_by = str(await self.bot.get_user_info(warning["warned-by"]))
except discord.ext.commands.CommandInvokeError:
warned_by = warning["warned-by"]
date = datetime.datetime.fromtimestamp(warning["date"]).strftime('%c')
date = roxbot.datetime_formatting.format(datetime.datetime.fromtimestamp(warning["date"]))
warn_reason = warning["warning"]
em.add_field(name="Warning %s" % x, value="Warned by: {}\nTime: {}\nReason: {}".format(warned_by, date, warn_reason))
x += 1

+ 8
- 6
roxbot/logging.py View File

@@ -26,7 +26,9 @@ SOFTWARE.


import discord
from roxbot import guild_settings, EmbedColours

import roxbot
from roxbot import guild_settings


async def log(guild, channel, command_name, **kwargs):
@@ -47,7 +49,7 @@ async def log(guild, channel, command_name, **kwargs):
"""
logging = guild_settings.get(guild).logging
if logging["enabled"]:
embed = discord.Embed(title="{} command logging".format(command_name), colour=EmbedColours.pink)
embed = discord.Embed(title="{} command logging".format(command_name), colour=roxbot.EmbedColours.pink)
for key, value in kwargs.items():
embed.add_field(name=key, value=value)
return await channel.send(embed=embed)
@@ -61,11 +63,11 @@ class Logging:
logging = guild_settings.get(member.guild).logging
if logging["enabled"]:
channel = self.bot.get_channel(logging["channel"])
embed = discord.Embed(title="{} joined the server".format(member), colour=EmbedColours.pink)
embed = discord.Embed(title="{} joined the server".format(member), colour=roxbot.EmbedColours.pink)
embed.add_field(name="ID", value=member.id)
embed.add_field(name="Mention", value=member.mention)
embed.add_field(name="Date Account Created", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(member.created_at))
embed.add_field(name="Date Joined", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(member.joined_at))
embed.add_field(name="Date Account Created", value=roxbot.datetime_formatting.format(member.created_at))
embed.add_field(name="Date Joined", value=roxbot.datetime_formatting.format(member.joined_at))
embed.set_thumbnail(url=member.avatar_url)
return await channel.send(embed=embed)

@@ -74,7 +76,7 @@ class Logging:
logging = guild_settings.get(member.guild).logging
if logging["enabled"]:
channel = self.bot.get_channel(logging["channel"])
embed = discord.Embed(description="{} left the server".format(member), colour=EmbedColours.pink)
embed = discord.Embed(description="{} left the server".format(member), colour=roxbot.EmbedColours.pink)
return await channel.send(embed=embed)



Loading…
Cancel
Save