├── .gitignore ├── public ├── favicon.ico └── index.html ├── src ├── images │ └── logo.png ├── color.js ├── snippets │ ├── discordio.js │ ├── eris.js │ ├── discordie.js │ ├── discordjs.js │ ├── restcord.js │ ├── discordnet.js │ ├── jda.js │ ├── dsharpplus.js │ ├── discordpy.js │ ├── discordrb.js │ ├── discord4j.js │ └── dsharpplus-embedbuilder.js ├── index.js ├── components │ ├── button.jsx │ ├── warningmodal.jsx │ ├── modal.jsx │ ├── modalcontainer.jsx │ ├── codemirror.jsx │ ├── codemodal.jsx │ ├── embed.jsx │ ├── discordview.jsx │ ├── aboutmodal.jsx │ ├── app.jsx │ └── markdown.jsx ├── constants │ └── embedschema.js ├── css │ ├── codemirror-one-dark.css │ ├── index.css │ └── discord.css └── validation.js ├── package.json ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mee6/embed-visualizer/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mee6/embed-visualizer/HEAD/src/images/logo.png -------------------------------------------------------------------------------- /src/color.js: -------------------------------------------------------------------------------- 1 | function extractRGB(i) { 2 | return { 3 | r: (i >> 16) & 0xFF, 4 | g: (i >> 8) & 0xFF, 5 | b: i & 0xFF, 6 | }; 7 | } 8 | 9 | function combineRGB(r, g, b) { 10 | return (r << 16) | (g << 8) | b; 11 | } 12 | 13 | export { extractRGB, combineRGB }; -------------------------------------------------------------------------------- /src/snippets/discordio.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'discord.io (JavaScript)', 3 | language: 'javascript', 4 | generateFrom(data) { 5 | const d = { to: '...', message: data.content, embed: data.embed }; 6 | return `var data = ${JSON.stringify(d, null, ' ')};\nclient.sendMessage(data);`; 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './components/app'; 4 | 5 | import './css/index.css'; 6 | import './css/discord.css'; 7 | import 'highlight.js/styles/solarized-dark.css'; 8 | 9 | 10 | ReactDOM.render( 11 | , 12 | document.getElementById('root') 13 | ); 14 | -------------------------------------------------------------------------------- /src/snippets/eris.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'Eris (JavaScript)', 3 | language: 'javascript', 4 | generateFrom(data) { 5 | if (data.embed) { 6 | return `const data = ${JSON.stringify(data, null, ' ')};\nclient.createMessage(channelID, data);`; 7 | } 8 | 9 | return `client.createMessage(channelID, ${JSON.stringify(data.content)});`; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/components/button.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | 4 | const Button = ({ label, onClick, className='', colors='bg-white blurple' }) => { 5 | const base = 'dib b--none no-underline pointer ph3 pv2 ma1 br2'; 6 | const cls = `${base} ${colors} ${className}`; 7 | return ; 8 | }; 9 | 10 | 11 | export default Button; 12 | -------------------------------------------------------------------------------- /src/snippets/discordie.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'discordie (JavaScript)', 3 | language: 'javascript', 4 | generateFrom(data) { 5 | if (data.embed) { 6 | return ( 7 | `const data = ${JSON.stringify(data.embed, null, ' ')};\n` + 8 | `channel.sendMessage(${JSON.stringify(data.content)}, false, data);` 9 | ); 10 | } 11 | 12 | return `channel.sendMessage(${JSON.stringify(data.content)});`; 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Embed Visualizer 9 | 10 | 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /src/snippets/discordjs.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'discord.js (JavaScript)', 3 | language: 'javascript', 4 | generateFrom(data) { 5 | if (data.embed && data.content) { 6 | return ( 7 | `const embed = ${JSON.stringify(data.embed, null, ' ')};\n` + 8 | `channel.send(${JSON.stringify(data.content)}, { embed });` 9 | ); 10 | } else if (data.embed) { 11 | return `const embed = ${JSON.stringify(data.embed, null, ' ')};\nchannel.send({ embed });`; 12 | } 13 | 14 | return `channel.send(${JSON.stringify(data.content)})`; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /src/snippets/restcord.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'RestCord (PHP)', 3 | language: 'php', 4 | generateFrom(data) { 5 | let embed = null; 6 | if (data.embed) { 7 | embed = JSON.stringify(data.embed, null, 4) 8 | .replace(/{/g, '[') 9 | .replace(/}/g, ']') 10 | .replace(/^ {4}/gm, ' ') 11 | .replace(/^]/gm, ' ]'); 12 | } 13 | 14 | return `channel->createMessage([ 17 | 'channel.id' => $channelId, 18 | 'content' => "${data.content}", 19 | 'embed' => ${embed} 20 | ]);`; 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "embed-visualizer", 3 | "author": "leovoel", 4 | "license": "MIT", 5 | "version": "0.1.0", 6 | "private": true, 7 | "homepage": "https://leovoel.github.io/embed-visualizer/", 8 | "devDependencies": { 9 | "react-scripts": "0.8.5", 10 | "rimraf": "^2.5.4" 11 | }, 12 | "dependencies": { 13 | "ajv": "^4.11.2", 14 | "codemirror": "^5.23.0", 15 | "highlight.js": "^9.9.0", 16 | "lodash.debounce": "^4.0.8", 17 | "moment": "^2.17.1", 18 | "react": "^15.4.2", 19 | "react-addons-css-transition-group": "^15.4.2", 20 | "react-color": "^2.13.8", 21 | "react-dom": "^15.4.2", 22 | "simple-markdown": "^0.2.1", 23 | "twemoji": "^2.2.3" 24 | }, 25 | "scripts": { 26 | "start": "react-scripts start", 27 | "build": "react-scripts build", 28 | "postbuild": "rimraf build/**/*.map asset build/asset-manifest.json", 29 | "test": "react-scripts test --env=jsdom", 30 | "eject": "react-scripts eject" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/components/warningmodal.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Modal from './modal'; 3 | import Button from './button'; 4 | 5 | 6 | // TODO: generalize? 7 | 8 | function WarningButton(props) { 9 | return