Move module specific help to modules

This commit is contained in:
moneromooo 2015-01-01 14:23:34 +00:00
parent ce3c69b339
commit 44d6f01378
4 changed files with 45 additions and 26 deletions

View file

@ -20,6 +20,21 @@ from tipbot.command_manager import *
last_wallet_update_time = None
def GetTipbotAddress():
try:
j = SendWalletJSONRPCCommand("getaddress",None)
if not "result" in j:
log_error('GetTipbotAddress: No result found in getaddress reply')
return ERROR
result = j["result"]
if not "address" in result:
log_error('GetTipbotAddress: No address found in getaddress reply')
return ERROR
return result["address"]
except Exception,e:
log_error("GetTipbotAddress: Error retrieving %s's address: %s" % (config.tipbot_name, str(e)))
return "ERROR"
def UpdateCoin(param):
irc = param[0]
redisdb = param[1]
@ -89,5 +104,11 @@ def UpdateCoin(param):
log_error('UpdateCoin: Failed to get bulk payments: %s' % str(e))
last_wallet_update_time = time.time()
RegisterIdleFunction(__name__,UpdateCoin)
def Help(nick):
SendTo(nick, "You can send %s to your account:" % coinspecs.name);
SendTo(nick, " Address: %s" % GetTipbotAddress())
SendTo(nick, " Payment ID: %s" % GetPaymentID(nick))
RegisterIdleFunction(__name__,UpdateCoin)
RegisterHelpFunction(__name__,Help)

View file

@ -144,6 +144,12 @@ def Withdraw(nick,chan,cmd):
log_error('Withdraw: FAILED TO SUBTRACT BALANCE: exception: %s' % str(e))
CheckDisableWithdraw()
def Help(nick):
fee = config.withdrawal_fee or coinspecs.min_withdrawal_fee
min_amount = config.min_withdraw_amount or fee
SendTo(nick, "Minimum withdrawal: %s" % AmountToString(min_amount))
SendTo(nick, "Withdrawal fee: %s" % AmountToString(fee))
RegisterCommand({
@ -168,3 +174,4 @@ RegisterCommand({
'admin': True,
'help': "Disable withdrawals"
})
RegisterHelpFunction(__name__,Help)