add announce channel
This commit is contained in:
parent
4161be93e4
commit
e2c412fdef
|
@ -55,7 +55,9 @@ Config
|
||||||
"tcachesecs": 300,
|
"tcachesecs": 300,
|
||||||
"rcachesecs": 14400,
|
"rcachesecs": 14400,
|
||||||
"bginterval": 300,
|
"bginterval": 300,
|
||||||
"midnight_offset": 0
|
"midnight_offset": 0,
|
||||||
|
"announce_trades": false,
|
||||||
|
"announce_channel": "#trades"
|
||||||
}
|
}
|
||||||
|
|
||||||
.. cmdoption:: startbalance
|
.. cmdoption:: startbalance
|
||||||
|
@ -106,6 +108,18 @@ Config
|
||||||
|
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
|
.. cmdoption:: announce_trades
|
||||||
|
|
||||||
|
Boolean option to announce all trades in a specific channel.
|
||||||
|
|
||||||
|
Default: false
|
||||||
|
|
||||||
|
.. cmdoption:: announce_channel
|
||||||
|
|
||||||
|
Channel name to announce all trades in.
|
||||||
|
|
||||||
|
Default: not set
|
||||||
|
|
||||||
|
|
||||||
Class Reference
|
Class Reference
|
||||||
---------------
|
---------------
|
||||||
|
|
|
@ -5,5 +5,7 @@
|
||||||
"tcachesecs": 300,
|
"tcachesecs": 300,
|
||||||
"rcachesecs": 14400,
|
"rcachesecs": 14400,
|
||||||
"bginterval": 300,
|
"bginterval": 300,
|
||||||
"midnight_offset": 0
|
"midnight_offset": 0,
|
||||||
|
"announce_trades": true,
|
||||||
|
"announce_channel": "#trades"
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,13 +309,18 @@ class StockPlay(ModuleBase):
|
||||||
self.set_bal(DUSTACCT, dustbal + int(dust * 100))
|
self.set_bal(DUSTACCT, dustbal + int(dust * 100))
|
||||||
|
|
||||||
# notify user
|
# notify user
|
||||||
self.bot.act_PRIVMSG(trade.replyto,
|
message = "{} {} {} for {}. cash: {}".format("bought" if trade.buy else "sold",
|
||||||
"{}: {} {} {} for {}. cash: {}".format(trade.nick,
|
trade.amount,
|
||||||
"bought" if trade.buy else "sold",
|
trade.symbol,
|
||||||
trade.amount,
|
format_price(trade_price),
|
||||||
trade.symbol,
|
format_price(nickbal))
|
||||||
format_price(trade_price),
|
self.bot.act_PRIVMSG(trade.replyto, "{}: {}".format(trade.nick, message))
|
||||||
format_price(nickbal)))
|
|
||||||
|
# announce message
|
||||||
|
if self.config.get("announce_trades"):
|
||||||
|
channel = self.config.get("announce_channel")
|
||||||
|
if channel:
|
||||||
|
self.bot.act_PRIVMSG(channel, "{}_ {}".format(trade.nick, message), priority=10)
|
||||||
|
|
||||||
self.log_trade(trade.nick, time(), "buy" if trade.buy else "sell",
|
self.log_trade(trade.nick, time(), "buy" if trade.buy else "sell",
|
||||||
trade.symbol, trade.amount, trade_price, str(symprice))
|
trade.symbol, trade.amount, trade_price, str(symprice))
|
||||||
|
|
Loading…
Reference in New Issue