lowered priority of .top, fixed query, removed @protected

This commit is contained in:
Mike Edmister 2019-04-25 10:27:55 -04:00
parent 6404adb773
commit 2533c5872a
2 changed files with 8 additions and 8 deletions

View File

@ -346,14 +346,14 @@ class IRCCore(object):
:type channel: str""" :type channel: str"""
self.sendRaw("JOIN %s" % channel, priority=3) self.sendRaw("JOIN %s" % channel, priority=3)
def act_PRIVMSG(self, towho, message): def act_PRIVMSG(self, towho, message, priority=None):
"""Use the `/msg` command """Use the `/msg` command
:param towho: the target #channel or user's name :param towho: the target #channel or user's name
:type towho: str :type towho: str
:param message: the message to send :param message: the message to send
:type message: str""" :type message: str"""
self.sendRaw("PRIVMSG %s :%s" % (towho, message)) self.sendRaw("PRIVMSG %s :%s" % (towho, message), priority=priority)
def act_MODE(self, channel, mode, extra=None): def act_MODE(self, channel, mode, extra=None):
"""Use the `/mode` command """Use the `/mode` command

View File

@ -156,12 +156,13 @@ class StockPlay(ModuleBase):
self.log.warning("{} wants top 10 sent to {}".format(nick, replyto)) self.log.warning("{} wants top 10 sent to {}".format(nick, replyto))
with closing(self.sql.getCursor()) as c: with closing(self.sql.getCursor()) as c:
for num, row in enumerate(c.execute("""SELECT h1.nick as nick, h1.total as total FROM stockplay_balance_history h1 for num, row in enumerate(c.execute("""SELECT h1.nick as nick, CAST(h1.cents as INTEGER) as cents FROM stockplay_balance_history h1
INNER JOIN (SELECT nick, max(day) as MaxDate FROM stockplay_balance_history GROUP BY nick) h2 INNER JOIN (SELECT nick, max(day) as MaxDate FROM stockplay_balance_history WHERE nick != ? GROUP BY nick) h2
ON h1.nick = h2.nick AND h1.day = h2.MaxDate ON h1.nick = h2.nick AND h1.day = h2.MaxDate
ORDER BY total DESC LIMIT 10""").fetchall(), start=1): ORDER BY cents DESC LIMIT 10""", (DUSTACCT, )).fetchall(), start=1):
total = Decimal(row.cents) / 100
self.bot.act_PRIVMSG(replyto, "{}: {} with total: ~{}".format(num, row.nick, row.total)) self.bot.act_PRIVMSG(replyto,
"{}: {} with total: ~{}".format(num, row.nick, total), priority=5)
def do_trade(self, trade): def do_trade(self, trade):
""" """
@ -470,7 +471,6 @@ class StockPlay(ModuleBase):
@info("top", "show top portfolios", cmds=["top", "top10"]) @info("top", "show top portfolios", cmds=["top", "top10"])
@command("top", "top10", allow_private=True) @command("top", "top10", allow_private=True)
@protected()
def cmd_top(self, message, command): def cmd_top(self, message, command):
""" """
Top 10 report command Top 10 report command