Readfile is always undefined


#1

PhantomBot Version: stable
OS Version: Windows 7
Java Version: latest 64bit
Browser and Version (for Panel Support): Chrome latest
Stock PhantomBot: Yes

Let us know what help you need:
I’m trying to add a command to read the .txt generated by the AIMP Plugin ‘Current Track Info Into File’. This plugin generates a text-file with information about the music I’m playing in AIMP.
I added the following command: !addcom !song (readfile ./addons/CurrentTrackInfo.txt)
Sadly this doesn’t work, the response is always “undefined”, even when there’s something in the text-file.


#2

Hey,

By default the bot will only read in the addons folder, adding ./addons again will force the bot to read in ./addons/./addons, which doesn’t exist. Try removing that part and only leaving your file name.


#3

I got that from the readme https://community.phantombot.tv/t/command-variables/53
../addons/CurrentTrackInfo.txt worked fine, so I guess all I needed was the actual filename?


#4

I will update that guide, sorry for the confusion. Only the file name is needed since the bot will automatically read in the addons folder.


#5

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