[Topgg][Admin][Economy] Implement addCoins cb
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from multiprocessing import context
|
||||
from LionModule import LionModule
|
||||
from LionContext import register_reply_callback, unregister_reply_callback
|
||||
from bot.data.conditions import NOT
|
||||
from meta.client import client
|
||||
from core.lion import register_addcoins_callback, unregister_addcoins_callback
|
||||
|
||||
from .utils import *
|
||||
from .webhook import init_webhook
|
||||
@@ -14,12 +16,14 @@ upvote_info = "You have a boost available {}, to support our project and earn **
|
||||
async def register_hook(client):
|
||||
init_webhook()
|
||||
register_reply_callback(reply)
|
||||
|
||||
register_addcoins_callback(cb_addCoins)
|
||||
|
||||
client.log("Registered LionContext reply util hook.", context="Topgg" )
|
||||
|
||||
@module.unload_task
|
||||
async def unregister_hook(client):
|
||||
unregister_reply_callback(reply)
|
||||
unregister_addcoins_callback(cb_addCoins)
|
||||
|
||||
client.log("Unregistered LionContext reply util hook.", context="Topgg" )
|
||||
|
||||
@@ -51,3 +55,14 @@ def reply(util_func, *args, **kwargs):
|
||||
args = tuple(args)
|
||||
|
||||
return [args, kwargs]
|
||||
|
||||
|
||||
def cb_addCoins(self, amount, flush, ignorebonus):
|
||||
|
||||
client.log('cb_addCoins hook with amount={} ignorebonux={}'.format(amount, ignorebonus), context='Topgg')
|
||||
|
||||
if not ignorebonus and amount > 0 and get_last_voted_timestamp(self.userid):
|
||||
amount *= 1.25
|
||||
client.log('cb_addCoins with bonus={}'.format(amount), context='Topgg')
|
||||
|
||||
return [self, amount, flush, ignorebonus]
|
||||
Reference in New Issue
Block a user