So I have this code thanks to @Emily it works perfectly but my only problem is when someone gifts 1 sub it spams “arihxxSubHype” instead of “arihxxGift”
I was thinking of adding > q.includes ( Offered by’)` but I can’t get it to work I’m using 2 bots by the way
the code you have listed already shows the q.includes ( Offered by’)` part, so i’m not sure what the addition is you are trying to make would change. or is the code you have listed an example of what you currently have that is not working and the image an example of what you want to show on-screen? i guess i’m confused to what you are looking for here. could you clarify your request or explain the issue a bit differently? also, how does the other bot relate to this question?
It’d be nice to link the original post you got the code from since it can help going faster, I answer so many people it takes a while and wastes my time if I look for it.
$(eval q=`$(query)`.toLowerCase();h=`arihxxSubhype `;g=` arihxxGift`;q.includes(`new sub`)||q.includes(`renews`)||q.includes(`re-sub`)?`${h.repeat(10)}`:q.includes(`just offered`)?`Thank you $(1) for the $(5) gifted subs!${g.repeat(10)}`:` `;)
I’m unsure why your code doesn’t work, it could be that it exceeds the 250 characters limit from YouTube, so I rewrote the command, since it still exceeds the character limit if you include !addcom ... or !editcom ... add/edit the command from the dashboard, it should work fine.
@schwoby the other bot is the one triggering Nightbot.
Ah, I understand now, alright, this should work then:
$(eval q=`$(query)`.toLowerCase();h=`arihxxSubhype `;g=` arihxxGift`;l=q.split(` `);l=l.pop();l=l.slice(0,l.length-1);q.includes(`new sub`)||q.includes(`renews`)||q.includes(`re-sub`)?`${h.repeat(25)}`:q.includes(`offered by`)?`Thank you ${l} for the gifted sub!${g.repeat(15)}`:q.includes(`just offered`)?`Thank you $(1) for the $(5) gifted subs!${g.repeat(15)}`:` `;)
Hmm, I thought the last test evaluating to true would take over, but looks like it’s not working that way with ternary operators, simply switch the test for “offered by” before every other tests:
$(eval q=`$(query)`.toLowerCase();h=`arihxxSubhype `;g=` arihxxGift`;l=q.split(` `);l=l.pop();l=l.slice(0,l.length-1);q.includes(`offered by`)?`Thank you ${l} for the gifted sub!${g.repeat(15)}`:q.includes(`just offered`)?`Thank you $(1) for the $(5) gifted subs!${g.repeat(15)}`:q.includes(`new sub`)||q.includes(`renews`)||q.includes(`re-sub`)?`${h.repeat(25)}`:` `;)
Oh, I get it, it’s because you changed the text coming out of the other bot, didn’t you?
There wasn’t a space after the username of the person who gifted the sub, according to your previous screenshots, so I built the command from that.
So either you remove the space, or use the following command:
$(eval q=`$(query)`.toLowerCase();h=`arihxxSubhype `;g=` arihxxGift`;l=q.split(` `);l.pop();l=l.pop();q.includes(`offered by`)?`Thank you ${l} for the gifted sub!${g.repeat(15)}`:q.includes(`just offered`)?`Thank you $(1) for the $(5) gifted subs!${g.repeat(15)}`:q.includes(`new sub`)||q.includes(`renews`)||q.includes(`re-sub`)?`${h.repeat(25)}`:` `;)
$(eval q=`$(query)`.toLowerCase();h=`demisxSUBHYPE `;g=` demisxGift`;l=q.split(` `);l=l.pop();l=l.slice(0,l.length-1);q.includes(`renews`)?`${h.repeat(25)}`:q.includes(`offered by`)?`Thank you ${l} for the gifted sub!${g.repeat(15)}`:q.includes(`just offered`)?`Thank you $(1) for the $(5) gifted subs!${g.repeat(15)}`:q.includes(`new sub`)||q.includes(`re-sub`)?`${h.repeat(25)}`:` `;)