Steam-Chat-Bot / node-steam-chat-bot

Simplified interface for a steam chat bot
MIT License
101 stars 35 forks source link

Antispam trigger is not loading properly. #100

Closed Ahmedstien closed 9 years ago

Ahmedstien commented 9 years ago

http://imgur.com/oWz8UGM,6897PWx This basically happens. I downloaded the trigger from the development site for use. It basically doesnt let any trigger under it to work and idk why.

Efreak commented 9 years ago

I'm on mobile ATM, so I can only guess, can't actually look at it. This seems familiar, though, and I thought I'd fixed it, although I may have forgotten to commit or may have reverted it for some reason. It looks like what's happening is that the onload function isn't returning true for some reason (if there was an error, it should show it, that's part of basetrigger). If you're able to do so, try adding return true to the end of the onload function.

Ahmedstien commented 9 years ago

http://imgur.com/3euYYmV

Still the same error. I tried adding return true in two places, once in each place only but nothing changed.

Ahmedstien commented 9 years ago

Also a person I know off was able to get it run but he would get this error :+1:

2015-08-27T04:51:05.364Z - debug: reloggerforme/antispam: Reducing scores
2015-08-27T04:51:06.367Z - debug: reloggerforme/antispam: Reducing scores
2015-08-27T04:51:07.370Z - debug: reloggerforme/antispam: Reducing scores
2015-08-27T04:51:08.371Z - debug: reloggerforme/antispam: Reducing scores

It would reduce the scores and do nothing other besides reducing the scores even if someone spammed.

Efreak commented 9 years ago

That's not an error. That's a debug message that gets logged every time the timer runs. There might well be an error, but it's not that. Also, if you put triple backticks (``` - same key as the tilde~) around several lines (or indent them with 4 spaces), github will mark them as code. Like it now is above.

Efreak commented 9 years ago

^Above commit should at least allow the trigger to load. I know I had done this previously, so I must have left it unpushed or uncommitted on one of my clones.

Ahmedstien commented 9 years ago

It didn't work for me and the other person who uses it. All other triggers work fine. (I don't know what moderate does) On 1 Sep 2015 9:35 pm, "Efreak" notifications@github.com wrote:

^Above should at least allow the trigger to load. I know I had done this previously, so I must have left it unpushed or uncommitted on one of my clones.

— Reply to this email directly or view it on GitHub https://github.com/Efreak/node-steam-chat-bot/issues/100#issuecomment-136822303 .

Efreak commented 9 years ago

I'll take a longer look at it later. For right now, I've at least fixed #101 with 5653504b--it should load ok assuming no changes to onLoad or to the constructor, even if it doesn't actually work. Later I'll try adding some debugging to it and try it out so I can see what's not working right.

In the meantime, you can try playing with the settings to see if it's just the default settings that aren't correct; try setting the timer resolution to 5 seconds (options:{ptimer=5*1000}) or higher, then spam in a chat. You can use the dev groupchat (visit group page, join chat) for testing if you don't want to spam in your own chat.

Ahmedstien commented 9 years ago

Just to update you, same Issue trigger doesnt load properly and other load triggers under it dont work.

Ahmedstien commented 9 years ago

After using your fix

Efreak commented 9 years ago

Hmm. I really need to go through the trigger loading functions. I still don't know how all of that works, because I never really paid attention to it. It works, so I pretty much leave it alone. <comment typed earlier, new comment incoming>

Efreak commented 9 years ago

I can tell you right now that it's not loading because the trigger type is AntispamTrigger, not antispamTrigger (capital A)

It appears that @bonnici's addTriggers checks first to see that any previous triggers have loaded correctly before attempting to load the next trigger in the list. I'm not certain if there's a reason for this, perhaps he'll comment here to tell us. If there wasn't a reason for it or if it's no longer applicable, I'll remove that check; in the meantime you can bypass it in the future by using addTrigger multiple times instead of using addTriggers once.

Ahmedstien commented 9 years ago

How do I know the triggers proper name for the future ? I was using the name of the file. Also I tried joining the group but I need an invite On 2 Sep 2015 12:24 am, "Efreak" notifications@github.com wrote:

I can tell you right now that it's not loading because the trigger type is AntispamTrigger, not antispamTrigger`.

It appears that bonnici's addTriggers https://github.com/Efreak/node-steam-chat-bot/blob/5558e3370ba6fb5732acf9d219ed49298253f651/lib/chatBot.js#L387 checks first to see that any previous triggers have loaded correctly before attempting to load the next trigger in the list. I'm not certain if there's a reason for this, perhaps he'll comment here to tell us. If there wasn't a reason for it or if it's no longer applicable, I'll remove that check; in the meantime you can bypass it in the future by using addTrigger multiple times instead of using addTriggers once.

— Reply to this email directly or view it on GitHub https://github.com/Efreak/node-steam-chat-bot/issues/100#issuecomment-136865097 .

bonnici commented 9 years ago

Probably a bug. I think I just wanted to load all of them and return the overall status at the end but didn't think about the short circuiting && operation. Looking at it again, it should at least log out an error if one of them doesn't load.

Efreak commented 9 years ago

When I'm done, I'll add documentation to the website. In the meantime, the trigger type is defined near the top of each trigger's source code; it's nearly always something like 'NameTrigger', and usually the same as the filename but with the first letter capitalized.

I could rename the files to make them the same as the trigger types, but I use the command line for everything and that would interfere with autocomplete. /lazy.

I added an error in addTrigger earlier with d5f3086, and just added another one in addTriggers with f74884c that should explain why further triggers aren't loading properly.

I'm going to go ahead and close this issue; other problems with antispamTrigger should come in separate issues. In the meantime, please remember that this is still in development, regardless of my release policy, this hasn't even been released (release = master branch).