Reputation: 23
this morning I saw that my discord music bot gave errors when executing the command "nowplaying", that should show the song that is currently playing. (ps: I never changed anything in that command file).
Here is the error:
TypeError: createBar is not a function
at Object.execute (/home/runner/Nightcorer-New/Music/nowplaying.js:60:47)
And the code where the error should be:
//If its not a stream
if (ms > 0 && ms < 10000) {
nowPlaying.addField("\u200b", "**``[" + createBar((ms == 0 ? seek : ms), seek, 25, "▬", "🔘")[0] + "]``**\n**" + "\n[" + new Date(seek * 1000).toISOString().substr(11, 8) + " / " + (ms == 0 ? " ◉ LIVE" : new Date(ms * 1000).toISOString().substr(11, 8)) + "]**" + "\n" + "\n **Time Remaining:**" + "``" + new Date(left * 1000).toISOString().substr(11, 8) + "``", false);
Upvotes: 1
Views: 138
Reputation: 9310
As assumed in the comments, the package string-progressbar doesn't export one function anymore since v1.0.3. Since v1.0.4 there are an object with two functions exported:
<script type="module">
import stringProgressbar from 'https://cdn.skypack.dev/string-progressbar';
console.log(stringProgressbar.filledBar(20, 10));
console.log(stringProgressbar.splitBar(20, 10));
</script>
So in order to fix your problem...
...update createBar(...)
to createBar.filledBar(...)
or createBar.splitBar(...)
...reinstall v1.0.3 if you want to stick to your old code.
Upvotes: 1