Custom gif with standard alerts

PhantomBot Version: 3.0.0 fcc08b51
OS Version:Windows 10 pro 64
Java Version: 1.8.0_221-b11
Browser and Version (for Panel Support): Opera 62.0.3331.88
Stock PhantomBot: Yes

Let us know what help you need:

I would like to be able to attach a gif and mp3 to an alert directly, such as a gif/mp3 for a follow or host. I see there is Alert with follower post, but that is over a year old and I don’t quite understand it, I attempted to copy/past it and the hosthandler failed. It would be nice if I could get a simplified answer so that I could attempt to do this in other places, such as follow/raid/host/sub/bits and so forth. Thank you in advance!

Hi,
you need to add this part to the followHandler.js file:

if (s.match(/\(alert [,.\w\W]+\)/g)) {
	var filename = s.match(/\(alert ([,.\w\W]+)\)/)[1];
	$.panelsocketserver.alertImage(filename);
	s = (s + '').replace(/\(alert [,.\w\W]+\)/, '');
}

This will search for (alert xyz) in the follower message. If present, it will trigger the command and delete the part from the message.
You can place a gif and a audio file with the same name in the gif-alert folder, then it will trigger both at the same time. (all you need to know about gif alerts is described here: https://community.phantom.bot/t/how-to-setup-gif-alerts/77

So if you want to edit the followerHandler.js file, search for the following part:

if (s.match(/\(reward\)/)) {
	s = $.replace(s, '(reward)', $.getPointsString(followReward));
}

if (s.match(/^\/w/)) {
	s = s.replace('/w', ' /w');
}

and replace it with this:

if (s.match(/\(reward\)/)) {
	s = $.replace(s, '(reward)', $.getPointsString(followReward));
}

if (s.match(/\(alert [,.\w\W]+\)/g)) {
	var filename = s.match(/\(alert ([,.\w\W]+)\)/)[1];
	$.panelsocketserver.alertImage(filename);
	s = (s + '').replace(/\(alert [,.\w\W]+\)/, '');
}

if (s.match(/^\/w/)) {
	s = s.replace('/w', ' /w');
}

I did not test it, but it should work.

Would I replace filename with the actual filename of the alert? Such as the alert would be “follow_alert” would it be like this:

if (s.match(/(alert [,.\w\W]+)/g)) {
var follow_alert = s.match(/(alert ([,.\w\W]+))/)[1];
$.panelsocketserver.alertImage(follow_aler);
s = (s + ‘’).replace(/(alert [,.\w\W]+)/, ‘’);
}

Or would I just leave all alone and just copy paste?

Also, would I be able to copy paste this into say the hosthandler, or raidhandler?
Thanks for the help so far.

The name of the variable is not important, you can leave it as it is. Copy&Paste into the other handlers is not necessarily possible because some variable names could be different. I’ve added it for you to the handler files and uploaded them here.
If you use this files, you only have to add (alert gifname.gif,5,0.5) to the message of your alert, for example:
(name) has followed. (alert gifname.gif,5,0.5)
5 = duration in seconds
0.5 = volume of the sound, if you add a mp3 with the same name like the gif.

bitsHandler.js (5,2 KB) followHandler.js (8,6 KB) hostHandler.js (14,7 KB) raidHandler.js (14,7 KB) subscribeHandler.js (29,7 KB)

Everything works great! Thank you, only now the bat file loads those .js in a different language than english, will this cause an issue, if so/not, how do I fix this?

Never mind, I found where to change that specific part in the script while editing it, thank you for all your help!

Now I just need to figure out why the .mp3 is restarting in the middle of the alert.