.BANCHO. Add notification when donor tag is expiring soon
This commit is contained in:
@@ -9,6 +9,7 @@ import traceback
|
||||
from helpers import logHelper as log
|
||||
from helpers import chatHelper as chat
|
||||
from constants import privileges
|
||||
import time
|
||||
|
||||
def handle(tornadoRequest):
|
||||
# Data to return
|
||||
@@ -108,6 +109,15 @@ def handle(tornadoRequest):
|
||||
# Check restricted mode (and eventually send message)
|
||||
responseToken.checkRestricted()
|
||||
|
||||
# Send message if donor expires soon
|
||||
if responseToken.privileges & privileges.USER_DONOR > 0:
|
||||
expireDate = userHelper.getDonorExpire(responseToken.userID)
|
||||
if expireDate-int(time.time()) <= 86400*3:
|
||||
expireDays = round((expireDate-int(time.time()))/86400)
|
||||
expireIn = "{} days".format(expireDays) if expireDays > 1 else "less than 24 hours"
|
||||
responseToken.enqueue(serverPackets.notification("Your donor tag expires in {}! When your donor tag expires, you won't have any of the donor privileges, like yellow username, custom badge and discord custom role and username color! If you wish to keep supporting Ripple and you don't want to lose your donor privileges, you can donate again by clicking on 'Support us' on Ripple's website.".format(expireIn)))
|
||||
|
||||
|
||||
# Set silence end UNIX time in token
|
||||
responseToken.silenceEndTime = userHelper.getSilenceEnd(userID)
|
||||
|
||||
|
Reference in New Issue
Block a user