Skip to content

Commit

Permalink
make time in embeds timezone-aware
Browse files Browse the repository at this point in the history
  • Loading branch information
moonburnt committed Dec 23, 2022
1 parent 60592a8 commit 0117928
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions notashark/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from notashark import parts
import logging
from discord import utils, Embed, File
from datetime import datetime
from discord.utils import utcnow

log = logging.getLogger(__name__)

Expand All @@ -39,7 +39,7 @@ def make_server_embed(
# Basically - if filename stays the same, sometimes discord decides to show
# the older image instead of never. Which cause minimap to never update
# This will crash if minimap doesnt exist #TODO
timestamp = datetime.utcnow()
timestamp = utcnow()
filename = f"{timestamp.timestamp()}_minimap.png"
minimap = File(data.minimap, filename=filename)

Expand Down Expand Up @@ -95,7 +95,7 @@ def make_server_embed(
def make_servers_embed(data: parts.KagServers) -> Embed:
"""Build embed with summary about all populated kag servers"""

embed = Embed(timestamp=datetime.utcnow())
embed = Embed(timestamp=utcnow())
embed.colour = 0x3498DB
embed_title = "KAG Server List"
embed_overview = (
Expand Down Expand Up @@ -161,7 +161,7 @@ def make_kagstats_embed(data: parts.KagstatsProfile) -> Embed:
weapon_info = f"**{item.weapon}**: {item.kills} kills\n"
top_weapons += weapon_info

embed = Embed(timestamp=datetime.utcnow())
embed = Embed(timestamp=utcnow())
embed.colour = 0x3498DB
# if user has no avatar set - this wont do anything
embed.set_thumbnail(url=data.avatar)
Expand Down Expand Up @@ -231,7 +231,7 @@ def make_leaderboard_embed(data: parts.Leaderboard) -> Embed:
item.position = position
players.append(item)

embed = Embed(timestamp=datetime.utcnow())
embed = Embed(timestamp=utcnow())
embed.colour = 0x3498DB
embed.title = "KAG Stats: Leaderboard"
embed.add_field(
Expand Down Expand Up @@ -263,7 +263,7 @@ def make_leaderboard_embed(data: parts.Leaderboard) -> Embed:
def make_about_embed(name: str = "notashark", prefix: str = "!") -> Embed:
"""Build embed with general info about this bot"""

embed = Embed(timestamp=datetime.utcnow())
embed = Embed(timestamp=utcnow())
embed.colour = 0x3498DB
embed.title = "About Bot"
embed.add_field(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "notashark"
version = "1.1.0"
version = "1.1.1"
description = "notashark - a discord bot for King Arthur's Gold"
readme = "README.md"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="notashark",
version="1.1.0",
version="1.1.1",
description="notashark - a discord bot for King Arthur's Gold",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 0117928

Please sign in to comment.