ArchiSteamFarm icon indicating copy to clipboard operation
ArchiSteamFarm copied to clipboard

ASF command suggestion

Open judgegr opened this issue 10 years ago • 9 comments

Hello, please check this draft definition of a new ASF command. It's rather sketchy for the time being, but i'm sure you'll get the idea:

!config command

Syntax: !config <bot_name> [<config_option> [<config_value>]]

A new command for changing bot's configuration on-the-fly, using ASF chat or WCF commands. The use should be restricted to changing a small set of safe options like FarmingOrder, AcceptGifts, DismissInventoryNotifications, SendOnFarmingFinished, TradingPreferences, FarmOffline, IsBotAccount etc.

Why? Because:

  • Some users find it difficult to edit a json file 👶
  • External apps can use this managed way to read and change a bot's configuration without messing with the real files. 👮
  • In the future it would be awesome for ASF to configure itself through command line, even add/remove bots and configure them on-the-fly. 🏆

Samples

!config bot1 FarmingOrder 4 This will change bot1 to CardDropsDescending farming algorithm.

!config bot2 SendOnFarmingFinished True This will change bot2's after-farming behaviour to send all collected cards to SteamMasterID.

!config bot3 FarmOffline This will display bot3's FarmOffline saved config value. (usage: unknown, rather cosmetic value)

!config bot4 RESET This would re-initialize bot4 without changing user/pass and other vital options. Only ASF's recommended options should be reverted to default.

!config bot5 No values, this would display bot5's config options. This one might be dropped and implemented as an API enhancement, eg. !api -config command would return bots' configuration as json structure. (Meh, I know this goes way further of ASF's scope, but i'm leaving it here to show the possibilities).

Considerations

For security, this should only work from SteamOwnerID, like !exit, !restart, !update commands. Also, ASF engine should be made aware of the changes and possibly restart the reconfigured bot.

Next phase

The !config command could be expanded to include a wider (or full) set of config options.

judgegr avatar Dec 03 '16 17:12 judgegr

Personally I'm against this command. ASF already includes auto-reload of configs modified on-the-fly, and I see absolutely no reason for anybody to use a command instead of config edit. Config is not supposed to be modified on daily basis, but written once and being used all the time.

Moreover, due to the way how complex ASF is, this command would be equal to bot restart in order to apply a change, as there are many properties you can't easily edit without a bot restart. I'm not convinced enough "why":

Some users find it difficult to edit a json file

That has absolutely no point - ASF-ConfigGenerator already exists, and you can implement easily another GUI which acts as a frontend for user in config generation/modifications.

External apps can use this managed way to read and change a bot's configuration without messing with the real files.

External apps should not affect config properties being used at all - that's what ConfigGenerator is for, and user configuring ASF.

In the future it would be awesome for ASF to configure itself through command line, even add/remove bots and configure them on-the-fly.

ASF can already add and remove bots/configs on the fly (without program restart), and I see absolutely no reason for it being able to configure itself from command line, if you've just said that users have difficulties editing JSON config, I can't even imagine how they'd be able to edit ASF via command line.

Unless you can convince me that this has at least one valid usage that I can consider worthy, probably it won't happen anytime soon. Right now I consider this suggestion entirely useless, probably for some specific third-party app usage that is touching things it should not, as ASF config can be edited during runtime, and it's already possible - through a file change. Whether it's user, app or OS doing the change, doesn't really matter for ASF, and temporary edits are discouraged.

JustArchi avatar Dec 03 '16 17:12 JustArchi

Ah i was greatly misunderstood... 😢

I'm a bit disappointed you almost instantly threw my idea to the garbage bin but since it's up for discussion, i'll try to explain some things. For starters, although i can honestly understand your attitude for being overprotective against anyone who wants to change your app's config files (i would/have done that too!), i think your answers are a bit controversial and versus each other. See:

bot.json files are generated by the users and not ASF, so technically they are user's property, not ASF's. ASF is using config files to understand user's will on how to use ASF. That's why you implemented options that reflect user's decisions and options to enable/disable/leave-and-forget, right? So, to be honest here, any third party application may change bot.json files assuming they can do it correctly. You even mentioned it yourself:

and you can implement easily another GUI which acts as a frontend for user in config generation/modifications.

Although a few lines later you say that:

External apps should not affect config properties being used at all - that's what ConfigGenerator is for, and user configuring ASF.

I'm confused here. Aren't we supposed to edit bot.json by ourselves? Can we use notepad or not? How is it better to use any unauthorized app/tool/editor to edit bot.json and not use an internal !config command? As for ConfigGenerator, this is a really sweet tool, but it is also an external tool, like anybody else's approach to editing those json files.

