From 4530e33fcf24a3d29966a04433e935e3fd0477ee Mon Sep 17 00:00:00 2001 From: nathnat <51968204+nathnat@users.noreply.github.com> Date: Sun, 14 Mar 2021 10:23:27 +0100 Subject: [PATCH 1/2] Create support for discordPHP Hello world! I tried your embed visualizer and I really liked it! Then, I tried to export my embed to PHP but only saw RestCord and I use discordPHP :( So I decided to code `discordphp.js` to support the new library discordPHP. Sorry for my bad english. Hope you push it! --- src/snippets/discordphp.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/snippets/discordphp.js diff --git a/src/snippets/discordphp.js b/src/snippets/discordphp.js new file mode 100644 index 0000000..d54d069 --- /dev/null +++ b/src/snippets/discordphp.js @@ -0,0 +1,20 @@ +export default { + name: 'DiscordPHP (PHP)', + language: 'php', + generateFrom(data) { + let embed = null; + if (data.embed) { + embed = JSON.stringify(data.embed, null, 4) + .replace(/{/g, '[') + .replace(/}/g, ']') + .replace(/^ {4}/gm, ' ') + .replace(/^]/gm, ' ]') + .replace(/":/g, '" =>') + } + + return `channel->sendMessage('${data.content}', false, ${embed});`; + + } +}; From 4ee5185b236133f767aa347fd0b9d0f15e2857e3 Mon Sep 17 00:00:00 2001 From: nathnat <51968204+nathnat@users.noreply.github.com> Date: Thu, 18 Mar 2021 20:59:16 +0100 Subject: [PATCH 2/2] Add the codemodal I add the import to the `codemodal.jsx` file. --- src/components/codemodal.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/codemodal.jsx b/src/components/codemodal.jsx index 869806c..bba716e 100644 --- a/src/components/codemodal.jsx +++ b/src/components/codemodal.jsx @@ -14,6 +14,7 @@ import restcord from '../snippets/restcord'; import eris from '../snippets/eris'; import discordrb from '../snippets/discordrb'; import jda from '../snippets/jda'; +import discordphp from '../snippets/discordphp'; const libraries = { @@ -29,6 +30,7 @@ const libraries = { 'ruby_discordrb': discordrb, 'java_discord4j': discord4j, 'java_jda': jda, + 'php_discordphp': discordphp, }; // TODO: check for localStorage availability?