Latest Raider information


#1

PhantomBot Version: 2.4.2 (Revision: 5c75a7b2)
Operating System:** Windows 10
Java Version: 1.8.0_171-b11
Browser and Version: Firefox 63.0.3
Stock PhantomBot: Yes
Beta Panel: Yes

Is there a way so export the latest raider to a text file? Not a host but a raider?
Or is there a variable available with that information?

Thank you for your time.


#2

You can write a custom script, that listens to the raidHandler. There you can write the name into a txt file


#3

Alright. That is a way. Only if i knew how i could do that :wink: . I need to look into that.
Thank you!


#4

just add

$.writeToFile(username + ' ', './addons/raidHandler/latestRaider.txt', false);
above
saveRaidFromUsername(username + '', viewers + '');

in the ./handlers/raidHandler.js script


#5

Thank you! I will test it out @Dakoda


#6

It didn’t update the file. Missed a space in “+ ’ ',” dunno if that should matter.


#7

Tested it again and it doesn’t write the file away. Did what you said @Dakoda


#8

make sure you make the folder? ill test it later myself


#9

Yes i did.



#10

If it writes the data eventually then it is the operating system. If it never writes, then something else is going on.

We use flush() to request the OS to dump data to a file but we leave the file handle open. We do this to increase performance for all of the different files that are written out by the bot over the course of a long period of time – it is faster to leave file handles open and request flush operations than it is to open a file, write to a file, close a file. This is pretty standard for an application for performance reasons.

From the flush() documentation from Java:

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

Technical aspects aside, I wrote a raidtest command for the Console for myself and put in the code recommended.

        // Add reward.
        if (raidReward > 0) {
            $.inidb.incr('points', username, raidReward);
        }

        $.writeToFile(username + '', './addons/raidHandler/latestRaider.txt', false);

        // Save the raid to the database.
        saveRaidFromUsername(username + '', viewers + '');

It does appear to work.


#11

Nope the file is never been writed too. I made the file manually for testing purposes.

I want to have this file updated when someone just raided me so that i can do !raided (own command) so that i can give the person an shout out when no mod is available.

Is there a way i can test it out without actually someone raiding me?


#12

raidtest console command was implemented two days ago, so you need the latest nightly build to use it.

BTW, if someone is hosting or raiding you with 0 viewers, Twitch may not pass this event through the API. I don’t know how much this has to do with your issue, I’m just saying.


#13

Will test the nightly out. I got raided a couple of times with 5+ viewers so it should be okay on that end.


#14

The raidtest command works with the nightly build!

Is there a way to test it with not a nightly build?


#15

No there is not a way to test without the Nightly that fires the event that is fired when a message comes from Twitch.


#16

Well this works for now! So i am happy! Thank you for the support guys! Would have been easier if Streamlabs or StreamElements saved that in a text file but alas it was not meant to be :smiley:


closed #17

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