Let's see something else: I've starting building a shell/GUI app to access ASF while it is running. I want it to be more user-friendly (or should i say noob friendly) so that ASF would be used by far more people in the future. That way i need to advertise more of some ASF's options like FarmingOrder which is awesome and many users don't even know -considering the recurring questions in SG forum.

Now let's think, is it more logical for me as a developer to build my own way to edit json files -which would be easy, we totally agree- , and possibly make a mess of them, or should i use the already official way to change those options? Should i pop-up my user to say "ok, now you wanna change this or that option, start ConfigGenerator, learn to use it and change it yourself"? LOL maybe i should display a middle-finger gif along with the message instead of giving him a click-wait-done procedure. 😆

In fact, this is not for my only benefit, i think if you implemented some -higher level- functions and easier ways for devs to connect to your tool, more devs would start building on top of your acclaimed tool. Well, maybe not but who really knows.

Finally, having a developer's notion over everything, I'd like to consider ASF as a class or a DLL that i can access through a service / WCF server option. Considering that, i would love accessing ASF's public properties and methods that would ensure me authorized access and data validation. This, imho, would make ASF even greater, like a big class implementing the perfect encapsulation.

Anyway, i've mentioned all the above in a rather theorical level of discussion. You know better than me what you should do with your baby. Thanks for stealing away your free time, anyway. 😸

judgegr avatar Dec 03 '16 19:12 judgegr

I'm confused here. Aren't we supposed to edit bot.json by ourselves? Can we use notepad or not? How is it better to use any unauthorized app/tool/editor to edit bot.json and not use an internal !config command?

ASF is supposed to read your config, parse it, and act the way you want. It is better to use app/tool/editor for that, because it can ensure things your notepad can't, e.g. proper JSON structure, ensuring you won't input invalid types etc. This is what ConfigGenerator is doing, and I'll always suggest to use something more capable of fitting particular tasks than anything you can think of - there is a reason why you program in Visual Studio or any other IDE and not plain Notepad - this is also the reason why you should use ASF's CG or any other tool for editing config files, and not just anything.

Now let's think, is it more logical for me as a developer to build my own way to edit json files -which would be easy, we totally agree- , and possibly make a mess of them, or should i use the already official way to change those options?

There is no already official way. Both ASF and ASF-CG has hardcoded valid structure for given version of ASF to use. Exposing that hardcoded structure to you in API or command is pointless considering the fact that your app is not ASF V3 that is supposed to edit configs.

Let's see something else: I've starting building a shell/GUI app to access ASF while it is running. I want it to be more user-friendly (or should i say noob friendly) so that ASF would be used by far more people in the future. That way i need to advertise more of some ASF's options like FarmingOrder which is awesome and many users don't even know -considering the recurring questions in SG forum.

GUI that I started working on a while ago has fundaments ready, missing only actual structure of the APP and using everything that ASF backend can provide. Want to help? PRs are welcome - backend is ready.

image

Finally, having a developer's notion over everything, I'd like to consider ASF as a class or a DLL that i can access through a service / WCF server option. Considering that, i would love accessing ASF's public properties and methods that would ensure me authorized access and data validation. This, imho, would make ASF even greater, like a big class implementing the perfect encapsulation.

With one difference - I'm not building a class library - I'm build a program with given set of features. Any extra third-party integration, such as WCF, is entirely optional and not actively worked on. The objective of those extra bits is to make it more or less possible for third-party integration, such as e.g. redeeming keys via php script, or easily checking status of the bots without a need to parse log file. WCF is not designed for ASF configuration during runtime - it never was.

If you really want to make a nice ASF frontend that would encourage newbie users into using ASF, possibly make it very easy to use with only a few actual clicks, then you're in massive luck, because GUI app I started working on has everything you need in terms of the backend, and is missing everything you want to add in terms of frontend, so you can simply start integrating CG things, and then entire user ASF frontend you have in mind, with the backend that you have access to (and is shared with main ASF executable). If you on the other hand want to create something entirely different, then you're out of luck as I don't consider any third-party non-ASF app as in need to access internal ASF things, such as config structure.

JustArchi avatar Dec 03 '16 19:12 JustArchi

Anyway, i've mentioned all the above in a rather theorical level of discussion. You know better than me what you should do with your baby. Thanks for stealing away your free time, anyway.

