Closed livie-chan closed 4 years ago
Hey, the cpanminus executable is "cpanm" - try that instead.
A new release is definitely coming. The script is in a pretty good place right now if you can run it from source. I have a couple things to tackle first (including updating the readme), but it's coming.
Thanks for your patience.
Thanks, cpanm seems to work, should have installed the dependencies now! Also put the Mojo folders from the other two in the lib folder. How do I run the thing now? I tried to run the discordnp.pl file (both directly and via cmd), but it just closes instantly and the Discord status doesn't update either.
Did you create and fill out a config.ini file?
You can rename config.ini.example to config.ini and then edit it in any text editor.
You need a last.fm api key from http://www.last.fm/api/account/create
You need your discord user token (see https://youtu.be/tI1lzqzLQCs)
You'll also need to enter your last.fm username, and a folder the bot can write logs to (eg, C:\Users\YourNameHere)
Save the file and run discordnp.pl again from the command line like this:
perl discordnp.pl
Yeah, I did that stuff with the tokens already, got it running with the old executable too. When running the command with "perl discordnp.pl" it says: "Can't locate Discord/NP.pm in @INC (you may need to install the Discord::NP module) (@INC contains: C:/Strawberry/perl/site/lib/MSWin32-x86-multi-thread-64int C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) at discordnp.pl line 8. BEGIN failed--compilation aborted at discordnp.pl line 8." Sorry for being such a noob at this, haha.
Huh. Looks like Strawberry isn't looking in the working directory.
Try this:
Copy the Discord folder (which contains NP.pm) into your lib folder (C:/Strawberry/perl/site/lib) like you did for Mojo::Discord.
Then run it again.
Sadly doesn't work either. With both the Discord and Mojo folders inside C:\Strawberry\perl\site\lib it now says: "Can't locate strictures.pm in @INC (you may need to install the strictures module) (@INC contains: C:/Strawberry/perl/site/lib/MSWin32-x86-multi-thread-64int C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) at C:/Strawberry/perl/site/lib/Discord/NP.pm line 5. BEGIN failed--compilation aborted at C:/Strawberry/perl/site/lib/Discord/NP.pm line 5. Compilation failed in require at discordnp.pl line 8. BEGIN failed--compilation aborted at discordnp.pl line 8."
Oh! That's an easy one.
cpanm strictures
I'll add that to the dependency file as well. Thanks for catching that!
Alright! After adding strictures it showed the same message for a few others as well (Mojo::AsyncAwait, Import::Into module, Time::Duration and Role::EventEmitter), so I went ahead and downloaded them the same way. Now when I run it again it says: "Can't open file "/path/to/log/discord-np/mojo-discord.log": No such file or directory at C:/Strawberry/perl/vendor/lib/Mojo/Log.pm line 17."
Oh man, my cpanfile (dependency list) is way out of date. I'll fix that tonight.
So the last one is in config.ini you just need to change where it says "/path/to/log/discord-np" to a folder on your computer where it can logs to. For example: C:\Users\YourNameHere
Or you could make a folder in C:\discord-np and set the logdir to C:\discord-np
I'm going to add an option to just outright disable logging and make that the default, but for now you need to give it a valid place to write logs.
Thanks for your patience!
Hooray, It's working now, thanks! I still needed to install one more dependence after that, which is Mojo::UserAgent::Role::Queued, so you might want to add that one to the list as well. Another thing, but this is just a minor thing and personal preference, I really liked how it displayed both the artist and song in the status in the older version instead of just the artist now, any chance that maybe will become configurable in a later version? In any case, thanks a lot for your work on this project!
So a lot of those other deps you found are actually dependencies of the Mojo::Discord library. If you go into that folder and run "cpanm --installdeps ." you'll get all of that stuff.
I'm working on getting Mojo::Discord and Mojo::WebService::LastFM into CPAN, so in the future you'll just get them automatically like the rest. For now I realize it's a bit of a pain in the butt - sorry.
Glad you got it working though!
I'll put in an option to show the track title as well. I turned it off because 90% of the time it just gets cut off anyway
Clicking on your name will reveal more info:
Ah, I see! No worries, most important thing is that it's working now. Learned some new stuff here as well, so that's a good thing, haha. Great to hear! I realize it gets cut off most of the time, but I liked that you can see the full title when hovering over it instead of having to click. Most people probably won't bother clicking on it, haha. And unless I'm missing something you can't click on the name in the direct messages, only on servers.
2b78406bfd4de21c7e5f8e50df0b87c4065907d7 adds the option to show artist, title, both, or neither in the sidebar. It comes with an updated config.ini.example file you can use.
Basically just set show_artist = yes
and show_title = yes
in the [lastfm] section of your config.ini and it should do what you want.
Awesome, works like a charm. Thanks for the super quick update, really great work! Was wondering for a few minutes why the "Artist - Title" didn't show, but then remembered I had to replace the NP.pm file in C:/Strawberry/perl/site/lib/Discord too, haha.
Have been trying for hours to get this working with Strawberry Perl, but it keeps saying that cpanminus doesn't exist. I have never used Perl before, so I'm a real noob here. Would it be possible for you to create an updated executable? The latest release seems to be almost two years old and still has that annoying problem where the status disappears after two minutes. Thanks!