Compare commits
3 Commits
edf901b647
...
bfe8651ee7
Author | SHA1 | Date | |
---|---|---|---|
bfe8651ee7 | |||
d02794709c | |||
d929dc875d |
@ -129,7 +129,7 @@ class PlayersCog(commands.Cog):
|
|||||||
|
|
||||||
player, created = await Player.get_or_create(username=re_match.group("username"))
|
player, created = await Player.get_or_create(username=re_match.group("username"))
|
||||||
await player.open_session(
|
await player.open_session(
|
||||||
timestamp=datetime.strptime(re_match.group("timestamp"), "%m-%d-%y %H:%M:%S.%f"),
|
timestamp=datetime.strptime(re_match.group("timestamp"), "%d-%m-%y %H:%M:%S.%f"),
|
||||||
coord_x=re_match.group("x"),
|
coord_x=re_match.group("x"),
|
||||||
coord_y=re_match.group("y"),
|
coord_y=re_match.group("y"),
|
||||||
coord_z=re_match.group("z")
|
coord_z=re_match.group("z")
|
||||||
@ -154,7 +154,7 @@ class PlayersCog(commands.Cog):
|
|||||||
embed.title = "Player Has Connected"
|
embed.title = "Player Has Connected"
|
||||||
embed.colour = Colour.brand_green()
|
embed.colour = Colour.brand_green()
|
||||||
|
|
||||||
# await channel.send(embed=embed)
|
await channel.send(embed=embed)
|
||||||
|
|
||||||
async def process_disconnected_player(self, line: str, alert: bool = False):
|
async def process_disconnected_player(self, line: str, alert: bool = False):
|
||||||
"""
|
"""
|
||||||
@ -169,7 +169,7 @@ class PlayersCog(commands.Cog):
|
|||||||
|
|
||||||
player, created = await Player.get_or_create(username=re_match.group("username"))
|
player, created = await Player.get_or_create(username=re_match.group("username"))
|
||||||
await player.close_session(
|
await player.close_session(
|
||||||
timestamp=datetime.strptime(re_match.group("timestamp"), "%m-%d-%y %H:%M:%S.%f"),
|
timestamp=datetime.strptime(re_match.group("timestamp"), "%d-%m-%y %H:%M:%S.%f"),
|
||||||
coord_x=re_match.group("x"),
|
coord_x=re_match.group("x"),
|
||||||
coord_y=re_match.group("y"),
|
coord_y=re_match.group("y"),
|
||||||
coord_z=re_match.group("z")
|
coord_z=re_match.group("z")
|
||||||
@ -188,7 +188,7 @@ class PlayersCog(commands.Cog):
|
|||||||
embed.title = "Player Has Disconnected"
|
embed.title = "Player Has Disconnected"
|
||||||
embed.colour = Colour.brand_red()
|
embed.colour = Colour.brand_red()
|
||||||
|
|
||||||
# await channel.send(embed=embed)
|
await channel.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot: commands.Bot):
|
async def setup(bot: commands.Bot):
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
from tortoise import BaseDBAsyncClient
|
|
||||||
|
|
||||||
|
|
||||||
async def upgrade(db: BaseDBAsyncClient) -> str:
|
|
||||||
return """
|
|
||||||
CREATE TABLE IF NOT EXISTS "ingame_coordinates" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
"x" INT NOT NULL,
|
|
||||||
"y" INT NOT NULL,
|
|
||||||
"z" INT NOT NULL
|
|
||||||
);
|
|
||||||
CREATE TABLE IF NOT EXISTS "players" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
"username" VARCHAR(20) NOT NULL UNIQUE,
|
|
||||||
"is_dead" INT NOT NULL DEFAULT 0
|
|
||||||
) /* */;
|
|
||||||
CREATE TABLE IF NOT EXISTS "player_deaths" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
"cause" VARCHAR(32) NOT NULL,
|
|
||||||
"timestamp" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"coordinates_id" INT NOT NULL REFERENCES "ingame_coordinates" ("id") ON DELETE CASCADE,
|
|
||||||
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
CREATE TABLE IF NOT EXISTS "player_session" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
"connected_at" TIMESTAMP NOT NULL,
|
|
||||||
"disconnected_at" TIMESTAMP NOT NULL,
|
|
||||||
"connected_coords_id" INT NOT NULL REFERENCES "ingame_coordinates" ("id") ON DELETE CASCADE,
|
|
||||||
"disconnected_coords_id" INT REFERENCES "ingame_coordinates" ("id") ON DELETE CASCADE,
|
|
||||||
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
CREATE TABLE IF NOT EXISTS "steam_profile_summary" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
"steam_id" VARCHAR(20) NOT NULL UNIQUE,
|
|
||||||
"profile_name" VARCHAR(32) NOT NULL,
|
|
||||||
"url" VARCHAR(128) NOT NULL,
|
|
||||||
"avatar_url" VARCHAR(128) NOT NULL,
|
|
||||||
"last_update" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
CREATE TABLE IF NOT EXISTS "aerich" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
"version" VARCHAR(255) NOT NULL,
|
|
||||||
"app" VARCHAR(100) NOT NULL,
|
|
||||||
"content" JSON NOT NULL
|
|
||||||
);"""
|
|
||||||
|
|
||||||
|
|
||||||
async def downgrade(db: BaseDBAsyncClient) -> str:
|
|
||||||
return """
|
|
||||||
"""
|
|
@ -219,7 +219,7 @@ class Player(Model):
|
|||||||
summary = await self.get_steam_summary()
|
summary = await self.get_steam_summary()
|
||||||
|
|
||||||
# If the summary exists and isn't outdated then return it, no work to be done!
|
# If the summary exists and isn't outdated then return it, no work to be done!
|
||||||
if summary and summary.last_update + timedelta(days=1) > datetime.today():
|
if summary and summary.last_update + timedelta(days=1) > datetime.now(tz=utc):
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
# Update if summary is NoneType or older than 1 day
|
# Update if summary is NoneType or older than 1 day
|
||||||
|
Reference in New Issue
Block a user