I'm always open for discussion and enhancing ASF, if I can spot advantages of doing so. I can't see any advantage for a !config command that would allow users to edit config temporarily during runtime, and I can see massive disadvantages in terms of code, complexity, bugs and overall structure if I allow to do that. Your only argument so far is that you'd want to create a nice frontend for ASF and you need to allow config edits - that's fine, but it has nothing to do with ASF being capable of doing so via a command, as your argument would be very strong if I was building a class library, and not an actual program. Your enhancements are more fitting into enhancing ASF itself and not creating another program that would try to fix what is not broken.

In fact, if you truly want to do what you advertise, then enhancing that GUI app should be much better for you, as it doesn't use some awful WCF way that is supposed to execute ASF commands, but entire ASF structure, for example (as you can see above), providing you with avatar hashes out of the box after initialization that can be displayed. You can't make independent frontend app without strong support of backend base, and in this case backend base is not developer-friendly by definition, as it's a program and not class library. That's why I'd be happy if you decided to improve existing GUI which is in early development, instead of doing the same in much worse way by using WCF and re-implementing everything only because ASF doesn't expose it as a typical library. Of course, decision is up to you, I can't force anybody to contribute to ASF. You can even entirely disagree with me, tell me to begone, fork ASF and release your own fork - license permits you to do so. I just can't see a reason why fix what is not broken, instead of improving the base project.

JustArchi avatar Dec 03 '16 20:12 JustArchi

I see. I've locally built your GUI about 10d ago and saw you've cleverly embedded asf into it, good job! I did't see any GUI per se, or functions, only some code downloading the avatar and resizing the image, right? ASF is there though, which made me quite ..jealous. 😛

