mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-07-03 03:35:24 +02:00
Initial structure for discordbot addition
This commit is contained in:
20
webapp/titanembeds/database/authenticated_users.py
Normal file
20
webapp/titanembeds/database/authenticated_users.py
Normal file
@ -0,0 +1,20 @@
|
||||
from titanembeds.database import db
|
||||
import datetime
|
||||
import time
|
||||
|
||||
class AuthenticatedUsers(db.Model):
|
||||
__tablename__ = "authenticated_users"
|
||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
||||
guild_id = db.Column(db.String(255)) # Guild pretaining to the authenticated user
|
||||
client_id = db.Column(db.String(255)) # Client ID of the authenticated user
|
||||
last_timestamp = db.Column(db.TIMESTAMP) # The timestamp of when the user has last sent the heartbeat
|
||||
|
||||
def __init__(self, guild_id, client_id):
|
||||
self.guild_id = guild_id
|
||||
self.client_id = client_id
|
||||
self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
def bumpTimestamp(self):
|
||||
self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
|
||||
db.session.commit()
|
||||
return self.last_timestamp
|
Reference in New Issue
Block a user