Archisteamfarm: Bot thinks all messages with two dashes are keys and tries to redeem them

Created on 20 Apr 2016  路  5Comments  路  Source: JustArchiNET/ArchiSteamFarm

When I send a message with two dashes from my main account to a bot, it takes it as a key and tries to redeem it when the message doesn't even include !redeem.

Situation: Forward keys to other bots is enabled and we are talking in private chat. Onurtag is the SteamOwnerID of Cardfarmer(and all other bots) and the SteamMasterID of Cardfarmer is a different account for !loot purposes.

examples:
00:48 - Onurtag: tata-ta-tata
00:48 - Cardfarmer: Key: tata-ta-tata | Status: InvalidKey | Items:

00:48 - Onurtag: http://na.leagueoflegends.com/en/featured/mid-season-magic
00:48 - Cardfarmer: Key: http://na.leagueoflegends.com/en/featured/mid-season-magic | Status: InvalidKey | Items:

01:00 - Onurtag: t-5-5
01:01 - Cardfarmer: Key: t-5-5 | Status: InvalidKey | Items:

I'm sorry if there is an option to disable this feature? but I checked the wiki twice and couldnt see it.

Thanks for the great work.

Discussion Feedback welcome Not a bug

Most helpful comment

I improved the way how keys are detected, thanks to @GUiHKX - this should decrease amount of false-positives with 2+ dashes greatly, while still catching all valid cd-keys for redeemption. Thanks!

All 5 comments

There is no option currently because there is no reason why you'd be talking to the bot without wanting anything from it. The purpose of ASF bot is to receive commands and respond to them, not smartly guess what is a command and what is not. The behaviour you listed is intended and was created for the simple purpose of copy-pasting keys to the bot without a need to specify command or specific ASF syntax for separating keys. I even wanted to treat every message that doesn't start with ! as a cd-key for !redeem, but in the end decided that people probably would not understand the meaning of that, so I added a validation that checks if your text message could be cd-key, and if yes, tries to proceed as with !redeem.

That behaviour exists since first version of ASF, and many people including me are used to that. There is no logical reason why you'd want to keep bot receiving your messages and NOT responding to them, ASF gives you option to define both SteamOwnerID and SteamMasterID in order to fine-tune to which steam accounts ASF bot is even listening. This works very well because it doesn't sacrifice convenience, while removing of smart auto-redeem does. For example previous way of being able to copy-paste list of 20-cdkeys separated by a newline, will now result in a need of transformating all of that into !redeem key1,key2,key3...keyN command, which is far less readable, not to mention that you need to put more work in sending such command.

I'm open for discussion of other devs and users what they think about current behaviour, and if it should be changed, especially people who know the principals of ASF such as @Ryzhehvost. Removing the current mechanism is as easy as commenting out one line, the question is if we want to sacrifice convenience for potential "sacrificial" need of accepting the fact that you could be talking to the bot without expecting any response. I'm neutral towards that, and my neutrality means that I'm actually against doing the changes, simply because people are used to old ways and we should ask why we should change something that already exists, and not why we should keep it the way it is now. If there is not enough benefit for favoring the approach which changes things, it should not be followed.

As above, I'm open for discussion, especially discussion which considers more devs and users, as it's very crucial to see other point of view when deciding upon such thing.

I see, if other people are using this feature frequently I don't really mind it as I would use two dashes only maybe once in a year.
Looks like steam accepts many different key styles (1) so I can see why it would be quite hard to adapt to every single them.
Then until we get a good suggestion it is fine as is.

IMO that's not a big deal. But a simple regex could at least cover the most used CD-KEY formats and reduce the conflicts:

/[0-9A-Z]{4,5}-[0-9A-Z]{4,5}-[0-9A-Z]{4,5}-?(?:(?:[0-9A-Z]{4,5}-?)?(?:[0-9A-Z]{4,5}))?/ig

To test it, first copy this whole page, go to Regex Pal and paste it in the 'Test String' field, then you add the regex above in the 'Regular Expression' field and see how many CD-KEY formats it will match. It is possible to create a "perfect" regex, however it would be (even more) gigantic and not worth IMO.

As a part of discussion - I like the way it is now. I don't see a reason to send random messages to bot, so, in most cases, it's either command or a key. Current check makes sure that if you accidentally sent message to a bot instead of your friend, it will not be handled as a legit command, that's all. Of course it's possible to make a regex to make it even more bulletproof, but it would be big, time consuming (when redeeming multiple keys), and if valve decide to add slightly different key format - we would need to edit it. So, I think using regex in this case is redundant. Of course decision is up to Archi, I would not mind any solution that works and does not bring inconvenience comparing to current state.

I improved the way how keys are detected, thanks to @GUiHKX - this should decrease amount of false-positives with 2+ dashes greatly, while still catching all valid cd-keys for redeemption. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ttrl picture ttrl  路  3Comments

JustArchi picture JustArchi  路  3Comments

Sirogabober picture Sirogabober  路  4Comments

light444 picture light444  路  3Comments

Gilrain picture Gilrain  路  3Comments