warfacebot icon indicating copy to clipboard operation
warfacebot copied to clipboard

Is it possible to implement autocommands in the future?

Open hyperplural opened this issue 5 years ago • 4 comments

For example, after successful authorization of the bot, commands that are written, for example, in the autocommands.cfg file will be executed. This was very helpful for people who constantly write the same commands after the bot logs on to the server.

Tell us about the pros and cons of this feature, if possible.

Thanks.

hyperplural avatar May 28 '20 19:05 hyperplural

I have it halfway implemented since 2018 or so. Problem I never released it because I believed I took the wrong approach.

The feature took the form of a list of files to be executed. -f file1.cfg -f file2.cfg would be configuration files while, let's say -p script1.cfg -p script2.cfg would be scripts to run after log on.

What I meant by "wrong approach" was that I wanted to move the whole command line out of the readline thread, so that I could factorise the code for such feature. I didn't and stopped half-way through. I didn't even remember if it actually worked. Just tested, seems to work but doesn't support comments. It basically transfers each line of the file as if it was one line in the command line. Exactly like the exec file.cfg command.

I may also add like you requested, a "default" file that, if present, would act as an autorun.cfg.

Levak avatar May 28 '20 21:05 Levak

I may also add like you requested, a "default" file that, if present, would act as an autorun.cfg.

It would be interesting to see this. Wait for update?

hyperplural avatar May 28 '20 23:05 hyperplural

@Levak, you can give an example of running this full command? Sorry, i didn't quite figure it out..

hyperplural avatar Jul 07 '20 17:07 hyperplural

@Levak, you can give an example of running this full command? Sorry, i didn't quite figure it out..

This feature is not yet in the public repository. I need to cleanup the code I already have from 2018, when I have free time, which is a valuable resource right now (I don't even have access to my PC right now).

Levak avatar Jul 07 '20 17:07 Levak