CactusDev / CactusBot

An open source, community-written service-agnostic chat bot
MIT License
30 stars 6 forks source link

Variables as variable defaults don't work #283

Open Alkali-Metal opened 7 years ago

Alkali-Metal commented 7 years ago

What is the issue?

When you put a variable as the default for another variable, it doesn't work, it returns the variable as it is.

How do we reproduce this issue?

image Do that.

Environment

Remote hosted CactusBot 0.4

Other Information

I feel as though it should work because it would make default arguments much coolio-er. :smile:

Also: default arguments for %ARGS% doesn't work, it returns Not enough arguments

2Cubed commented 7 years ago

Hmm... this wasn't really considered. Could look into it, just making sure that recursion isn't an issue. :+1:

Alkali-Metal commented 7 years ago

Yeah, that would be a mild issue. XD

Innectic commented 7 years ago

Fixed this in #295

2Cubed commented 7 years ago

Silly @Innectic. ;P

Innectic commented 7 years ago

Can confirm, am noob.

Alkali-Metal commented 7 years ago

You Innectato!

Alkali-Metal commented 7 years ago

So, I was thinking about this, and I would that only having one layer-o'-recursion would be fine, anything beyond that would just be pointless and redundant in my opinion.

One layer:   %ARGS=%NAME%%           #Would work
Two layers:  %ARGS=%ARG1=%NAME%%%    #Wouldn't work

If that makes any sense.

And it should check to see if they are the same so that it can't do something like %ARGS=%ARGS%%

2Cubed commented 7 years ago

I would agree; having more than one layer doesn't really make sense.

The more I think about it, the more I think recursion might not be an issue... for example, with the response %ARG1=%ARG2%% %ARG2=%ARG1%%: