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

445 for host #456

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Node
node_modules

# Compiled files
dist/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.16.1
v16.10.0
1 change: 1 addition & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run="npm run start"
28,776 changes: 28,776 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

42 changes: 37 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,35 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@blockly/block-test": "^1.1.5",
"@blockly/continuous-toolbox": "^1.0.18",
"@blockly/field-grid-dropdown": "^1.0.25",
"@blockly/field-slider": "^2.1.29",
"@blockly/theme-dark": "^2.0.6",
"@blockly/theme-modern": "^2.1.10",
"@blockly/workspace-backpack": "^1.0.9",
"@blockly/zoom-to-fit": "^2.0.9",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/vue-fontawesome": "^2.0.2",
"blockly": "^4.20201217.0",
"@sweetalert2/theme-dark": "^5.0.5",
"blockly": "^6.20210701.0",
"bootstrap": "^4.6.0",
"bootstrap-vue": "^2.21.2",
"discord-buttons": "^2.4.1",
"easy-json-database-browser": "^2.1.0",
"js-beautify": "^1.13.5",
"jszip": "^3.6.0",
"sweetalert2": "^10.15.5",
"vue": "^2.6.12",
"localforage": "^1.10.0",
"moment": "^2.29.1",
"sweetalert2": "^10.16.9",
"vue": "^2.6.11",
"vue-i18n": "^8.24.0",
"vue-loader": "^15.9.8",
"vue-swal": "^1.0.0",
"vue-switches": "^2.0.1",
"vue-toast-notification": "^0.6.1",
"vue-toggle-btn": "^0.1.2",
"vue-tour": "^1.5.0",
"vuex": "^3.6.2"
},
Expand All @@ -38,7 +52,10 @@
"babel-eslint": "^10.1.0",
"eslint": "^7.21.0",
"eslint-plugin-vue": "^7.7.0",
"vue-template-compiler": "^2.6.12"
"sass": "^1.42.1",
"sass-loader": "^10.1.1",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.0.0"
},
"eslintConfig": {
"root": true,
Expand All @@ -62,5 +79,20 @@
"browserslist": [
"> 1%",
"last 2 versions"
]
],
"description": "🐱 Make your Discord bot using Scratch blocks! [Scratch For Discord](https://scratch-for-discord.netlify.com) is an advanced fork of [discord-blocks](https://discordblocks.leondrolio.com/). Thanks to [7coil](https://github.com/7coil) for their great work!",
"main": "babel.config.js",
"directories": {
"example": "examples"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mrredo-and-josetrindade1/scratch-for-discord.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/mrredo-and-josetrindade1/scratch-for-discord/issues"
},
"homepage": "https://github.com/mrredo-and-josetrindade1/scratch-for-discord#readme"
}
42 changes: 39 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>scratch.png">
<link rel="icon" href="https://raw.githubusercontent.com/josetrindade1/scratch-for-discord/djs13/public/scratch.png">
<title>Scratch For Discord - Make your own bot using blocks</title>
<meta name="description" content="Make your own discord bot in 5 minutes using blocks with no coding required. Try your bot online and export it on your computer or server." />
<meta name="keywords" content="discord, bot, no-coding, scratch, blocks" />
<meta name="author" content="Androz2091" />
<meta name="author" content="Androz2091" />
<meta name="theme-color" content="#f6bc34" />
<meta name="google-site-verification" content="cpALYx5PHSXOgLtp-1pxqyELC6zIekO0RDQnWmFvhXI" />
<style>

.blocklyTreeSeparator {
border-bottom: solid #343434 1px;
height: 0;
margin: 5px 0;
}
.bt {
border-bottom: solid #343434 1px;
height: 0;
margin: 5px 0;
}
::-webkit-scrollbar {
width: 1px;
height: 1px;
Expand All @@ -24,6 +35,31 @@
background-color: #161719;
color: #161719;
}
.swal2-popup {
background: #19191a;
}
.swal2-title {
color: #e1e1e1;
}
.swal2-content {
color: #808080;
}
.swal2-input, .swal2-file, .swal2-textarea {
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
-webkit-transition: border-color 0.3s, -webkit-box-shadow 0.3s;
transition: border-color 0.3s, -webkit-box-shadow 0.3s;
transition: border-color 0.3s, box-shadow 0.3s;
transition: border-color 0.3s, box-shadow 0.3s, -webkit-box-shadow 0.3s;
border: 1px solid #d9d9d9;
border-radius: 0.1875em;
background: #323234;
-webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 6%);
box-shadow: inset 0 1px 1px rgb(0 0 0 / 6%);
color: #e1e1e1;
font-size: 1.125em;
}
</style>
</head>
<body>
Expand Down
54 changes: 52 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,65 @@ import Blockly from "blockly";
import NavBarComponent from "./components/NavigationBar/NavigationBar.vue";
import BlocklyComponent from "./components/BlocklyComponent.vue";


Blockly.Tooltip.HOVER_MS = 100;

// Load blocks

import "./blocks/discord/base/";
import "./blocks/discord/message-event/";
import "./blocks/discord/join-event/";
import "./blocks/discord/leave-event/";
import "./blocks/discord/reaction-event/";
import "./blocks/discord/bot-event";

import "./blocks/discord/channels/";
import "./blocks/discord/servers/";
import "./blocks/discord/roles/";
import "./blocks/discord/members/";
import "./blocks/discord/deleted/";
import "./blocks/discord/discord-button/";
import "./blocks/discord/webhook/";
import "./blocks/discord/embed/";
import "./blocks/discord/discord-menu/";
import "./blocks/discord/music/";
import "./blocks/discord/discord-canvas/welcome/";
import "./blocks/discord/discord-canvas/goodbye/";
import "./blocks/discord/discord-canvas/rankcard/";

