In my Blockly Program, I have callbacks that reference certain variable names, such as msg, channel, and member. However, when I try to add those words as reserved words, they appear in the list of RESERVEDWORDS, but when I name a variable msg, it still says var msg in the generated code, not var msg2. Any way around this?
My code (using react-blockly-drawer):
{
name: "initMessageListener",
category: "Listeners",
block: {
init: function() {
this.jsonInit({
message0: "On Message %1",
args0: [
{
type: "input_statement",
name: "CALLBACK"
}
],
previousStatement: null,
nextStatement: null,
colour: "#ff6d6b",
tooltip:
"Every time message is sent on the server, the code inside this block runs",
helpUrl:
"https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-message"
});
}
},
generator: block => {
if (!Blockly.JavaScript.RESERVED_WORDS_.includes("msg")) {
Blockly.JavaScript.addReservedWords("msg");
}
}
}
In my Blockly Program, I have callbacks that reference certain variable names, such as msg, channel, and member. However, when I try to add those words as reserved words, they appear in the list of RESERVEDWORDS, but when I name a variable msg, it still says var msg in the generated code, not var msg2. Any way around this?
My code (using react-blockly-drawer):