I could jump aboard and start building a GUI like the one i started myself, but sorry i won't -for the time being, that is. The main reason is that i'm 43y old, retired (due to heart problems) mainly VB.NET (partially C#) developer, who only seeks positive thoughts thru coding apps / scripts that might be useful to others. As you may imagine, I have nothing to prove, nothing to gain and also nothing to be afraid of.

That being said, i think that your mentality is totally opposite than mine and working together might be catastrophic for my stress levels. If i were 20y younger i might have dropped a couple of different GUIs as we speak, instead of these nonsense but at this age i'm not very keen on throwing out dozens of UIs and styles just because you're programmed to invalidate anyone else and argue with anything that comes before you. Don't get me wrong here, i was quite like you that when i was young, and tbh, not taking things for granted is a gift in this profession. As i honestly wrote before in some threads, i think you're very talented and your code style is immaculate. I still mean that.

That's only for the last paragraph of your replies, I won't reply to all above. I didn't like your implications about my might-come-in-future program, my true intentions (?) and i'm still confused on how a third party shell/gui can be obstuctive or offensive or to anybody, or even to your program which in fact would advertise and promote its use. I can understand you have strong feelings against other efforts trying to use your program as a helper tool, although i'm not sharing your concerns. You may know better.

My initial plan was for an open-source helper application with 6-8 main functions that i use almost every day myself, one of them would be farming using ASF. Now, I'm coding in free time and on casual terms which means "whenever i get bored of watching movies & tv shows" so there won't be any preliminary version soon. Maybe when i'll have something in hand, i'll send it over to give it a try.

Well, how about that? I think we can agree to one thing today! 👍

judgegr avatar Dec 04 '16 01:12 judgegr

ah sorry for this snippet, there's a thing i must answer is that i never suggested a way of changing or exposing the configuration which you claimed twice or thrice, when i've specifically wrote:

The use should be restricted to changing a small set of safe options like FarmingOrder, AcceptGifts, DismissInventoryNotifications, SendOnFarmingFinished, TradingPreferences, FarmOffline, IsBotAccount

Keywords here are: Small set, safe options. Also, on the same thing you wrote two contradictory phrases:

  1. ASF already includes auto-reload of configs modified on-the-fly, (..)

  2. Moreover, due to the way how complex ASF is, this command would be equal to bot restart in order to apply a change, as there are many properties you can't easily edit without a bot restart. (..)

I'm still confused here, which one of the above is valid? because it's either self-checking & automatic or not. The external ConfigGenerator can change settings safely and internal ASF could not, because? 🤔

judgegr avatar Dec 04 '16 01:12 judgegr

just because you're programmed to invalidate anyone else and argue with anything that comes before you.

That's entirely wrong, at least 80% of ASF features right now were suggested at some point by users, and I can also spot a few that were coded entirely by somebody else, without even asking me first if it can be considered useful (FarmingOrder or entire !loot are just two examples). It's true that I don't want to accept anything somebody could come up with, because it's not a "grant me a wish", but "improve ASF", and when talking about features and enhancements actual priority is usefulness and completness. I'm not making tradeoffs here of "do X for cost of Y because maybe somebody could eventually, with a bit of luck, find X useful". There is either "do X because I have strong arguments why we should do that for cost of Y", or nothing gets changed. If there are no disadvantages, I usually have nothing against, and that was the case with 99.9% of enhancements, even those I had absolutely no use of.

I'm still confused here, which one of the above is valid?

Both. I can't even understand how a need of bot restart contradicts ASF ability of auto-reload. Are you trying to point out anything you can come up with, or you mixed up something?

The external ConfigGenerator can change settings safely and internal ASF could not, because?

Because internal ASF first rule is, it does not, under any circumstance, edit initial .json files. You can set them as read-only, only for ASF user, and code must ensure that this scenario can work properly. Any RW data is contained in .db (and .bin) files. Initial configuration is never edited by program directly. Only user is able to edit it, with optional help from CG.

Keywords here are: Small set, safe options.

Small set of safe options, incomplete, prone-to-error solution, that nobody has any use of because you can already do the same with CG and config edit, in addition to that - make change permanent, as opposed to temporary one. Give me at least one strong reason why I should waste time implementing something inferior to already existing solution - because I can't find any.

i'm still confused on how a third party shell/gui can be obstuctive or offensive or to anybody, or even to your program which in fact would advertise and promote its use.

Those are your words, I never said anything like that. Moreover, I even actively promoted third-party solutions, especially those that are more powerful, e.g. CG over Notepad.

I did't see any GUI per se, or functions, only some code downloading the avatar and resizing the image, right?

Yep, because that gui is in very early alpha phase, but it has everything what ASF console edition already offers + extras. I wanted to finish backend before coding frontend, so right now it just waits here for hooking up to appropriate functions. I'm not that motivated to working on it though, neural networks in ArchiBoT are much more interesting.

In general, if you expect me to code a feature you want to see, you must convince me why I should do that. Usually just one single reason I can understand is enough, especially if something is rather easy to do, as I linked you above - even if I have absolutely no use of that thing. In your case however, I simply can't understand why I should waste my time doing something that is possible already, and in much better way. If I can't understand that, and you can't find any more arguments supporting your idea, then there is no reason for anybody to add it to ASF, especially because all 3 categories of users will find it useless - newbies will prefer CG over any command, intermediate will just launch notepad instead of memorizing command and syntax, while experts will simply sed the change.

JustArchi avatar Dec 04 '16 02:12 JustArchi

while experts will simply sed the change

That's exactly what i was thinking about, at first! But since ASF will not touch .json files, it's out of the question. See below.

Because internal ASF first rule is, it does not, under any circumstance, edit initial .json files. (...) Any RW data is contained in .db (and .bin) files. Initial configuration is never edited by program directly.

Well now i get it! You have your do's and dont's for your app and this is definitely a don't, that's fair. Probably because your app reacts to bot.json file as reading an input and not loading a configuration. My opposing argument was that every known desktop app has its config file config'ed by itself and not by an external (or 3rd party) app.

I couldn't possibly try to convince you otherwise because my suggestion breaks your fundamental rule, and i did mean a !config command to impose permanent changes to .json files. So this suggestion is out of the question, by design.

I could try to counter-suggest individual commands like !FarmingOrder, but THAT one would be a) messy design and b) temporary so not useful at all.

I'm not that motivated to working on it though, neural networks in ArchiBoT are much more interesting.

I would do that too, if i could. 👍

judgegr avatar Dec 04 '16 03:12 judgegr

It's nice to hear that you understood my reasoning, and not thought that I'm attacking you or trying to find arguments against at all cost 👍 . As a good ending, I'm happy to tell you that GUI ASF has planned config edition at some point (integrating current CG functionalities), so there definitely will be a way to do so in the future, and much easier too. At current point though, I don't want to bring that dependency to ASF itself, because ASF is simply supposed to work in programmed way, not do too much such as configuring itself. If you take a look at common UNIX pattern found in GNU/Linux, you'll notice that configuration part is done entirely outside of the daemon that is running, and noone offers ability to edit it's configuration files from itself.

Therefore, I'm closing this issue at the moment, as it's out of the scope of ASF, but I'll for sure add config edit option to ASF GUI, eventually (when I get enough motivation to work on it).

Thanks for your input and feedback regardless, I prefer much more people suggesting even potentially out of scope features, rather than complete silence 👍 .

JustArchi avatar Dec 04 '16 03:12 JustArchi