So I have this code thanks to @Polar Cat 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
Here’s an example
15 replies
Fleet Ram
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?
Polar Cat
Hey @Dusky Sloth!
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.
@Fleet Ram the other bot is the one triggering Nightbot.
Dusky Sloth
Polar Cat said: $(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)}:;)
Sorry Emily for making double post I’m using twitch not youtube
Polar Cat
OMG I'm not sure how I confused Twitch with YouTube...
My code should still work though, have you given it a try?
Dusky Sloth
Polar Cat said: $(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)}:;)
Yes I used your code but it still shows the same thing is there a way to add (🎁 offered by demidudes) in this part of the code:
:q.includes(just offered)?Thank you $(1) for the $(5) gifted subs!${g.repeat(10)}:;)`
So that if someone gifts 1 sub nightbot will show the “arihxxGift” emote instead of the subhype emote
As u can see in the image above the user demidudes offered 1 gifted sub to yslbrody so nightbot suppose show the gift emote not the subhype emote
Polar Cat
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)}`:` `;)
Dusky Sloth
Polar Cat said: $(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)}:;)
Thank you Emily for helping me , I tested your code and I’m still getting the same problem it still shows the subhype emote instead of the gift emote
Polar Cat
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)}`:` `;)
Dusky Sloth
Thank You! Emily! so much I appreciate you taking time out of your day to help me
quick question is it possible to thank the $(user) who offered the 1 gifted sub just like in this part of the code:
q.includes(just offered)?Thank you $(1) for the $(5) gifted subs!${g.repeat(15)}`
Polar Cat
I already set it up this way?
`Thank you ${l} for the gifted sub!${g.repeat(15)}`
Dusky Sloth
This is what it shows is it possible for it to say Thank You $(user) for the gifted sub?
Polar Cat
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)}`:` `;)
Dusky Sloth
Polar Cat said: $(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)}:;)
THANK YOU EMILY 🙂
Dusky Sloth
@Polar Cat having a little problem when someone renews there sub instead of showing the subhype emote it shows the gift emote
Polar Cat
This should fix the issue:
$(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)}`:` `;)
I simply put the test for renews first.
Didn't find your answer? The community is on Discord.