Closed vincentdchn closed 3 years ago
Are you already using PMSF (https://github.com/pmsf/PMSF)? If not, then don't worry about the donate.php. That's just an example button to process a basic PayPal order while passing the Discord user ID and unix timestamp as the invoice ID. The bot doesn't rely on the php so I don't explain it much because it's out of scope for this project. You just need to point the PayPal webhooks to the bot if you are using something else to process orders.
If you want to test the sandbox webhooks, you will have to set the URLs in the .js to api.paypal.com
.
I can still try to answer other questions you have but if you aren't using PMSF, then donate.php is kind of moot to talk about.
Oh ok I see.
The main thing is that I would use your bot (and also translate it in French) for having (in a automatic way) roles in a Discord server if you have donated on PayPal.
So I think I'll need the donate.php ?
I managed to install and run PMSF but when I look at the donation.pho page on a browser I have a blank page.
Ideas ?
Thanks !
If you have a site already, you won't need PMSF. PMSF is a lot of waste if you aren't using it for Pokemon. I'm not sure what your skills are but you just need a page that people can log into with Discord auth so it can pass the user ID to the PayPal order page.
If your skill can't handle that then you can try to start with PMSF but this isn't the place to get help on getting that to run correctly. You would have to ask on their Discord. If the main PMSF page doesn't show, make sure you ran npm install && npm run build
. I know that the donate.php page will display a non-white page if you made it as a webpage without PMSF so something is wrong with your setup, either the NGINX config, the npm build, or the config.
Ok. Thanks for all the infos.
I don't use Pokemon so I imagine I won't need PMSF.
My skills are "beginner" to "ok". How can I do to give user ID to PayPal Order page and then to the bot ?
I'm afraid I misunderstand the purpose of your bot. Does it check for a PayPal order and then give a role to a user for a certain amount of time and warn the user 5 days before the role will be removed and then remove the role automatically?
You didn't misunderstand the purpose of the bot, that's what it does. The donate.php is not part of the bot, it's just extra information to be used as an example. The bot will never know that donate.php exists because it only cares about the webhooks that PayPal will send from its servers.
The info that PMSF and donate.php pass to the bot are mostly from this container
section of the php https://github.com/Kneckter/DiscordRoleBot/blob/master/donate.php#L219. It gets the Discord user ID from the PMSF session and creates a PayPal order. It might be too much for a beginner/ok skill range but you can see an example basic Discord auth page here https://github.com/discord/discord-oauth2-example. You could strip out a lot of the stuff in donate.php if you use that instead of PMSF, just basically keeping the container.
If you're not up for that, continue with PMSF and get that working. It shouldn't be a blank page when you load the main page. You can even link people to the donate.php page without saying there are other pages. I use the NGINX rewrite to point to https://example.com/donate, rewrite ^/donate$ /donate.php?$1 last;
. Put it where the other rewrites are in the PMSF settings in the NGINX config file.
You didn't misunderstand the purpose of the bot, that's what it does. The donate.php is not part of the bot, it's just extra information to be used as an example. The bot will never know that donate.php exists because it only cares about the webhooks that PayPal will send from its servers.
Ok so it's cool then !
The info that PMSF and donate.php pass to the bot are mostly from this container section of the php https://github.com/Kneckter/DiscordRoleBot/blob/master/donate.php#L219. It gets the Discord user ID from the PMSF session and creates a PayPal order. It might be too much for a beginner/ok skill range but you can see an example basic Discord auth page here https://github.com/discord/discord-oauth2-example. You could strip out a lot of the stuff in donate.php if you use that instead of PMSF, just basically keeping the container.
So if I understand, I just have to create a .php page that you need to login with the Discord oAuth2 with your Paypal container it ?
If you're not up for that, continue with PMSF and get that working. It shouldn't be a blank page when you load the main page. You can even link people to the donate.php page without saying there are other pages. I use the NGINX rewrite to point to https://example.com/donate, rewrite ^/donate$ /donate.php?$1 last;. Put it where the other rewrites are in the PMSF settings in the NGINX config file.
I don't see where the problem is. I set up correctly the donate_config.php
and didn't touch anything of the PMSF settings. I feel that I'm missing something ...
So if I understand, I just have to create a .php page that you need to login with the Discord oAuth2 with your Paypal container it ?
It would realistically be 2 php pages. One for the login/callback and the other for the donation container. You'd pass the user ID from the login page to the donation page.
I don't see where the problem is. I set up correctly the
donate_config.php
and didn't touch anything of the PMSF settings. I feel that I'm missing something ...
If you didn't touch anything in the PMSF settings then it most likely isn't setup correctly. I know there are ones for Discord auth that will be needed. PMSF won't know that dontain.php is there because it is just an extra page so so they should display a non-blank page without each other. Without PMSF, you should be able to go to /donate and see a badly formatted page because it wouldn't have the CSS PMSF. You can also use Console view in the browser to see if any errors come up, push F12. If you are setting a completely blank page still, maybe your NGINX settings are not correct. Getting these working isn't something that applies to setting up this bot though.
Hi,
Thanks for making this bot, it's gonna be really helpful for one of my projects.
I'm a bit confused about how I can manage to host the
donate.php
with PMSF. Do you have more explanation about your process ?Thanks !