Add voting page and track referrals

This commit is contained in:
Jeremy Zhang
2018-02-27 07:22:58 +00:00
parent 5f160e1b9f
commit 32c3491b54
8 changed files with 109 additions and 5 deletions

View File

@ -15,6 +15,7 @@ from .titan_tokens import TitanTokens, get_titan_token
from .token_transactions import TokenTransactions
from .patreon import Patreon
from .disabled_guilds import DisabledGuilds, list_disabled_guilds
from .discordbotsorg_transactions import DiscordBotsOrgTransactions
def set_titan_token(user_id, amt_change, action):
token_count = get_titan_token(user_id)

View File

@ -0,0 +1,18 @@
from titanembeds.database import db
import datetime
import time
class DiscordBotsOrgTransactions(db.Model):
__tablename__ = "discordbotsorg_transactions"
id = db.Column(db.Integer, primary_key=True) # Auto increment id
user_id = db.Column(db.BigInteger, nullable=False) # Discord user id of user
timestamp = db.Column(db.TIMESTAMP, nullable=False) # The timestamp of when the action took place
action = db.Column(db.String(255), nullable=False) # Very short description of the action
referrer = db.Column(db.BigInteger, nullable=True) # Discord user id of the referrer
def __init__(self, user_id, action, referrer=None):
self.user_id = user_id
self.action = action
if referrer:
self.referrer = referrer
self.timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')