Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preview of me and me #470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# Node
node_modules

# Compiled files
dist/
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@blockly/theme-modern": "^2.1.10",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@blockly/theme-modern": "^2.1.10",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/vue-fontawesome": "^2.0.2",
"blockly": "^4.20201217.0",
Expand All @@ -21,7 +21,6 @@
"easy-json-database-browser": "^2.1.0",
"js-beautify": "^1.13.5",
"jszip": "^3.6.0",
"localforage": "^1.10.0",
"sweetalert2": "^10.15.5",
"vue": "^2.6.12",
"vue-i18n": "^8.24.0",
Expand Down
14 changes: 14 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
<meta name="theme-color" content="#f6bc34" />
<meta name="google-site-verification" content="cpALYx5PHSXOgLtp-1pxqyELC6zIekO0RDQnWmFvhXI" />
<style>
.blocklyTreeSeparator {
border-bottom: solid #555555 1px;
height: 0;
margin: 5px 0;
}
.bt {
border-bottom: solid #555555 1px;
height: 0;
margin: 5px 0;
}

.blocklyToolboxDiv {
width: 150px;
}
::-webkit-scrollbar {
width: 1px;
height: 1px;
Expand Down
21 changes: 19 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ import "./blocks/discord/base/";
import "./blocks/discord/message-event/";
import "./blocks/discord/join-event/";
import "./blocks/discord/leave-event/";
import "./blocks/discord/invite";
import "./blocks/discord/reaction-event/";
import "./blocks/discord/edited-event/";
import "./blocks/discord/typing-event";
import "./blocks/discord/thread-event";
import "./blocks/discord/events";
import "./blocks/discord/direct";
import "./blocks/discord/slash";

import "./blocks/discord/channels/";
import "./blocks/discord/servers/";
Expand All @@ -31,9 +38,11 @@ import "./blocks/database/";
import "./blocks/text/";
import "./blocks/loops/";
import "./blocks/other/";
import "./blocks/request";
import "./blocks/time";
import "./prompt";

import Theme from '@blockly/theme-modern';
import Theme from './theme';

export default {
name: "app",
Expand Down Expand Up @@ -76,6 +85,14 @@ export default {
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2
},
move: {
scrollbars: {
horizontal:true,
vertical:true
},
drag:true,
wheel:true
}
},
vueTourOptions: {
Expand Down Expand Up @@ -126,7 +143,7 @@ export default {
#blocklySpace {
position: absolute;
width: 100%;
height: 94%;
height: calc(100% - 66px);
}

.boldtext {
Expand Down
58 changes: 0 additions & 58 deletions src/autosave.js

This file was deleted.

21 changes: 21 additions & 0 deletions src/blocks/database/clear_all_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Blockly from "blockly/core";

const blockName = "s4d_clear_all_data";

const blockData = {
"message0": "%{BKY_CLEAR_ALL_DATA}",
"colour": "#5ba58b",
"helpUrl": "",
"previousStatement": null,
"nextStatement": null
};

Blockly.Blocks[blockName] = {
init: function() {
this.jsonInit(blockData);
}
};

Blockly.JavaScript[blockName] = function() {
return [ 's4d.database.clear()', Blockly.JavaScript.ORDER_ATOMIC ];
};
20 changes: 20 additions & 0 deletions src/blocks/database/db_length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Blockly from "blockly/core";

const blockName = "s4d_db_length";

const blockData = {
"message0": "%{BKY_DATABASE_LENGTH}",
"colour": "#5ba58b",
"helpUrl": "",
"output": "Number"
};

Blockly.Blocks[blockName] = {
init: function() {
this.jsonInit(blockData);
}
};

Blockly.JavaScript[blockName] = function() {
return [ 's4d.database.all().length', Blockly.JavaScript.ORDER_ATOMIC ];
};
3 changes: 3 additions & 0 deletions src/blocks/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ import "./get_data";
import "./has_data";
import "./set_data";
import "./subtract_data";
import "./clear_all_data";
import "./db_length";

40 changes: 40 additions & 0 deletions src/blocks/discord/channels/channel_category.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as Blockly from "blockly/core";
import { registerRestrictions } from "../../../restrictions";

const blockName = "s4d_channel_category";

const blockData = {
"message0": "%{BKY_CHANNEL_CATEGORY}",
"args0": [
{
"type": "input_value",
"name": "CHANNEL",
"check": "Channel"
}
],
"colour": "#50a6c9",
"output": "Category",
"tooltip": "",
"helpUrl": ""
};

Blockly.Blocks[blockName] = {
init: function() {
this.jsonInit(blockData);
}
};

Blockly.JavaScript[blockName] = function(block){
const channel = Blockly.JavaScript.valueToCode(block, "CHANNEL", Blockly.JavaScript.ORDER_ATOMIC);
return [ `${channel}.parent`, Blockly.JavaScript.ORDER_NONE ];
};

registerRestrictions(blockName, [
{
type: "notempty",
message: "RES_VALID_CHANNEL",
types: [
"CHANNEL"
]
}
]);
42 changes: 42 additions & 0 deletions src/blocks/discord/channels/chnl_exists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import Blockly from "blockly/core";
import { registerRestrictions } from "../../../restrictions";

const blockName = "s4d_chnl_exist";

const blockData = {
"message0": "channel %1 exist?",
"args0": [
{
"type": "input_value",
"name": "CHANNEL",
"check": "Channel"
}
],
"colour": "#50a6c9",
"output": "Boolean",
"tooltip": "",
"helpUrl": ""
};

Blockly.Blocks[blockName] = {
init: function() {
this.jsonInit(blockData);
}
};

Blockly.JavaScript[blockName] = function(block) {
const chnl = Blockly.JavaScript.valueToCode(block, "CHANNEL", Blockly.JavaScript.ORDER_ATOMIC);
const code = [`typeof ${chnl} !== undefined`, Blockly.JavaScript.ORDER_NONE ];
return code;

};

registerRestrictions(blockName, [
{
type: "notempty",
message: "RES_VALID_CHANNEL",
types: [
"CHANNEL"
]
}
]);
3 changes: 3 additions & 0 deletions src/blocks/discord/channels/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ import "./get_channel";
import "./send_channel";
import "./send_wait_reply";
import "./send_wait_reply_value";
import "./start_typing";
import "./channel_category";
import "./chnl_exists";
42 changes: 16 additions & 26 deletions src/blocks/discord/channels/send_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ const blockData = {
{
"type": "input_value",
"name": "CONTENT",
"check": [ "MessageEmbed", "String", "Number" ]
"check": ["Number", "String"]
},
{
"type": "input_value",
"name": "EMBED",
"check": "MessageEmbed"
},
{
"type": "input_value",
"name": "CHANNEL",
"check": "Channel"
},
}
],
"colour": "#4C97FF",
"inputsInline": false,
"previousStatement": null,
"nextStatement": null,
"tooltip": "",
Expand All @@ -31,38 +37,22 @@ Blockly.Blocks[blockName] = {
};

Blockly.JavaScript[blockName] = function(block){
const channel = Blockly.JavaScript.valueToCode(block, "CHANNEL", Blockly.JavaScript.ORDER_ATOMIC);
const content = Blockly.JavaScript.valueToCode(block, "CONTENT", Blockly.JavaScript.ORDER_ATOMIC);
if(block.getInput("CONTENT").connection.targetConnection){
const contentType = block.getInput("CONTENT").connection.targetConnection.getSourceBlock().outputConnection.check_ ?
block.getInput("CONTENT").connection.targetConnection.getSourceBlock().outputConnection.check_[0] :
null;
if((contentType === "MessageEmbed") || (!contentType && typeof contentType === "object")){
const code = `${channel}.send(${content});\n`;
return code;
} else {
const code = `${channel}.send(String(${content}));\n`;
return code;
}
const embed = Blockly.JavaScript.valueToCode(block, "EMBED", Blockly.JavaScript.ORDER_ATOMIC) || null;
const channel = Blockly.JavaScript.valueToCode(block, "CHANNEL", Blockly.JavaScript.ORDER_ATOMIC) || "false";
if(content.length > 2){
return(`${channel}.send({embeds: ${embed}, content: ${content}});\n`)
} else {
const code = `${channel}.send(String(${content}));\n`;
return code;
return(`${channel}.send({embeds: ${embed}});\n`)
}
};
}

registerRestrictions(blockName, [
{
type: "notempty",
message: "RES_SEND_CHANNEL_CONTENT",
types: [
"CONTENT"
]
},
{
type: "notempty",
message: "RES_SEND_CHANNEL_CHANNEL",
message: "RES_MISSING_CONTENT",
types: [
"CHANNEL"
"CONTENT"
]
}
]);
Loading