import "./blocks/discord/mmenu/";
import "./blocks/discord/mbuttons/";
import "./blocks/discord/membed/";
import "./blocks/discord/m-register-menus/";
import "./blocks/discord/mslash/";
import "./blocks/discord/wmise/";
import "./blocks/mongodb/";

import "./blocks/database/";
import "./blocks/text/";
import "./blocks/loops/";
import "./blocks/other/";
import "./prompt";
//events
//channel
import "./blocks/events/channel/channelCreate/";
import "./blocks/events/channel/channelUpdate/";
import "./blocks/events/channel/channelDelete/";
//emoji
import "./blocks/events/emoji/emojiCreate/";
import "./blocks/events/emoji/emojiUpdate/";
import "./blocks/events/emoji/emojiDelete/";
//member
import "./blocks/events/member/join-event/";
import "./blocks/events/member/leave-event/";
import "./blocks/events/member/guildBanAdd/";
import "./blocks/events/member/guildBanRemove/";
//role
import "./blocks/events/role/roleCreate/";
import "./blocks/events/role/roleUpdate/";
import "./blocks/events/role/roleDelete/";
//sticker
import "./blocks/events/sticker/stickerCreate/";
import "./blocks/events/sticker/stickerUpdate/";
import "./blocks/events/sticker/stickerDelete/";

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

Expand Down Expand Up @@ -78,6 +117,13 @@ export default {
scaleSpeed: 1.2
}
},
move:{
scrollbars: {
horizontal: true,
vertical: true
},
drag: true,
wheel: true},
vueTourOptions: {
labels: {
buttonSkip: this.$t('tour.skip'),
Expand Down Expand Up @@ -136,4 +182,8 @@ export default {
.testopa {
opacity: 0.1;
}

</style>
<style lang="scss">
@import '~@sweetalert2/theme-dark/dark.scss';
</style>
16 changes: 16 additions & 0 deletions src/backpack-save-load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import localforage from "localforage";
export default async function Load(backpack){
console.log('started backpack')
const content = await localforage.getItem("backpack3");
if(content !== null){
console.log('loading backpack')
backpack.setContents(content)
}
Save(backpack)
}
async function Save(backpack){
setInterval(async function(){
console.log('saving backpack')
localforage.setItem("backpack3",backpack.getContents());
}, 1000);
}
51 changes: 51 additions & 0 deletions src/blocks/discord/base/bot_amout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as Blockly from "blockly/core";

const blockName = "s4d_bot_amount";

const blockData = {
"message0": "%{BKY_BOT_AMOUNT}",
"args0": [
{
"type": "field_dropdown",
"name": "T",
"options": [
[
"%{BKY_SERVERS}",
"servers"
],
[
"%{BKY_USERS}",
"users"
],
[
"%{BKY_CHANNELS}",
"channels"
]
]
},
],
"colour": "#4C97FF",
"output":"String",
"inputsInline": true,
"tooltip": "",
"helpUrl": ""
};

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

Blockly.JavaScript[blockName] = function(block){
const t = block.getFieldValue("T");
let code = ""
if(t === "servers"){
code = "s4d.client.guilds.cache.size"
}else if(t === "channels"){
code = "s4d.client.channels.cache.size"
}else if(t === "users"){
code = "s4d.client.users.cache.size"
}
return [code, Blockly.JavaScript.ORDER_NONE ];
};
29 changes: 29 additions & 0 deletions src/blocks/discord/base/get_bot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as Blockly from "blockly/core";

const blockName = "s4d_get_bot";

const blockData = {
"message0": "%{BKY_GET_BOT}",
"args0": [
{
"type": "input_value",
"name": "SERVER",
"check": "Server"
}
],
"colour": "#5b67a5",
"output": "Member",
"tooltip": "",
"helpUrl": ""
};

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

Blockly.JavaScript[blockName] = function(block){
const server = Blockly.JavaScript.valueToCode(block, "SERVER", Blockly.JavaScript.ORDER_ATOMIC);
return [ `${server}.members.cache.find((m) => m.id === s4d.client.user.id)`, Blockly.JavaScript.ORDER_NONE ];
};
4 changes: 4 additions & 0 deletions src/blocks/discord/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import "./bot_server_count";
import "./login";
import "./on_connected";
import "./set_bot_game";
import "./get_bot";
import "./s4d_bot_shutdown";
import "./set_bot_stream";
import "./bot_amout";
2 changes: 1 addition & 1 deletion src/blocks/discord/base/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Blockly.Blocks[blockName] = {

Blockly.JavaScript[blockName] = function(block) {
const value = Blockly.JavaScript.valueToCode(block, "TOKEN", Blockly.JavaScript.ORDER_ATOMIC);
const code = `await s4d.client.login(${value}).catch((e) => { s4d.tokenInvalid = true; s4d.tokenError = e; });\n`;
const code = `await s4d.client.login(${value}).catch((e) => { s4d.tokenInvalid = true; s4d.tokenError = e.code; });\n`;
return code;
};
24 changes: 24 additions & 0 deletions src/blocks/discord/base/s4d_bot_shutdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as Blockly from "blockly/core";


const blockName = "s4d_bot_shutdown";

const blockData = {
"message0": "Shutdown the bot",
"colour": "#4C97FF",
"previousStatement": null,
"nextStatement": null,
"tooltip": "Litterally shutdowns the bot",
"helpUrl": ""
};

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

Blockly.JavaScript[blockName] = function(){
const code = `s4d.client.destroy();\n`;
return code;
};
Loading