-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Welcome to the bcfd/bdfd-clone wiki!
This wiki will give you documentation of how to add any clone of this project to integrate import system for your codeshare website.
First of all obviously you should know basics of html and js.
Adding Process - (IDK PHP OR ANY OTHER WEBSITE DEVELOPMENT LANGUAGE SO IM GONNA GIVE EXAMPLES OF HTML) So It works with POST Method and you just have to use POST method to share command name, command description and command code.
The Endpoint that you have to POST this variables is - https://yourwebsite.com/import
replace yourwebsite.com with the website of the clone of this project.
An Example made in html and js -
<script>
function example(name, description, code) {
const form = document.createElement('form');
form.method = 'POST';
form.action = `https://yourwebsite.com/import/`;
const params = {
code: `${code}`,
description: `${description}`,
name: `${name}`
}
for (const key in params ) {
if (params.hasOwnProperty(key)) {
var hiddenField = document.createElement(`input`);
hiddenField.type = 'hidden';
hiddenField.name = key;
hiddenField.value = params[key];
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
}
</script>
In this Example you have to give command name, description and code while calling the function to post the variables/details of command.
Also Change yourwebsite.com
to the website domain which you want to integrate in your codeshare website.
It works fully with POST method so if the person isn't logged in to the website than after logging in he have to go to the codeshare website again and import it. I will try to bring a solution of it.
The Variables/Details of Command are used after your select the bot, it uses the select bot page so the user can select that in which bot he wants to import the command and the variables is stored in the select bot page and is shared to the page where it creates the command.
For More Information You can see it in the code of the project, Files are - dashboard/server.js line no : 561 - 622 and Whole dashboard/views/cbots.ejs File.