Eval character limit

So I’ve run into an issue with character limit. I’m a moderator on a channel who wanted to have one command that gave different responses depending on who used it and how they used it, so i came up with this little code and i can’t add it to the command list because its more than 500 characters. Can this limit be i bit higher. it’s nothing fancy or anything.

!commands edit !kram -ul=everyone -cd=5 $(eval 
function userFunc() {
	var channel = "NattieDK";
	var queryUser = '$(query)';
	var userExe = '$(user)';
	if (queryUser == "") {
		if(userExe == channel) {
			return "NattieDK krammer alle i chatten <3 <3 <3";
		} else {
			return userExe + " krammer " + channel + " <3 <3 <3";
		};
	} else {
		if (queryUser.toLowerCase() == "alle" || queryUser.toLowerCase() == "chat") {
			return userExe + "krammer alle i chatten <3<3<3";
		} else if (queryUser.toLowerCase() == userExe.toLowerCase()) {
			return "rip !" + userExe + " prøver at krammer sig selv, men brækker begge arme i forsøget LUL WutFace"
		} else {
			return userExe + " krammer " + queryUser + " <3 <3 <3";
		};
	};
};
userFunc();
)
!commands edit !kram -ul=everyone -cd=5 $(eval 
function F(c, u, q){
	if(q == ""){
		if(u == c){
			return "NattieDK krammer alle <3";
		}else{
			return u + " krammer " + c + " <3";
		};
	}else{
		if(q.toLowerCase() == "alle" || q == "chat"){
			return u + " krammer alle i chatten <3";
		}else if(q.toLowerCase() == u.toLowerCase()){
			return "rip ! " + u + " prøver at krammer sig selv, men brækker begge arme i forsøget LUL WutFace";
		}else{
			return u + " krammer " + "@" + q + " <3";
		};
	};
};
F("NattieDK",'$(user)','$(query)');
)

Got it to work after massive optimization, tho i don’t understand if i do it without running it in a function i keep getting the “Right-hand side of ‘instanceof’ is not an object”.

This code gives me the error and i don’t understand why:

!commands edit !kram -ul=everyone -cd=5 $(eval 
var c = "NattieDK",u = '$(user)',q = '$(query)';
if(q == ""){
	if(u == c){
		return "NattieDK krammer alle <3";
	}else{
		return u + " krammer " + c + " <3";
	};
}else{
	if(q.toLowerCase() == "alle" || q == "chat"){
		return u + " krammer alle i chatten <3";
	}else if(q.toLowerCase() == u.toLowerCase()){
		return "rip ! " + u + " prøver at krammer sig selv, men brækker begge arme i forsøget LUL WutFace";
	}else{
		return u + " krammer " + "@" + q + " <3";
	};
};
)

We are talking 491 vs 482 characters and out of 500 it’s quite a bit i can use on text. 18 instead of 9 character i have left.

alright i forgot to remove return after removing the function… rookie mistake… and i’m a rookie so i’m excused xD

But back to the original issue, why is it only 500 characters long?

The character limit exists because it is the maximum message length Twitch supports. We might explore other ways to input custom code in the future.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.