Open ryzokuken opened 7 years ago
@ryzokuken , I'll take this up.
@jywarren this can be possibly fixed by using https://node-irc.readthedocs.io/en/latest/API.html#Client.nick.
Should I refactor this into an FTO, or should I solve this right now?
an FTO would be great!
On Mon, Aug 7, 2017 at 3:39 PM, Ujjwal Sharma notifications@github.com wrote:
@jywarren https://github.com/jywarren this can be possibly fixed by using https://node-irc.readthedocs.io/en/latest/API.html#Client.nick.
Should I refactor this into an FTO, or should I solve this right now?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plotsbot/issues/8#issuecomment-320759947, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ5MlUXRzgxBB-X7M0KH0t77n5-Zxks5sV2gAgaJpZM4NtkVs .
@jywarren Added a sample problem statement. Does that sound about right?
Hi -- I think it could use both a "problem" and "solution" section -- take a look at this for some guidance!
Thanks!
@gauravano Would like to help out on this.
Great @sidntrivedi012!
Sometimes, the specific IRC nick isn't available for use over the network (this might happen due to a connection issue where a previous instance has neither parted nor timed out of the channel and you try to reconnect). In such a scenario, the IRC library in use falls back to another numbered nick (i.e., if you
plotsbot
is taken, you will be namedplotsbot1
instead).Naturally, the user would mention the bot by its new (rather strange) name, but as the bot uses
config.name
internally, it wouldn't be able to know correctly when it is mentioned (because its looking for the wrong name entirely) and also the help message wouldn't make much sense (although each of the mentioned commands would completely work).We would need to find a way to figure out when the required nick isn't available, which nick we fell back to, and then use THAT nick appropriately.
Preparing a first-timers-only
The various behaviors use and display the
botNick
variable inside the behaviors object to display the various values and also to ascertain that the message was indeed meant for the bot. Right now, we statically set the value ofbotNick
to be the same as that of the attempted value of the bot's nick. However, if there's an issue and the bot is forced to fall back to an alternate value, there is a discrepancy between the two values - leading to this bug. In order to solve this, let's dynamically set the value ofbotNick
toclient.nick
instead.