bitbot-irc / bitbot

https://bitbot.dev | Python3 event-driven modular IRCv3 bot 🤖

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

!richest dosen't have 0-spaces to avoid pings

fosslinux opened this issue · comments

With !friends, BitBot outputs 0-spaces in between the first and second character to avoid endless pings.

However, !richest doesn't. We should make it do this for all nick-lists.

The issue, as far as I can tell from a basic reading of the code, lies in the fact that the coins module lacks a highlight prevention setting. For instance, in the ducks module:

    def _top_duck_stats(self, server, target, setting, description,
            channel_query):
        # -snipped-
        top_10 = utils.top_10(user_stats,
            convert_key=lambda n: self._get_nickname(server, target, n))
        return "Top duck %s%s: %s" % (description, channel_query_str,
            ", ".join(top_10))

    def _get_nickname(self, server, target, nickname):
        nickname = server.get_user(nickname).nickname
        if target.get_setting("ducks-prevent-highlight", True):
            nickname = utils.prevent_highlight(nickname)
        return nickname

A similar method could be implemented in the coins module (with a coins-prevent-highlight setting or similar).

I haven't a clue as to if this is correct, but I'll just put it out here. examknow@53e1114

Both of the branches in your check of coins-prevent-highlight do the highlight prevention. Also, instead of using a lambda in that case, I feel like it would be easier to read if there were a function that got the nickname AND did the highlight prevention if necessary (like ._get_nickname method in the ducks module).

Both of the branches in your check of coins-prevent-highlight do the highlight prevention. Also, instead of using a lambda in that case, I feel like it would be easier to read if there were a function that got the nickname AND did the highlight prevention if necessary (like ._get_nickname method in the ducks module).

We might be able to do that although I was trying to keep the code as the same as possible. Once I confirm that it works on my install, I'll open a PR to the dev branch.