NightDev Community Forums

Do nightbot have bug or it should be like this?

Hi I’m new here. :slight_smile: I findout strange thing trying to create simple command thad nightbot get to many args. When you try to use command $(leagueoflegends) in $(eval) this is the code i create :

$(eval

let par1 = 'aezarkones';
let par2 = 'eune';
let p1 = '$(1)';
let p2 = '$(2)';

if (p1 != 'null')
	{par1 = p1}
if (p2 != 'null')
	{par2 = p2}

'Debug0: ' + par1 + ' ' + par2 + ' ' + p1 + ' ' + p2  +
' Rank dont work: $(leagueoflegends ' + par1 + ' ' + par2 + ')'
+ ' Rank work: $(leagueoflegends $(1) $(2))'

)
For now I must rewrite my code to work can you fix this or it’ll be like this?

BTW Update $(leagueoflegends) command on https://docs.nightbot.tv/variables/leagueoflegends where you show it have only 2 possible args when it have 3 possible args you only write this on forum not in docs on site :/.

Hey @aezarkones!

We all like beautiful code, but for Nightbot you have to keep it short as you’re limited in number of characters, so here’s your code rewritten to use with Nightbot, excluding the unimportant bits, and using ternary operators to assign values to your variables:

$(eval `$(1)`==`null`?a=`aezarkones`:a=`$(1)`; `$(2)`==`null`?b=`eune`:b=`$(2)`; `$(leagueoflegends ${a} ${b})`)

That said, as you seem to have figured out, the ranks don’t work, so this command will give you an error, and it seems to be a new issue, the API Nightbot gets its data from might have been updated, in which case you’ll have to wait for Nightbot to be updated as well, updates will likely be posted there.

Thank you for help, last time I coded was 10 years ago this why my code can be overdated. Thank you for your simple code it look realy clear and nice but dont work for me. :confused: Here you go whith working one i think your code’ll work after NB update:

$(eval ‘$(3)’==‘null’? ‘$(2)’==‘null’? ‘$(1)’==‘null’?’$(leagueoflegends aezarkones eune)’:’$(leagueoflegends $(1) eune)’:’$(leagueoflegends $(1) $(2))’:’$(leagueoflegends $(1) $(2) $(3))’)

1 Like