Skip to content

Commit

Permalink
✨ Add server owner block (Androz2091#11)
Browse files Browse the repository at this point in the history
* ⬆️ Bump vue-i18n from 8.17.0 to 8.17.1 (Androz2091#6)

Bumps [vue-i18n](https://github.com/kazupon/vue-i18n) from 8.17.0 to 8.17.1.
- [Release notes](https://github.com/kazupon/vue-i18n/releases)
- [Changelog](https://github.com/kazupon/vue-i18n/blob/v8.x/CHANGELOG.md)
- [Commits](kazupon/vue-i18n@v8.17.0...v8.17.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* 🔖 1.1.1

* 🔖 1.2.0

* Create server_owner.js

* Update server_owner.js

* Update index.js

* Update toolbox.js

* Update fr-FR.json

* Update en-US.json

* Update server_owner.js

* Update en-US.json

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Androz2091 <[email protected]>
  • Loading branch information
3 people authored Apr 18, 2020
1 parent 57b54c0 commit 123cbc7
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blockly-vue-sample",
"version": "1.1.0",
"version": "1.2.0",
"private": true,
"scripts": {
"audit": "npm audit fix",
Expand Down
3 changes: 2 additions & 1 deletion src/blocks/discord/servers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "./boost_count.js";
import "./boost_count";
import "./get_server";
import "./icon_url";
import "./member_count";
import "./server_name";
import "./server_owner";
import "./set_server_name";
40 changes: 40 additions & 0 deletions src/blocks/discord/servers/server_owner.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_server_owner";

const blockData = {
"message0": "%{BKY_SERVER_OWNER}",
"args0": [
{
"type": "input_value",
"name": "SERVER",
"check": "Server"
}
],
"colour": "#e07e6c",
"output": "Number",
"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}.owner || ${server}.members.fetch(${server}.ownerID})`, Blockly.JavaScript.ORDER_NONE ];
};

registerRestrictions(blockName, [
{
type: "notempty",
message: "RES_VALID_SERVER",
types: [
"SERVER"
]
}
]);
3 changes: 2 additions & 1 deletion src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"RES_VALID_SERVER": "You must specify a valid server!",
"ICON_URL": "icon url of server %1",
"SERVER_NAME": "name of server %1",
"SERVER_OWNER": "owner of server %1",
"RES_SET_SERVER_NAME_SERVER": "You must specify a valid server to change the name!",
"RES_SET_SERVER_NAME_NEW_NAME": "You must specify a new valid name for the server!",
"LABEL_MODIFY_SERVER": "Modify the server",
Expand Down Expand Up @@ -156,4 +157,4 @@
"FORMS": "Forms",
"SEND_WAIT_REPLY_EXAMPLE": "What is your name?",
"REPLY_EXAMPLE": "Hey!"
}
}
3 changes: 2 additions & 1 deletion src/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"RES_VALID_SERVER": "Vous devez préciser un serveur valide !",
"ICON_URL": "URL de l'icône du serveur %1",
"SERVER_NAME": "nom du serveur %1",
"SERVER_OWNER": "propriétaire du serveur %1",
"RES_SET_SERVER_NAME_SERVER": "Vous devez préciser un serveur valide à qui changer le nom !",
"RES_SET_SERVER_NAME_NEW_NAME": "Vous devez préciser un nouveau nom valide pour le serveur !",
"LABEL_MODIFY_SERVER": "Modifier le serveur",
Expand All @@ -155,4 +156,4 @@
"FORMS": "Formulaires",
"SEND_WAIT_REPLY_EXAMPLE": "Quel est votre prénom ?",
"REPLY_EXAMPLE": "Salut!"
}
}
1 change: 1 addition & 0 deletions src/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ export default (Blockly) => {
<block type="s4d_member_count"></block>
<block type="s4d_icon_url"></block>
<block type="s4d_boost_count"></block>
<block type="s4d_server_owner"></block>
<label text="%{BKY_LABEL_MODIFY_SERVER}"></label>
<block type="s4d_set_server_name"></block>
</category>
Expand Down

0 comments on commit 123cbc7

Please sign in to comment.