所以我使用Discord.JS创建Discord Bot,并且我有一个命令
if(command === "addme") {
//code here
return message.reply(`Added ${message.author} to Database!`);
};
如何让它从一个向JSON文件添加键和属性的文件中调用PHP函数?
我不知道从哪里开始。我尝试过人们在这个网站上发布的其他问题的解决方案,但我找不到任何解决我问题的方法。
如果你能帮忙,谢谢!
这取决于您想在哪里调用php function
,
从表面上看,如果我没有错的话。。。似乎您不想与DiscordJS
的API交互,而是与custom PHP function
交互?
-
客户端
- 是在浏览器上,iOS还是Android?-根据您所处环境的选择,有几种不同的方法
-
服务器端
- 我假设您使用JS作为后端,您可以使用类似
HTTP client
的请求
- 我假设您使用JS作为后端,您可以使用类似
等简单线路
var request = require('request');
request('https://saficloud.com', function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the SafiCloud homepage.
});
就在你需要开始的地方,
干杯:(