diff --git a/French/actions/French/action_anchor.js b/French/actions/French/action_anchor.js new file mode 100644 index 0000000..6fad682 --- /dev/null +++ b/French/actions/French/action_anchor.js @@ -0,0 +1,119 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Ancrage d'action", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "D'autres choses", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.anchorName}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["anchorName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +Anchor Name
+`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data, customData, index) { + if (!customData.anchors) { + customData.anchors = {}; + } + customData.anchors[data.anchorName] = index; + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/action_container.js b/French/actions/French/action_container.js new file mode 100644 index 0000000..f28db29 --- /dev/null +++ b/French/actions/French/action_container.js @@ -0,0 +1,124 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Conteneur d'actions", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "D'autres choses", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.comment}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["comment", "actions"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+ Comment
+ +
+ +

+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const actions = data.actions; + this.executeSubActionsThenNextAction(actions, cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data) { + this.prepareActions(data.actions); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/add_embed_field.js b/French/actions/French/add_embed_field.js index a41286f..18b34bc 100644 --- a/French/actions/French/add_embed_field.js +++ b/French/actions/French/add_embed_field.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Ajouter un champs d'intégration", + name: "Ajouter un champ d'intégration", //--------------------------------------------------------------------- // Action Section @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Message Intégrer", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/add_embed_to_message_data.js b/French/actions/French/add_embed_to_message_data.js new file mode 100644 index 0000000..be740ab --- /dev/null +++ b/French/actions/French/add_embed_to_message_data.js @@ -0,0 +1,120 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Ajouter l'intégration aux données du message", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Message Intégrer", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `Store ${presets.getVariableText(data.storage, data.varName)} in ${presets.getVariableText(data.editMessage, data.editMessageVarName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "editMessage", "editMessageVarName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const embed = this.getVariable(storage, varName, cache); + + if (embed) { + const editMessage = parseInt(data.editMessage, 10); + if (typeof editMessage === "number" && editMessage >= 0) { + const editVarName = this.evalMessage(data.editMessageVarName, cache); + const editObject = this.getVariable(editMessage, editVarName, cache); + if (Array.isArray(editObject.embeds)) { + editObject.embeds.push(embed); + } else { + editObject.embeds = [ embed ]; + } + } + } + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/add_member_role.js b/French/actions/French/add_member_role.js index d4adf6a..c4b8c17 100644 --- a/French/actions/French/add_member_role.js +++ b/French/actions/French/add_member_role.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Ajouter un rôle à un membre", + name: "Ajouter un rôle de membre", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/add_reaction.js b/French/actions/French/add_reaction.js index 7057064..7e0b887 100644 --- a/French/actions/French/add_reaction.js +++ b/French/actions/French/add_reaction.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Messages", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/archive_thread.js b/French/actions/French/archive_thread.js new file mode 100644 index 0000000..2b67964 --- /dev/null +++ b/French/actions/French/archive_thread.js @@ -0,0 +1,127 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Archiver le fil de discussion", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.archive === "true" ? "Archive" : "Unarchive"} Thread: "${presets.getChannelText(data.thread, data.threadVarName)}"`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["thread", "threadVarName", "archive"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ +
+ New Thread State
+ +
+
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const thread = await this.getChannelFromData(data.thread, data.threadVarName, cache); + + const reason = this.evalMessage(data.reason, cache); + const archive = data.archive === "true"; + + if (Array.isArray(thread)) { + this.callListFunc(thread, "setArchived", [archive, reason]).then(() => this.callNextAction(cache)); + } else if (thread?.setArchived) { + thread + .setArchived(archive, reason) + .then((threadChannel) => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/await_message_from_member.js b/French/actions/French/await_message_from_member.js new file mode 100644 index 0000000..927a5a6 --- /dev/null +++ b/French/actions/French/await_message_from_member.js @@ -0,0 +1,159 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Attendre le message du membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `Await message in ${presets.getChannelText(data.channel, data.channelVarName)} from ${presets.getMemberText(data.member, data.memberVarName)}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.storeInVarName, "Message"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "channelVarName", "member", "memberVarName", "time", "count", "storage", "storeInVarName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ + + +



+ +
+
+ Await Time (in Seconds)
+
+
+
+ Number of Messages to Check
+
+
+
+ +



+ + +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const server = cache.server; + const channel = await this.getChannelFromData(data.channel, data.channelVarName, cache); + const member = await this.getMemberFromData(data.member, data.memberVarName, cache); + + if (!member || !channel?.createMessageCollector) return this.callNextAction(cache); + + const maxProcessed = Math.min(parseInt(this.evalMessage(data.count, cache), 10), 200); + const time = parseInt(this.evalMessage(data.time, cache) || "5", 10) * 1000; + const filter = (m) => m?.author?.id === member.id; + + const collector = channel.createMessageCollector({ + max: 1, + time, + filter, + maxProcessed + }); + + collector.on('end', (collected) => { + if(collected && collected.size > 0) { + const varName = this.evalMessage(data.storeInVarName, cache); + const storage = parseInt(data.storage, 10); + this.storeValue(collected.values().next(), storage, varName, cache); + } + + this.callNextAction(cache); + }); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod(DBM) {}, +}; diff --git a/French/actions/French/check_if_member_has_role.js b/French/actions/French/check_if_member_has_role.js index 119e977..58472a8 100644 --- a/French/actions/French/check_if_member_has_role.js +++ b/French/actions/French/check_if_member_has_role.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Vérifiez si le membre a un rôle", + name: "Vérifiez si le membre a le rôle", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/check_is_bot_in_voice_channel.js b/French/actions/French/check_is_bot_in_voice_channel.js index a842c5a..3a05d01 100644 --- a/French/actions/French/check_is_bot_in_voice_channel.js +++ b/French/actions/French/check_is_bot_in_voice_channel.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Vérifiez qu'il s'agit d'un robot dans le canal vocal", + name: "Vérifiez qu'il s'agit d'un bot dans le canal vocal", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/check_member_data.js b/French/actions/French/check_member_data.js index d664c8e..13d7bf4 100644 --- a/French/actions/French/check_member_data.js +++ b/French/actions/French/check_member_data.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Vérifier les données des membres", + name: "Vérifier les données du membre", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/check_member_permissions.js b/French/actions/French/check_member_permissions.js index 3d69502..13d0ee6 100644 --- a/French/actions/French/check_member_permissions.js +++ b/French/actions/French/check_member_permissions.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Vérifier les autorisations des membres", + name: "Vérifier les autorisations du membre", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/check_message_data.js b/French/actions/French/check_message_data.js new file mode 100644 index 0000000..d44fe58 --- /dev/null +++ b/French/actions/French/check_message_data.js @@ -0,0 +1,187 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Vérifier les données du message", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Données", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getConditionsText(data)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["message", "varName", "dataName", "comparison", "value", "branch"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Data Name
+ +
+
+ Comparison Type
+ +
+
+ +


+ +
+ Value to Compare to
+ +
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = await this.getMessageFromData(data.message, data.varName, cache); + + let result = false; + if (message?.data) { + const dataName = this.evalMessage(data.dataName, cache); + const val1 = message.data(dataName); + const compare = parseInt(data.comparison, 10); + let val2 = this.evalMessage(data.value, cache); + if (compare !== 6) val2 = this.eval(val2, cache); + if (val2 === false) val2 = this.evalMessage(data.value, cache); + switch (compare) { + case 0: + result = val1 !== undefined; + break; + case 1: + result = val1 == val2; + break; + case 2: + result = val1 === val2; + break; + case 3: + result = val1 < val2; + break; + case 4: + result = val1 > val2; + break; + case 5: + if (typeof val1.includes === "function") { + result = val1.includes(val2); + } + break; + case 6: + result = Boolean(val1.match(new RegExp("^" + val2 + "$", "i"))); + break; + } + } + this.executeResults(result, data?.branch ?? data, cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data) { + this.prepareActions(data.branch?.iftrueActions); + this.prepareActions(data.branch?.iffalseActions); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/control_member_data.js b/French/actions/French/control_member_data.js index 5c9d50f..9873a98 100644 --- a/French/actions/French/control_member_data.js +++ b/French/actions/French/control_member_data.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Données des membres de contrôle", + name: "Contrôle des données du membre", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/control_message_data.js b/French/actions/French/control_message_data.js new file mode 100644 index 0000000..41b9125 --- /dev/null +++ b/French/actions/French/control_message_data.js @@ -0,0 +1,143 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Contrôle des données du message", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Données", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMessageText(data.message, data.varName)} (${data.dataName}) ${ + data.changeType === "1" ? "+=" : "=" + } ${data.value}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["message", "varName", "dataName", "changeType", "value"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Data Name
+ +
+
+ Control Type
+ +
+
+ +


+ +
+ Value
+
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = await this.getMessageFromData(data.message, data.varName, cache); + + if (message?.setData) { + const dataName = this.evalMessage(data.dataName, cache); + const isAdd = data.changeType === "1"; + let val = this.evalMessage(data.value, cache); + try { + val = this.eval(val, cache); + } catch (e) { + this.displayError(data, cache, e); + } + if (val !== undefined) { + if (isAdd) { + message.addData(dataName, val); + } else { + message.setData(dataName, val); + } + } + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/control_server_data.js b/French/actions/French/control_server_data.js index 73ba627..5b7a6d8 100644 --- a/French/actions/French/control_server_data.js +++ b/French/actions/French/control_server_data.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Données du serveur de contrôle", + name: "Contrôle des donnée du serveur", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/create_embed_message.js b/French/actions/French/create_embed_message.js index ed87e21..f2836a9 100644 --- a/French/actions/French/create_embed_message.js +++ b/French/actions/French/create_embed_message.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Intégrer le message", + section: "Message Intégrer", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/create_sticker.js b/French/actions/French/create_sticker.js new file mode 100644 index 0000000..2681548 --- /dev/null +++ b/French/actions/French/create_sticker.js @@ -0,0 +1,164 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Créer un autocollant", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des Emoji/Autocollants", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.stickerName}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + if (parseInt(data.storage2, 10) !== varType) return; + return [data.varName2, "Sticker"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["stickerName", "description", "tag", "storage", "varName", "storage2", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+ Sticker Name
+ +
+ +
+ + + +


+ +
+ Sticker Tag
+ +
+ +
+ +
+ Sticker Description
+ +
+ +

+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const server = cache.server; + if (!server) return this.callNextAction(cache); + + const varName = this.evalMessage(data.varName, cache); + const image = this.getVariable(parseInt(data.storage, 10), varName, cache); + const { Images } = this.getDBM(); + + let buffer; + try { + buffer = Images.createBuffer(image); + } catch { + return this.displayError(data, cache); + } + + const tag = this.evalMessage(data.tag, cache); + const description = this.evalMessage(data.description, cache); + + server.stickers + .create(buffer, this.evalMessage(data.stickerName, cache), tag, { description }) + .then((sticker) => { + const varName2 = this.evalMessage(data.varName2, cache); + const storage = parseInt(data.storage, 10); + this.storeValue(sticker, storage, varName2, cache); + this.callNextAction(cache); + }) + .catch((err) => this.displayError(data, cache, err)); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/create_thread.js b/French/actions/French/create_thread.js new file mode 100644 index 0000000..5475d97 --- /dev/null +++ b/French/actions/French/create_thread.js @@ -0,0 +1,200 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Créer un fil de discussion", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `Create Thread Named "${data.threadName}" from ${ + data.fromTarget._index === 0 ? + presets.getChannelText(data.fromTarget?.channel ?? 0, data.fromTarget?.channelVarName) : + presets.getMessageText(data.fromTarget?.message ?? 0, data.fromTarget?.messageVarName) + }`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.storageVarName, "Thread Channel"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["fromTarget", "threadName", "autoArchiveDuration", "reason", "storage", "storageVarName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +
+ +
+
+
+ +
+ +
+
+
+
+ +






+ +
+ + Thread Name
+
+ +
+
+ + Auto-Archive Duration
+
+ +
+ +



+ +
+ +
+ +
+ Reason + +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + + let messageOrChannel = null; + + if(data.fromTarget._index === 0) { + messageOrChannel = await this.getChannelFromData(data.fromTarget.channel, data.fromTarget.channelVarName, cache); + } else { + messageOrChannel = await this.getMessageFromData(data.fromTarget.message, data.fromTarget.messageVarName, cache); + } + + + const threadOptions = { + name: this.evalMessage(data.threadName, cache), + autoArchiveDuration: data.autoArchiveDuration === "max" ? "MAX" : parseInt(data.autoArchiveDuration, 10), + }; + + if (data.reason) { + const reason = this.evalMessage(data.reason, cache); + threadOptions.reason = reason; + } + + if (messageOrChannel !== null) { + if (Array.isArray(messageOrChannel)) { + this.callListFunc(messageOrChannel, "startThread", [threadOptions]).then(() => this.callNextAction(cache)); + } else if (messageOrChannel?.startThread) { + messageOrChannel + .startThread(threadOptions) + .then((threadChannel) => { + const storage = parseInt(data.storage, 10); + const storageVarName = this.evalMessage(data.storageVarName, cache); + this.storeValue(threadChannel, storage, storageVarName, cache); + this.callNextAction(cache); + }) + .catch((err) => this.displayError(data, cache, err)); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/delete_bulk_messages.js b/French/actions/French/delete_bulk_messages.js index a037075..23d5314 100644 --- a/French/actions/French/delete_bulk_messages.js +++ b/French/actions/French/delete_bulk_messages.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Supprimer les messages en masse", + name: "Supprimer des messages en masse", //--------------------------------------------------------------------- // Action Section @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Messages", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/delete_emoji.js b/French/actions/French/delete_emoji.js index 44c2a44..4999d11 100644 --- a/French/actions/French/delete_emoji.js +++ b/French/actions/French/delete_emoji.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Supprimer un Emoji", + name: "Supprimer un émoji", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/delete_message.js b/French/actions/French/delete_message.js index 7f88788..582182d 100644 --- a/French/actions/French/delete_message.js +++ b/French/actions/French/delete_message.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Messages", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/delete_sticker.js b/French/actions/French/delete_sticker.js new file mode 100644 index 0000000..e252d75 --- /dev/null +++ b/French/actions/French/delete_sticker.js @@ -0,0 +1,153 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Supprimer l'autocollant", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des Emoji/Autocollants", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const inputTypes = ["Specific Sticker", "Temp Variable", "Server Variable", "Global Variable"]; + return `${inputTypes[parseInt(data.sticker, 10)]} (${data.varName})`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["sticker", "varName", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Source Emoji
+ +
+
+ Sticker Name
+
+
+
+ +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob, document } = this; + + glob.onChange1 = function (event) { + const value = parseInt(event.value, 10); + const varNameInput = document.getElementById("extName"); + if (value === 0) { + varNameInput.innerHTML = "Sticker Name"; + } else { + varNameInput.innerHTML = "Variable Name"; + } + }; + + glob.onChange1(document.getElementById("sticker")); + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const server = cache.server; + const type = parseInt(data.sticker, 10); + const reason = this.evalMessage(data.reason, cache); + const varName = this.evalMessage(data.varName, cache); + let sticker; + if (type === 0) { + sticker = server.stickers.cache.find((e) => e.name === varName); + } else { + sticker = this.getVariable(type, varName, cache); + } + if (!sticker) return this.callNextAction(cache); + if (sticker?.delete) { + sticker + .delete(reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/disable_buttons_select.js b/French/actions/French/disable_buttons_select.js new file mode 100644 index 0000000..4d8a971 --- /dev/null +++ b/French/actions/French/disable_buttons_select.js @@ -0,0 +1,231 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Désactiver les boutons et les sélections", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMessageText(data.storage, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "type", "disable", "searchValue"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ +
+ Components to Disable
+ +
+ +
+ Disable or Re-enable
+ +
+ +



+ +
+ Component Label/ID
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob } = this; + + glob.onButtonSelectTypeChange = function (event) { + const input = document.getElementById("nameContainer"); + input.style.display = event.value === "findButton" || event.value === "findSelect" ? null : "none"; + }; + + glob.onButtonSelectTypeChange(document.getElementById("type")); + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = await this.getMessageFromData(data.storage, data.varName, cache); + + const type = data.type; + + let sourceButton = null; + if (cache.interaction.isButton()) { + sourceButton = cache.interaction.customId; + } + + let sourceSelect = null; + if (cache.interaction.isSelectMenu()) { + sourceSelect = cache.interaction.customId; + } + + const disable = (data.disable ?? "disable") === "disable"; + let components = null; + let searchValue = null; + + if (message?.components) { + + const { MessageActionRow } = this.getDBM().DiscordJS; + const oldComponents = message.components; + const newComponents = []; + + for (let i = 0; i < oldComponents.length; i++) { + + const compData = oldComponents[i]; + const comps = (compData instanceof MessageActionRow) ? compData.toJSON() : compData; + + for (let j = 0; j < comps.components.length; j++) { + + const comp = comps.components[j]; + const id = comp.custom_id ?? comp.customId; + + switch (type) { + case "all": { + comp.disabled = disable; + break; + } + case "allButtons": { + if (comp.type === 2 || comp.type === "BUTTON") comp.disabled = disable; + break; + } + case "allSelects": { + if (comp.type === 3 || comp.type === "SELECT_MENU") comp.disabled = disable; + break; + } + case "sourceButton": { + if (id === sourceButton) comp.disabled = disable; + break; + } + case "sourceSelect": { + if (id === sourceSelect) comp.disabled = disable; + break; + } + case "findButton": + case "findSelect": { + if (searchValue === null) searchValue = this.evalMessage(data.searchValue, cache); + if (id === searchValue || comp.label === searchValue) comp.disabled = disable; + break; + } + } + } + + newComponents.push(comps); + + } + + components = newComponents; + + } + + if (components) { + if (Array.isArray(message)) { + this.callListFunc(message, "edit", [{ components }]).then(() => this.callNextAction(cache)); + } else if (cache.interaction?.message?.id === message?.id && cache.interaction?.update && !cache.interaction?.replied) { + cache.interaction + .update({ components }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else if (message?.edit) { + message + .edit({ components }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + if (message.components) { + message.components = components; + } + this.callNextAction(cache); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/disable_command.js b/French/actions/French/disable_command.js new file mode 100644 index 0000000..bc5b400 --- /dev/null +++ b/French/actions/French/disable_command.js @@ -0,0 +1,201 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Désactiver la commande", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "D'autres choses", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.disable === "disable" ? "Disable" : "Re-enable"} "${data.command}"`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["fromTarget", "command", "disable"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +
+ +
+
+
+ +
+ +
+
+
+
+ +






+ +
+ Command
+ +
+ +
+ +
+ Disable or Re-enable
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob, document } = this; + + const $cmds = glob.$cmds; + const coms = document.getElementById("command"); + let innerHTML = ""; + for (let i = 0; i < $cmds.length; i++) { + if ($cmds[i] && $cmds[i].comType >= 4 && $cmds[i].comType <= 6) { + innerHTML += `\n`; + } + } + coms.innerHTML = innerHTML; + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const { Bot, Files } = this.getDBM(); + + const id = data.command; + + let name; + const allData = Files.data.commands; + for (let i = 0; i < allData.length; i++) { + if (allData[i]?._id === id) { + name = allData[i].name; + break; + } + } + + const names = Bot.validateSlashCommandName(name); + if (!names || names.length < 1 || !names[0]) { + this.callNextAction(cache); + return; + } + + name = names[0]; + + let memberOrRole = null; + let resolvedType = ""; + if(data.fromTarget._index === 0) { + memberOrRole = await this.getMemberFromData(data.fromTarget.member, data.fromTarget.memberVarName, cache); + resolvedType = "USER"; + } else { + memberOrRole = await this.getRoleFromData(data.fromTarget.role, data.fromTarget.roleVarName, cache); + resolvedType = "ROLE"; + } + + if (!memberOrRole) { + this.callNextAction(cache); + return; + } + + resolvedId = memberOrRole?.id; + + const disable = data.disable === "disable"; + + let command = Bot.bot.application.commands.cache.find(com => com.name === name); + if (!command) { + command = cache.server.commands.cache.find(com => com.name === name); + } + + if (command) { + const permissions = [ + { + id: resolvedId, + type: resolvedType, + permission: !disable, + }, + ]; + + const promise = command.permissions.add({ permissions }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/edit_channel.js b/French/actions/French/edit_channel.js new file mode 100644 index 0000000..2be4fef --- /dev/null +++ b/French/actions/French/edit_channel.js @@ -0,0 +1,304 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Modifier n'importe quelle canal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const channelTypes = [ + "Text Channel", + "Voice Channel", + "Thread Channel", + ]; + return `Edit ${presets.getChannelText(data.channel, data.channelVarName)} as a ${channelTypes[data.channelEdits._index ?? 0]}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "channelVarName", "channelName", "reason", "channelEdits"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Name
+ +
+
+ Reason + +
+
+ +



+ + + + +
+
+ Topic
+ + +
+ + Slowmode (seconds)
+ +
+
+ Category ID
+ + +
+ + Position
+ +
+ +





+
+
+ + +
+
+ Region Override
+ + +
+ + Bitrate
+ +
+
+ Category ID
+ + +
+ + User Limit
+ +
+ +





+
+
+ + +
+
+ Auto-Archive Duration
+ + +
+ + Slowmode (seconds)
+ +
+
+ Allow Everyone to Invite
+ + +
+ + Set Locked
+ +
+ +





+
+
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const reason = this.evalMessage(data.reason, cache); + + const channelData = {}; + if (data.channelName) { + channelData.name = this.evalMessage(data.channelName, cache); + } + + const channelEditData = data.channelEdits; + + switch (channelEditData._index) { + // text + case 0: { + if (channelEditData.topic) { + channelData.topic = this.evalMessage(channelEditData.topic, cache); + } + if (channelEditData.categoryID) { + channelData.parent = this.evalMessage(channelEditData.categoryID, cache); + } + if (channelEditData.slowmode) { + channelData.rateLimitPerUser = parseInt(this.evalMessage(channelEditData.slowmode, cache), 10); + } + if (channelEditData.position) { + channelData.position = parseInt(this.evalMessage(channelEditData.position, cache), 10); + } + break; + } + + // voice + case 1: { + if (channelEditData.regionOverride !== "none") { + channelData.rtcRegion = channelEditData.regionOverride === "auto" ? null : channelEditData.regionOverride; + } + if (channelEditData.categoryID) { + channelData.parent = this.evalMessage(channelEditData.categoryID, cache); + } + if (channelEditData.bitrate) { + channelData.bitrate = parseInt(this.evalMessage(channelEditData.bitrate, cache), 10); + } + if (channelEditData.userLimit) { + channelData.userLimit = parseInt(this.evalMessage(channelEditData.userLimit, cache), 10); + } + break; + } + + // thread + case 2: { + if (channelEditData.autoArchiveDuration !== "none") { + channelData.autoArchiveDuration = channelEditData.autoArchiveDuration === "max" ? "max" : parseInt(channelEditData.autoArchiveDuration, 10); + } + if (channelEditData.invitable !== "none") { + channelData.invitable = channelEditData.invitable === "true"; + } + if (channelEditData.slowmode) { + channelData.rateLimitPerUser = parseInt(this.evalMessage(channelEditData.slowmode, cache), 10); + } + if (channelEditData.locked !== "none") { + channelData.locked = channelEditData.locked === "true"; + } + break; + } + } + + const channelStorage = parseInt(data.channel, 10); + const channelVarName = this.evalMessage(data.channelVarName, cache); + const channel = await this.getAnyChannel(channelStorage, channelVarName, cache); + + if (Array.isArray(channel)) { + this.callListFunc(channel, "edit", [channelData, reason]).then(() => this.callNextAction(cache)); + } else if (channel?.edit) { + channel + .edit(channelData, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/edit_message.js b/French/actions/French/edit_message.js index 00ed106..5207307 100644 --- a/French/actions/French/edit_message.js +++ b/French/actions/French/edit_message.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Messages", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/edit_select_options.js b/French/actions/French/edit_select_options.js new file mode 100644 index 0000000..fb39f09 --- /dev/null +++ b/French/actions/French/edit_select_options.js @@ -0,0 +1,296 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Modifier les options du menu Sélectionner", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const optionChange = data.optionChange ?? {}; + if (optionChange._index === 0) { + return `Add Option Labeled "${optionChange.label}"`; + } else if (optionChange.type === "value") { + return `Remove Option with Value "${optionChange.value}"`; + } + return `Remove Option with Label "${optionChange.value}"`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["message", "messageVarName", "type", "searchValue", "optionChange"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ +
+ Components to Edit
+ +
+ +
+
+ Select Menu Label/ID
+ +
+
+ +



+ + + + +
+
+ Name + + +
+ + Value + +
+
+ Description + + +
+ + Emoji + +
+ +





+
+
+ + +
+
+ Remove Type
+ +
+
+ Option Value to Remove + +
+ +

+
+
+ +
+`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob } = this; + + glob.onButtonSelectTypeChange = function (event) { + const input = document.getElementById("nameContainer"); + input.style.display = event.value === "findSelect" ? null : "none"; + }; + + glob.onButtonSelectTypeChange(document.getElementById("type")); + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = await this.getMessageFromData(data.message, data.messageVarName, cache); + + const type = data.type; + + let sourceSelect = null; + if (cache.interaction.isSelectMenu()) { + sourceSelect = cache.interaction.customId; + } + + const optionChange = data.optionChange; + + let newOptionData = null; + let removeOptionValue = null; + let removeOptionLabel = null; + if (optionChange._index === 0) { + newOptionData = { + label: this.evalMessage(optionChange.label, cache), + value: this.evalMessage(optionChange.value, cache), + default: false, + }; + if (optionChange.description) { + newOptionData.description = this.evalMessage(optionChange.description, cache); + } + if (optionChange.emoji) { + newOptionData.emoji = this.evalMessage(optionChange.emoji, cache); + } + } else if (optionChange._index === 1) { + if (optionChange.type === "value") { + removeOptionValue = this.evalMessage(optionChange.value, cache); + } else if (optionChange.type === "label") { + removeOptionLabel = this.evalMessage(optionChange.value, cache); + } + } + + const onSelectMenuFound = (select) => { + if (select) { + if (!select.options) select.options = []; + if (newOptionData) { + select.options.push({ ...newOptionData }); + } else if (removeOptionValue) { + select.options = select.options.filter((o) => o.value !== removeOptionValue); + } else if (removeOptionLabel) { + select.options = select.options.filter((o) => o.label !== removeOptionLabel); + } + } + }; + + let components = null; + let searchValue = null; + + if (message?.components) { + + const { MessageActionRow } = this.getDBM().DiscordJS; + const oldComponents = message.components; + const newComponents = []; + + for (let i = 0; i < oldComponents.length; i++) { + + const compData = oldComponents[i]; + const comps = (compData instanceof MessageActionRow) ? compData.toJSON() : compData; + + for (let j = 0; j < comps.components.length; j++) { + + const comp = comps.components[j]; + + switch (type) { + case "allSelects": { + if (comp.type === 3 || comp.type === "SELECT_MENU") { + onSelectMenuFound(comp); + } + break; + } + case "sourceSelect": { + if (comp.custom_id === sourceSelect) { + onSelectMenuFound(comp); + } + break; + } + case "findSelect": { + if (searchValue === null) { + searchValue = this.evalMessage(data.searchValue, cache); + } + if (comp.custom_id === searchValue || comp.customId === searchValue || comp.label === searchValue) { + onSelectMenuFound(comp); + } + break; + } + } + } + + newComponents.push(comps); + + } + + components = newComponents; + + } + + if (components) { + if (Array.isArray(message)) { + this.callListFunc(message, "edit", [{ components }]).then(() => this.callNextAction(cache)); + } else if (message?.edit) { + message + .edit({ components }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + if (message.components) { + message.components = components; + } + this.callNextAction(cache); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/find_channel.js b/French/actions/French/find_channel.js new file mode 100644 index 0000000..f1f69c3 --- /dev/null +++ b/French/actions/French/find_channel.js @@ -0,0 +1,165 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Rechercher un canal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = ["Channel ID", "Channel Name", "Channel Topic", "Channel Position", "Channel Category ID"]; + return `Find Channel by ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName, "Channel"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["info", "find", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Source Field
+ +
+
+ Search Value
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const server = cache.server; + if (!server?.channels) { + this.callNextAction(cache); + return; + } + const data = cache.actions[cache.index]; + const info = parseInt(data.info, 10); + const find = this.evalMessage(data.find, cache); + const channels = server.channels.cache.filter((c) => c.type === "GUILD_TEXT" || c.type === "GUILD_NEWS"); + let result; + switch (info) { + case 0: + result = channels.get(find); + break; + case 1: + result = channels.find((c) => c.name === find); + break; + case 2: + result = channels.find((c) => c.topic === find); + break; + case 3: + const position = parseInt(find, 10); + result = channels.find((c) => c.position === position); + break; + case 4: + result = channels.find((c) => c.parentId === find); + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/find_emoji.js b/French/actions/French/find_emoji.js new file mode 100644 index 0000000..1d6fc47 --- /dev/null +++ b/French/actions/French/find_emoji.js @@ -0,0 +1,183 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Trouver un Emoji personnalisé", + + //--------------------------------------------------------------------- + // Action Display Name + // + // Overrides the name that appears in the editor. + //--------------------------------------------------------------------- + + displayName: "Trouver un Emoji/autocollant personnalisé", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des Emoji/Autocollants", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const infoTexts = [ + "Emoji ID", + "Emoji Name", + "Sticker ID", + "Sticker Name", + ]; + const info = parseInt(data.info, 10); + return `Find ${info >= 2 ? "Sticker" : "Emoji"} by ${infoTexts[info]} (${data.find})`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + return [data.varName, info >= 2 ? "Sticker" : "Emoji"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["info", "find", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Source Field
+ +
+
+ Search Value
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const bot = this.getDBM().Bot.bot; + const server = cache.server; + + const info = parseInt(data.info, 10); + const find = this.evalMessage(data.find, cache); + + let result; + switch (info) { + case 0: + result = bot.emojis.cache.get(find); + break; + case 1: + result = bot.emojis.cache.find((e) => e.name === find); + break; + case 2: + if (server) { + result = server.stickers.cache.get(find); + } + if (result === undefined) { + try { + result = await bot.fetchSticker(find); + } catch(err) { + this.displayError(data, cache, err); + } + } + case 3: + if (server) { + result = server.stickers.cache.find((s) => s.name === find); + } + default: + break; + } + + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/find_member.js b/French/actions/French/find_member.js new file mode 100644 index 0000000..31efcc1 --- /dev/null +++ b/French/actions/French/find_member.js @@ -0,0 +1,165 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Trouver un membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = ["Member ID", "Member Username", "Member Display Name", "Member Color", "Member Tag"]; + return `Find Member by ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName, "Server Member"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["info", "find", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Source Field
+ +
+
+ Search Value
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const server = cache.server; + if (!server?.members) { + this.callNextAction(cache); + return; + } + const data = cache.actions[cache.index]; + const info = parseInt(data.info, 10); + const find = this.evalMessage(data.find, cache); + if (server.memberCount !== server.members.cache.size) server.members.fetch(); + const members = server.members.cache; + let result; + switch (info) { + case 0: + result = members.get(find); + break; + case 1: + result = members.find((m) => m.user?.username === find); + break; + case 2: + result = members.find((m) => m.displayName === find); + break; + case 3: + result = members.find((m) => m.displayHexColor === find); + break; + case 4: + result = members.find((m) => m.user?.tag === find); + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/find_role.js b/French/actions/French/find_role.js new file mode 100644 index 0000000..fcf046b --- /dev/null +++ b/French/actions/French/find_role.js @@ -0,0 +1,161 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Rechercher un rôle", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des rôles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = ["Role ID", "Role Name", "Role Color", "Role Position"]; + return `Find Role by ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName, "Role"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["info", "find", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Source Field
+ +
+
+ Search Value
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const server = cache.server; + if (!server || !server.roles) { + this.callNextAction(cache); + return; + } + const data = cache.actions[cache.index]; + const info = parseInt(data.info, 10); + const find = this.evalMessage(data.find, cache); + const roles = server.roles.cache; + let result; + switch (info) { + case 0: + result = roles.get(find); + break; + case 1: + result = roles.find((r) => r.name === find); + break; + case 2: + result = roles.find((r) => r.hexColor === find); + break; + case 3: + const position = parseInt(find, 10); + result = roles.find((r) => r.position === position); + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/find_server.js b/French/actions/French/find_server.js index b8b233e..2f56ae0 100644 --- a/French/actions/French/find_server.js +++ b/French/actions/French/find_server.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Trouver un serveur", + name: "Rechercher un serveur", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/find_thread.js b/French/actions/French/find_thread.js new file mode 100644 index 0000000..ab3dea7 --- /dev/null +++ b/French/actions/French/find_thread.js @@ -0,0 +1,161 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Rechercher un fil de discussion", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = ["Thread ID", "Thread Name"]; + return `Find Thread by ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName, "Thread Channel"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "channelVarName", "info", "find", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Source Field
+ +
+
+ Search Value
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const server = cache.server; + if (!server?.channels) { + this.callNextAction(cache); + return; + } + + const data = cache.actions[cache.index]; + const info = parseInt(data.info, 10); + const find = this.evalMessage(data.find, cache); + + const channel = await this.getChannelFromData(data.channel, data.channelVarName, cache); + + const threads = channel.threads.cache; + let result; + switch (info) { + case 0: + result = threads.get(find); + break; + case 1: + result = threads.find((c) => c.name === find); + break; + default: + break; + } + + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/find_voice_channel.js b/French/actions/French/find_voice_channel.js new file mode 100644 index 0000000..4591d6d --- /dev/null +++ b/French/actions/French/find_voice_channel.js @@ -0,0 +1,178 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Trouver un canal vocale", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Voice Channel ID", + "Voice Channel Name", + "Voice Channel Position", + "Voice Channel User Limit", + "Voice Channel Bitrate", + "Voice Channel Category ID", + ]; + return `Find Voice Channel by ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName, "Voice Channel"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["info", "find", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Source Field
+ +
+
+ Search Value
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const server = cache.server; + if (!server?.channels) { + this.callNextAction(cache); + return; + } + const data = cache.actions[cache.index]; + const info = parseInt(data.info, 10); + const find = this.evalMessage(data.find, cache); + const channels = server.channels.cache.filter((c) => c.type === "GUILD_VOICE"); + let result; + switch (info) { + case 0: + result = channels.get(find); + break; + case 1: + result = channels.find((c) => c.name === find); + break; + case 2: + const position = parseInt(find, 10); + result = channels.find((c) => c.position === position); + break; + case 3: + const userLimit = parseInt(find, 10); + result = channels.find((c) => c.userLimit === userLimit); + break; + case 4: + const bitrate = parseInt(find, 10) / 1000; + result = channels.find((c) => c.bitrate === bitrate); + break; + case 5: + result = channels.find((c) => c.parentId === find); + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/get_bot_as_member.js b/French/actions/French/get_bot_as_member.js index 0499947..dc4cc64 100644 --- a/French/actions/French/get_bot_as_member.js +++ b/French/actions/French/get_bot_as_member.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/go_to_anchor.js b/French/actions/French/go_to_anchor.js new file mode 100644 index 0000000..d7839ab --- /dev/null +++ b/French/actions/French/go_to_anchor.js @@ -0,0 +1,101 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Aller à l'ancrage d'action", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "D'autres choses", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return data.anchorName; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["anchorName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +Action Anchor Name +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const anchorName = this.evalMessage(data.anchorName, cache); + cache.goToAnchor(anchorName); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/image_effect.js b/French/actions/French/image_effect.js new file mode 100644 index 0000000..9445c6f --- /dev/null +++ b/French/actions/French/image_effect.js @@ -0,0 +1,162 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Appliquer un effet d'image", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Édition d'image", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storeTypes = presets.variables; + const effect = [ + "Greyscale", + "Invert", + "Normalize", + "Remove Transparency", + "Apply Minor Blur", + "Apply Major Blur", + "Apply Sepia", + "Dither", + ]; + return `${storeTypes[parseInt(data.storage, 10)]} (${data.varName}) -> ${effect[parseInt(data.effect, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "effect"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Effect
+
+
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const image = this.getVariable(storage, varName, cache); + if (!image) { + this.callNextAction(cache); + return; + } + const effect = parseInt(data.effect, 10); + switch (effect) { + case 0: + image.greyscale(); + break; + case 1: + image.invert(); + break; + case 2: + image.normalize(); + break; + case 3: + image.opaque(); + break; + case 4: + image.blur(2); + break; + case 5: + image.blur(10); + break; + case 6: + image.sepia(); + break; + case 7: + image.dither565(); + break; + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/join_voice_channel.js b/French/actions/French/join_voice_channel.js new file mode 100644 index 0000000..b12b228 --- /dev/null +++ b/French/actions/French/join_voice_channel.js @@ -0,0 +1,113 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Rejoignez la chaîne vocale", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle audio", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getVoiceChannelText(data.channel, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ``; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const Audio = this.getDBM().Audio; + + const channel = await this.getVoiceChannelFromData(data.channel, data.varName, cache); + if (channel) { + Audio.connectToVoice(channel); + } + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Requires Audio Libraries + // + // If 'true', this action requires audio libraries to run. + //--------------------------------------------------------------------- + + requiresAudioLibraries: true, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/kick_member.js b/French/actions/French/kick_member.js index adeb813..52f6678 100644 --- a/French/actions/French/kick_member.js +++ b/French/actions/French/kick_member.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Expulser Membre", + name: "Expulser un membre", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/leave_voice_channel.js b/French/actions/French/leave_voice_channel.js new file mode 100644 index 0000000..0dc62b4 --- /dev/null +++ b/French/actions/French/leave_voice_channel.js @@ -0,0 +1,100 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Quitter le canal vocal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle audio", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return "The bot leaves voice channel."; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: [], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ""; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const server = cache.server; + const { Audio } = this.getDBM(); + if (server) Audio.disconnectFromVoice(server); + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/loop_through_all_servers.js b/French/actions/French/loop_through_all_servers.js new file mode 100644 index 0000000..85d02d2 --- /dev/null +++ b/French/actions/French/loop_through_all_servers.js @@ -0,0 +1,168 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Boucle sur tous les serveurs", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Listes et boucles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `Loop through every server and run ${data.actions?.length ?? 0} actions.`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["type", "actions"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +Call Type
+ + +

+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Pre-Init Code + // + // Before the fields from existing data in this action are applied + // to the user interface, this function is called if it exists. + // The existing data is provided, and a modified version can be + // returned. The returned version will be used if provided. + // This is to help provide compatibility with older versions of the action. + // + // The "formatters" argument contains built-in functions for formatting + // the data required for official DBM action compatibility. + //--------------------------------------------------------------------- + + preInit(data, formatters) { + return formatters.compatibility_2_0_3_loopevent_to_actions(data); + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const bot = this.getDBM().Bot.bot; + + const actions = data.actions; + if (!actions || actions.length <= 0) { + this.callNextAction(cache); + return; + } + + const waitForCompletion = data.type === "true"; + + const servers = [...bot.guilds.cache.values()]; + const act = actions[0]; + if (act && this.exists(act.name)) { + const looper = (i) => { + if (!servers[i]) { + if (waitForCompletion) this.callNextAction(cache); + return; + } + + this.executeSubActions(actions, cache, () => looper(i + 1)); + }; + + looper(0); + + if (!waitForCompletion) this.callNextAction(cache); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data) { + this.prepareActions(data.actions); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/loop_through_list.js b/French/actions/French/loop_through_list.js new file mode 100644 index 0000000..b2cdab6 --- /dev/null +++ b/French/actions/French/loop_through_list.js @@ -0,0 +1,252 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Liste en boucle", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Listes et boucles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const list = presets.lists; + return `Loop ${list[parseInt(data.list, 10)]} through ${data.actions?.length ?? 0} actions.`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["list", "varName", "tempVarName", "type", "actions"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +
+
+
+ Source List
+ +
+
+ Variable Name
+ +
+
+
+
+ + +
+
+
+ Temp Var. Name (stores member)
+ +
+ +
+ Call Type
+ +
+
+
+
+
+ +







+ + + +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob, document } = this; + + glob.onChange1 = function (event) { + this.listChange(event, "varNameContainer"); + const id = parseInt(event.value, 10); + let result = ""; + switch (id) { + case 0: + result = "member"; + break; + case 1: + result = "channel"; + break; + case 4: + result = "server"; + break; + case 2: + case 5: + case 6: + result = "role"; + break; + case 3: + result = "emoji"; + break; + case 7: + case 8: + case 9: + result = "item"; + break; + } + document.getElementById("tempName").innerHTML = result; + }; + + glob.onChange1(document.getElementById("list")); + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + + const actions = data.actions; + if (!actions) { + this.callNextAction(cache); + return; + } + + const list = await this.getListFromData(data.list, data.varName, cache); + + const waitForCompletion = data.type === "true"; + + const act = actions[0]; + if (act && this.exists(act.name)) { + const looper = (i) => { + if (!list[i]) { + if (waitForCompletion) { + this.callNextAction(cache); + } + return; + } + + this.storeValue(list[i], 1, data.tempVarName, cache); + this.executeSubActions(actions, cache, () => looper(i + 1)); + }; + + looper(0); + + if (!waitForCompletion) { + this.callNextAction(cache); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data) { + this.prepareActions(data.actions); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/loop_through_numbers.js b/French/actions/French/loop_through_numbers.js new file mode 100644 index 0000000..b2a942b --- /dev/null +++ b/French/actions/French/loop_through_numbers.js @@ -0,0 +1,227 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Boucler les nombres", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Listes et boucles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + if (Math.abs(parseInt(data.increment, 10)) === 1) { + return `Call ${data.actions?.length ?? 0} actions ${Math.abs(data.endNum - data.startNum) + 1} times.` + } + return `Call ${data.actions?.length ?? 0} actions while counting by ${data.increment}, from ${data.startNum} to ${data.endNum}.`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["startNum", "endNum", "increment", "tempVarName", "type", "actions"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +
+
+
+ Start Number
+ +
+ +
+ End Number
+ +
+ +
+ Increment By
+ +
+
+
+
+ + +
+
+
+ Temp Var. Name (stores number)
+ +
+ +
+ Call Type
+ +
+
+
+
+
+ +







+ + + +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + + const actions = data.actions; + if (!actions || actions.length <= 0) { + this.callNextAction(cache); + return; + } + + const startNumText = this.evalMessage(data.startNum, cache); + const endNumText = this.evalMessage(data.endNum, cache); + const incrementText = this.evalMessage(data.increment, cache); + let startNum = parseInt(startNumText, 10); + let endNum = parseInt(endNumText, 10); + let increment = parseInt(incrementText, 10); + + let valid = isNaN(startNum) ? 1 : (isNaN(endNum) ? 2 : (isNaN(increment) ? 3 : 0)); + if (valid === 0) { + if (increment === 0) { + valid = 4; + } else if (increment > 0 && startNum > endNum) { + valid = 5; + } else if (increment < 0 && startNum < endNum) { + valid = 6; + } + } + + switch (valid) { + case 1: { this.displayError(data, cache, `Start Number (${startNumText}) is not a valid number.`); break; } + case 2: { this.displayError(data, cache, `End Number (${endNumText}) is not a valid number.`); break; } + case 3: { this.displayError(data, cache, `Increment (${incrementText}) is not a valid number.`); break; } + case 4: { this.displayError(data, cache, `Increment cannot be 0.`); break; } + case 5: + case 6: { this.displayError(data, cache, `Increment detected to cause infinite loop.`); break; } + } + + if (valid !== 0) { + this.callNextAction(cache); + return; + } + + const waitForCompletion = data.type === "true"; + + const looper = (i) => { + if ((startNum < endNum && i > endNum) || (startNum > endNum && i < endNum)) { + if (waitForCompletion) { + this.callNextAction(cache); + } + return; + } + + this.storeValue(i, 1, data.tempVarName, cache); + this.executeSubActions(actions, cache, () => looper(i + increment)); + }; + + looper(startNum); + + if (!waitForCompletion) { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data) { + this.prepareActions(data.actions); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/multi_check_variable.js b/French/actions/French/multi_check_variable.js new file mode 100644 index 0000000..4e36664 --- /dev/null +++ b/French/actions/French/multi_check_variable.js @@ -0,0 +1,226 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Variable à contrôle multiple", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Conditions", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `Check ${presets.getVariableText(data.storage, data.varName)} with ${data.branches.length} Branches`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "branches"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ + +
+
+ Comparison Type
+ +
+
+ Value to Compare to
+ +
+ +



+ + + +
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob } = this; + + glob.formatItem = function (data) { + let result = '
VAR '; + const comp = data.comparison; + switch (comp) { + case "0": + result += "Exists"; + break; + case "1": + result += "= " + data.value; + break; + case "2": + result += "= " + data.value; + break; + case "3": + result += "< " + data.value; + break; + case "4": + result += "> " + data.value; + break; + case "5": + result += "Includes " + data.value; + break; + case "6": + result += "Matches Regex " + data.value; + break; + } + result += "
Call " + data.actions.length + " Actions"; + return result; + }; + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const type = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const variable = this.getVariable(type, varName, cache); + let result = false; + if (variable) { + const val1 = variable; + const branches = data.branches; + for (let i = 0; i < branches.length; i++) { + const branch = branches[i]; + const compare = parseInt(branch.comparison, 10); + let val2 = branch.value; + if (compare !== 6) val2 = this.evalIfPossible(val2, cache); + switch (compare) { + case 0: + result = val1 !== undefined; + break; + case 1: + result = val1 == val2; + break; + case 2: + result = val1 === val2; + break; + case 3: + result = val1 < val2; + break; + case 4: + result = val1 > val2; + break; + case 5: + if (typeof val1.includes === "function") { + result = val1.includes(val2); + } + break; + case 6: + result = Boolean(val1.match(new RegExp("^" + val2 + "$", "i"))); + break; + } + if (result) { + this.executeSubActionsThenNextAction(branch.actions, cache); + break; + } + } + } + if (!result) { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod Init + // + // An optional function for action mods. Upon the bot's initialization, + // each command/event's actions are iterated through. This is to + // initialize responses to interactions created within actions + // (e.g. buttons and select menus for Send Message). + // + // If an action provides inputs for more actions within, be sure + // to call the `this.prepareActions` function to ensure all actions are + // recursively iterated through. + //--------------------------------------------------------------------- + + modInit(data) { + if (Array.isArray(data?.branches)) { + for (let i = 0; i < data.branches.length; i++) { + const branch = data.branches[i]; + this.prepareActions(branch.actions); + } + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/pin_message.js b/French/actions/French/pin_message.js index dcfd5ef..2f708a4 100644 --- a/French/actions/French/pin_message.js +++ b/French/actions/French/pin_message.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Messages", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/remove_buttons_select.js b/French/actions/French/remove_buttons_select.js new file mode 100644 index 0000000..d298496 --- /dev/null +++ b/French/actions/French/remove_buttons_select.js @@ -0,0 +1,233 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Supprimer les boutons et les sélections", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMessageText(data.storage, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "type", "searchValue"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +



+ +
+ Components to Remove
+ +
+ +
+ Component Label/ID
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob } = this; + + glob.onButtonSelectTypeChange = function (event) { + const input = document.getElementById("nameContainer"); + input.style.display = event.value === "findButton" || event.value === "findSelect" ? null : "none"; + }; + + glob.onButtonSelectTypeChange(document.getElementById("type")); + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = await this.getMessageFromData(data.storage, data.varName, cache); + + const type = data.type; + + let sourceButton = null; + if (cache.interaction.isButton()) { + sourceButton = cache.interaction.customId; + } + + let sourceSelect = null; + if (cache.interaction.isSelectMenu()) { + sourceSelect = cache.interaction.customId; + } + + let components = null; + + let searchValue = null; + + const messageId = message.id; + if (type === "all") { + + components = []; + this.clearAllTemporaryInteractions(messageId); + + } else if (message?.components) { + + const { MessageActionRow } = this.getDBM().DiscordJS; + const oldComponents = message.components; + const newComponents = []; + + for (let i = 0; i < oldComponents.length; i++) { + + const compData = oldComponents[i]; + const comps = (compData instanceof MessageActionRow) ? compData.toJSON() : compData; + const newComps = []; + + for (let j = 0; j < comps.components.length; j++) { + + const comp = comps.components[j]; + let deleted = false; + const id = comp.custom_id ?? comp.customId; + + switch (type) { + case "allButtons": { + if (comp.type !== 2 || comp.type === "BUTTON") newComps.push(comp); + else deleted = true; + break; + } + case "allSelects": { + if (comp.type !== 3 || comp.type === "SELECT_MENU") newComps.push(comp); + else deleted = true; + break; + } + case "sourceButton": { + if (id !== sourceButton) newComps.push(comp); + else deleted = true; + break; + } + case "sourceSelect": { + if (id !== sourceSelect) newComps.push(comp); + else deleted = true; + break; + } + case "findButton": + case "findSelect": { + if (searchValue === null) searchValue = this.evalMessage(data.searchValue, cache); + if (id !== searchValue && comp.label !== searchValue) newComps.push(comp); + else deleted = true; + break; + } + } + + if (deleted) { + this.clearTemporaryInteraction(messageId, id); + } + } + + comps.components = newComps; + if (newComps.length > 0) newComponents.push(comps); + + } + components = newComponents; + } + + if (components) { + if (Array.isArray(message)) { + this.callListFunc(message, "edit", [{ components }]).then(() => this.callNextAction(cache)); + } else if (cache.interaction?.message?.id === message?.id && cache.interaction?.update && !cache.interaction?.replied) { + cache.interaction + .update({ components }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else if (message?.edit) { + message + .edit({ components }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + if (message.components) { + message.components = components; + } + this.callNextAction(cache); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/remove_item_from_list.js b/French/actions/French/remove_item_from_list.js new file mode 100644 index 0000000..12f9416 --- /dev/null +++ b/French/actions/French/remove_item_from_list.js @@ -0,0 +1,177 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Supprimer un élément de la liste", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Listes et boucles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storage = presets.variables; + return `Remove Item from ${storage[parseInt(data.storage, 10)]} (${data.varName})`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage2, 10); + if (type !== varType) return; + return [data.varName2, "Unknown Type"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "removeType", "position", "storage2", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Remove Type
+ +
+ +



+`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() { + const { glob, document } = this; + + glob.onChange1 = function (event) { + const value = parseInt(event.value, 10); + const dom = document.getElementById("positionHolder"); + if (value < 2) { + dom.style.display = "none"; + } else { + dom.style.display = null; + } + }; + + glob.onChange1(document.getElementById("removeType")); + }, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const list = this.getVariable(storage, varName, cache); + + const type = parseInt(data.removeType, 10); + + let result = null; + switch (type) { + case 0: + result = list.pop(); + break; + case 1: + result = list.shift(); + break; + case 2: + const position = parseInt(this.evalMessage(data.position, cache), 10); + if (position < 0) { + result = list.shift(); + } else if (position >= list.length) { + result = list.pop(); + } else { + result = list[position]; + list.splice(position, 1); + } + break; + } + + if (result) { + const varName2 = this.evalMessage(data.varName2, cache); + const storage2 = parseInt(data.storage2, 10); + this.storeValue(result, storage2, varName2, cache); + } + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/remove_member_role.js b/French/actions/French/remove_member_role.js new file mode 100644 index 0000000..9485e88 --- /dev/null +++ b/French/actions/French/remove_member_role.js @@ -0,0 +1,126 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Supprimer le rôle d'un membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMemberText(data.member, data.varName2)} - ${presets.getRoleText(data.role, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName2", "role", "varName", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const role = await this.getRoleFromData(data.role, data.varName, cache); + const member = await this.getMemberFromData(data.member, data.varName2, cache); + const reason = this.evalMessage(data.reason, cache); + if (Array.isArray(member)) { + this.callListFunc( + member.map((m) => m.roles), + "remove", + [role, reason], + ).then(() => this.callNextAction(cache)); + } else if (member?.roles) { + member.roles + .remove(role, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/resize_image.js b/French/actions/French/resize_image.js new file mode 100644 index 0000000..095c6e1 --- /dev/null +++ b/French/actions/French/resize_image.js @@ -0,0 +1,135 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Redimensionner l'image", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Édition d'image", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storeTypes = presets.variables; + return `${storeTypes[parseInt(data.storage, 10)]} (${data.varName}) -> [${data.width}, ${data.height}]`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "width", "height"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ New Width (direct size or percent)
+
+
+
+ New Height (direct size or percent)
+
+
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const image = this.getVariable(storage, varName, cache); + if (!image) { + this.callNextAction(cache); + return; + } + let width = this.evalMessage(data.width, cache); + let height = this.evalMessage(data.height, cache); + if (width.endsWith("%")) { + const percent = width.replace("%", ""); + width = image.bitmap.width * (parseInt(percent, 10) / 100); + } else { + width = parseInt(width, 10); + } + if (height.endsWith("%")) { + const percent = height.replace("%", ""); + height = image.bitmap.height * (parseInt(percent, 10) / 100); + } else { + height = parseInt(height, 10); + } + image.resize(width, height); + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/rotate_image.js b/French/actions/French/rotate_image.js new file mode 100644 index 0000000..c08d894 --- /dev/null +++ b/French/actions/French/rotate_image.js @@ -0,0 +1,145 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Faire pivoter l'image", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Édition d'image", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storeTypes = presets.variables; + const mirror = ["No Mirror", "Horizontal Mirror", "Vertical Mirror", "Diagonal Mirror"]; + return `${storeTypes[parseInt(data.storage, 10)]} (${data.varName}) -> [${mirror[parseInt(data.mirror, 10)]} ~ ${ + data.rotation + }°]`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "rotation", "mirror"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Mirror
+
+
+
+ Rotation (degrees)
+
+
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const image = this.getVariable(storage, varName, cache); + if (!image) { + this.callNextAction(cache); + return; + } + const mirror = parseInt(data.mirror, 10); + switch (mirror) { + case 0: + image.mirror(false, false); + break; + case 1: + image.mirror(true, false); + break; + case 2: + image.mirror(false, true); + break; + case 3: + image.mirror(true, true); + break; + } + const rotation = parseInt(data.rotation, 10); + image.rotate(rotation); + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/run_script.js b/French/actions/French/run_script.js index 52eab1b..31bf0b8 100644 --- a/French/actions/French/run_script.js +++ b/French/actions/French/run_script.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Lancer Script", + name: "Lancer un Script", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/send_embed_message.js b/French/actions/French/send_embed_message.js new file mode 100644 index 0000000..360b440 --- /dev/null +++ b/French/actions/French/send_embed_message.js @@ -0,0 +1,148 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Envoyer un message intégré", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Message Intégrer", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getSendTargetText(data.channel, data.varName2)}: ${data.varName}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "channel", "varName2", "storage3", "varName3"], + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage3, 10); + if (type !== varType) return; + return [data.varName3, "Message"]; + }, + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +


+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const embed = this.getVariable(storage, varName, cache); + if (!embed) { + return this.callNextAction(cache); + } + + const target = await this.getSendTargetFromData(data.channel, data.varName2, cache); + + const varName3 = this.evalMessage(data.varName3, cache); + const storage3 = parseInt(data.storage3, 10); + + if (Array.isArray(target)) { + this.callListFunc(target, "send", [{ embeds: [embed] }]).then(() => this.callNextAction(cache)); + } else if (target?.send) { + target + .send({ embeds: [embed] }) + .then((msg) => { + if (varName3) this.storeValue(msg, storage3, varName3, cache); + this.callNextAction(cache); + }) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/send_file.js b/French/actions/French/send_file.js new file mode 100644 index 0000000..3d366f3 --- /dev/null +++ b/French/actions/French/send_file.js @@ -0,0 +1,132 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Envoyer un fichier", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const channels = presets.sendTargets; + return `${channels[parseInt(data.channel, 10)]}: "${data.message.replace(/[\n\r]+/, "")}"`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName", "file", "message"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Local File URL
+
+
+ +
+ Message
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const { DiscordJS } = this.getDBM(); + const message = data.message; + if (!data.channel || !message) { + return this.callNextAction(cache); + } + + const target = await this.getSendTargetFromData(data.channel, data.varName, cache); + + const file = new DiscordJS.MessageAttachment(this.getLocalFile(this.evalMessage(data.file, cache))); + const options = { content: this.evalMessage(message, cache), files: [file] }; + + if (Array.isArray(target)) { + this.callListFunc(target, "send", [options]).then(() => this.callNextAction(cache)); + } else if (target?.send) { + target + .send(options) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/send_image.js b/French/actions/French/send_image.js new file mode 100644 index 0000000..3ecb630 --- /dev/null +++ b/French/actions/French/send_image.js @@ -0,0 +1,169 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Envoyer l'image", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Édition d'image", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getSendTargetText(data.channel, data.varName2)}: ${data.varName}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "channel", "varName2", "message", "storage2", "varName3"], + + //--------------------------------------------------------------------- + // Action Storage Function << added + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage2, 10); + if (type !== varType) return; + return [data.varName3, "Message"]; + }, + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +


+ +
+ Message
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const { DiscordJS, Images } = this.getDBM(); + + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const image = this.getVariable(storage, varName, cache); + if (!image) { + this.callNextAction(cache); + return; + } + + const target = await this.getSendTargetFromData(data.channel, data.varName2, cache); + + const varName3 = this.evalMessage(data.varName3, cache); + const storage2 = parseInt(data.storage2, 10); + + if (!Array.isArray(target) && !target?.send) return this.callNextAction(cache); + Images.createBuffer(image) + .then((buffer) => { + if (Array.isArray(target)) { + this.callListFunc(target, "send", [ + { + content: this.evalMessage(data.message, cache), + files: [new DiscordJS.MessageAttachment(buffer, "image.png")], + }, + ]) + .then((msg) => { + this.storeValue(msg, storage2, varName3, cache); + this.callNextAction(cache); + }) + .catch((err) => this.displayError(data, cache, err)); + } else if (target?.send) { + target + .send({ + content: this.evalMessage(data.message, cache), + files: [new DiscordJS.MessageAttachment(buffer, "image.png")], + }) + .then((msg) => { + this.storeValue(msg, storage2, varName3, cache); + this.callNextAction(cache); + }) + .catch((err) => this.displayError(data, cache, err)); + } + }) + .catch((err) => this.displayError(data, cache, err)); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/send_message.js b/French/actions/French/send_message.js index 7bd59ae..c6ca9d4 100644 --- a/French/actions/French/send_message.js +++ b/French/actions/French/send_message.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Messagerie", + section: "Messages", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/send_tts_message.js b/French/actions/French/send_tts_message.js new file mode 100644 index 0000000..f74d2af --- /dev/null +++ b/French/actions/French/send_tts_message.js @@ -0,0 +1,150 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Envoyer un message TTS", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getSendTargetText(data.channel, data.varName)}: "${data.message.replace(/[\n\r]+/, "")}"`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName2, "Message"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName", "message", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Message
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = data.message; + if (!data.channel || !message) { + return this.callNextAction(cache); + } + + const target = await this.getSendTargetFromData(data.channel, data.varName, cache); + + if (Array.isArray(target)) { + this.callListFunc(target, "send", [{ content: this.evalMessage(message, cache), tts: true }]).then( + (resultMsg) => { + const varName2 = this.evalMessage(data.varName2, cache); + const storage = parseInt(data.storage, 10); + this.storeValue(resultMsg, storage, varName2, cache); + this.callNextAction(cache); + }, + ); + } else if (target?.send) { + target + .send({ content: this.evalMessage(message, cache), tts: true }) + .then((resultMsg) => { + const varName2 = this.evalMessage(data.varName2, cache); + const storage = parseInt(data.storage, 10); + this.storeValue(resultMsg, storage, varName2, cache); + this.callNextAction(cache); + }) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_audio_volume.js b/French/actions/French/set_audio_volume.js index f01870e..1530ffa 100644 --- a/French/actions/French/set_audio_volume.js +++ b/French/actions/French/set_audio_volume.js @@ -22,7 +22,7 @@ module.exports = { //--------------------------------------------------------------------- subtitle(data, presets) { - return `Set Volume to ${data.volume}`; + return `Réglez le volume sur ${data.volume}`; }, //--------------------------------------------------------------------- diff --git a/French/actions/French/set_bot_afk.js b/French/actions/French/set_bot_afk.js index 7206be0..5187646 100644 --- a/French/actions/French/set_bot_afk.js +++ b/French/actions/French/set_bot_afk.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/set_bot_avatar.js b/French/actions/French/set_bot_avatar.js index c8770f0..d9fa949 100644 --- a/French/actions/French/set_bot_avatar.js +++ b/French/actions/French/set_bot_avatar.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/set_bot_game.js b/French/actions/French/set_bot_game.js index 80f127b..fa2515e 100644 --- a/French/actions/French/set_bot_game.js +++ b/French/actions/French/set_bot_game.js @@ -13,7 +13,7 @@ module.exports = { // Overrides the name that appears in the editor. //--------------------------------------------------------------------- - displayName: "Contrôle du clients bot", + displayName: "Set Bot Activity", //--------------------------------------------------------------------- // Action Section @@ -21,7 +21,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/set_bot_nickname.js b/French/actions/French/set_bot_nickname.js index d5bb774..8ceb643 100644 --- a/French/actions/French/set_bot_nickname.js +++ b/French/actions/French/set_bot_nickname.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/set_bot_status.js b/French/actions/French/set_bot_status.js index e42c4dd..3ab4fcd 100644 --- a/French/actions/French/set_bot_status.js +++ b/French/actions/French/set_bot_status.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/set_bot_username.js b/French/actions/French/set_bot_username.js index 06c8f6c..e6e7821 100644 --- a/French/actions/French/set_bot_username.js +++ b/French/actions/French/set_bot_username.js @@ -13,7 +13,7 @@ module.exports = { // This is the section the action will fall into. //--------------------------------------------------------------------- - section: "Contrôle du clients bot", + section: "Contrôle du client bot", //--------------------------------------------------------------------- // Action Subtitle diff --git a/French/actions/French/set_channel_permissions.js b/French/actions/French/set_channel_permissions.js new file mode 100644 index 0000000..beeeecc --- /dev/null +++ b/French/actions/French/set_channel_permissions.js @@ -0,0 +1,145 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir les autorisations du canal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getChannelText(data.storage, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "permission", "state", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Permission
+ +
+
+ Change To
+ +
+
+ +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const server = cache.server; + if (!server) { + this.callNextAction(cache); + return; + } + const channel = await this.getChannelFromData(data.storage, data.varName, cache); + const reason = this.evalMessage(data.reason, cache); + const options = { [data.permission]: [true, false, null][parseInt(data.state, 10)] }; + + if (Array.isArray(channel)) { + this.callListFunc(channel.permissionOverwrites, "edit", [server.id, options, { reason, type: 0 }]).then(() => + this.callNextAction(cache), + ); + } else if (channel?.permissionOverwrites) { + channel.permissionOverwrites + .edit(server.id, options, { reason, type: 0 }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_embed_description.js b/French/actions/French/set_embed_description.js new file mode 100644 index 0000000..3587f51 --- /dev/null +++ b/French/actions/French/set_embed_description.js @@ -0,0 +1,108 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir la description intégrée", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Message Intégrer", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.message}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "message"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +


+ +
+ Description
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const embed = this.getVariable(storage, varName, cache); + embed?.setDescription?.(this.evalMessage(data.message, cache)); + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_embed_footer.js b/French/actions/French/set_embed_footer.js new file mode 100644 index 0000000..c967200 --- /dev/null +++ b/French/actions/French/set_embed_footer.js @@ -0,0 +1,117 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir le pied de page intégré", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Message Intégrer", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${data.message}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["storage", "varName", "message", "footerIcon"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Footer
+ +

+
+ Footer Icon URL
+
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + const embed = this.getVariable(storage, varName, cache); + embed?.setFooter?.({ + text: this.evalMessage(data.message, cache), + iconURL: this.evalMessage(data.footerIcon, cache), + }); + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_member_channel_perms.js b/French/actions/French/set_member_channel_perms.js new file mode 100644 index 0000000..1f2a573 --- /dev/null +++ b/French/actions/French/set_member_channel_perms.js @@ -0,0 +1,150 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir les autorisations d'un membre sur un canal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getChannelText(data.channel, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName", "member", "varName2", "permission", "state", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +


+ +
+
+ Permission
+ +
+
+ Change To
+ +
+
+ +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const channel = await this.getChannelFromData(data.channel, data.varName, cache); + const member = await this.getMemberFromData(data.member, data.varName2, cache); + const reason = this.evalMessage(data.reason, cache); + + const options = { [data.permission]: [true, null, false][parseInt(data.state, 10)] }; + + if (member?.id) { + if (Array.isArray(channel)) { + this.callListFunc(channel.permissionOverwrites, "edit", [member, options, { reason, type: 1 }]).then(() => + this.callNextAction(cache), + ); + } else if (channel?.permissionOverwrites) { + channel.permissionOverwrites + .edit(member, options, { reason, type: 1 }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_member_deafen.js b/French/actions/French/set_member_deafen.js new file mode 100644 index 0000000..f5d3270 --- /dev/null +++ b/French/actions/French/set_member_deafen.js @@ -0,0 +1,131 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Mettre en sourdine un membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMemberText(data.member, data.varName)} - ${data.deafen === "0" ? "Deafen" : "Undeafen"}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "deafen", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Deafen Status
+ +
+ +
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + const reason = this.evalMessage(data.reason, cache); + if (Array.isArray(member)) { + this.callListFunc( + member.map((m) => m.voice), + "setDeaf", + [data.deafen === "0", reason], + ).then(() => this.callNextAction(cache)); + } else if (member?.voice) { + member.voice + .setDeaf(data.deafen === "0", reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_member_mute.js b/French/actions/French/set_member_mute.js new file mode 100644 index 0000000..3cf4a01 --- /dev/null +++ b/French/actions/French/set_member_mute.js @@ -0,0 +1,131 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Muter un membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMemberText(data.member, data.varName)} - ${data.mute === "0" ? "Mute" : "Unmute"}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "mute", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Mute Status
+ +
+ +
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + const reason = this.evalMessage(data.reason, cache); + if (Array.isArray(member)) { + this.callListFunc( + member.map((m) => m.voice), + "setMute", + [data.mute === "0", reason], + ).then(() => this.callNextAction(cache)); + } else if (member?.voice) { + member.voice + .setMute(data.mute === "0", reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_member_nickname.js b/French/actions/French/set_member_nickname.js new file mode 100644 index 0000000..cbf9c75 --- /dev/null +++ b/French/actions/French/set_member_nickname.js @@ -0,0 +1,123 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir le surnom du membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMemberText(data.member, data.varName)} - ${data.nickname}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "nickname", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ New Nickname
+
+
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + const nick = this.evalMessage(data.nickname, cache) || null; + const reason = this.evalMessage(data.reason, cache); + if (Array.isArray(member)) { + this.callListFunc(member, "setNickname", [nick, reason]).then(() => this.callNextAction(cache)); + } else if (member?.setNickname) { + member + .setNickname(nick, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_member_voice_channel.js b/French/actions/French/set_member_voice_channel.js new file mode 100644 index 0000000..ac476d1 --- /dev/null +++ b/French/actions/French/set_member_voice_channel.js @@ -0,0 +1,131 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir le canal vocal du membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMemberText(data.member, data.varName)} - ${presets.getVoiceChannelText( + data.channel, + data.varName2, + )}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "channel", "varName2", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + const channel = await this.getVoiceChannelFromData(data.channel, data.varName2, cache); + const reason = this.evalMessage(data.reason, cache); + + if (Array.isArray(member)) { + this.callListFunc( + member.map((m) => m.voice), + "setChannel", + [channel, reason], + ).then(() => this.callNextAction(cache)); + } else if (member?.voice) { + member.voice + .setChannel(channel, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + this.callNextAction(cache); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_role_channel_perms.js b/French/actions/French/set_role_channel_perms.js new file mode 100644 index 0000000..de4cbb7 --- /dev/null +++ b/French/actions/French/set_role_channel_perms.js @@ -0,0 +1,150 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir les autorisations du canal de rôle", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getRoleText(data.role, data.varName2)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName", "role", "varName2", "permission", "state", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +


+ +
+
+ Permission
+ +
+
+ Change To
+ +
+
+ +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const channel = await this.getChannelFromData(data.channel, data.varName, cache); + const role = await this.getRoleFromData(data.role, data.varName2, cache); + const reason = this.evalMessage(data.reason, cache); + + const options = { [data.permission]: [true, null, false][parseInt(data.state, 10)] }; + + if (role?.id) { + if (Array.isArray(channel)) { + this.callListFunc(channel.permissionOverwrites, "edit", [role, options, { reason, type: 0 }]).then(() => + this.callNextAction(cache), + ); + } else if (channel?.permissionOverwrites) { + channel.permissionOverwrites + .edit(role, options, { reason, type: 0 }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_role_icon.js b/French/actions/French/set_role_icon.js new file mode 100644 index 0000000..c3289b7 --- /dev/null +++ b/French/actions/French/set_role_icon.js @@ -0,0 +1,153 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir l’icône du rôle", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des rôles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `Set Icon of ${presets.getRoleText(data.role, data.roleVarName)} to ${presets.getVariableText(data.image, data.imageVarName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["role", "roleVarName", "image", "imageVarName", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+

+ Note:
+ Role icons only work in servers with a high enough boost level. If you are having issues, please ensure you are able to set role icons yourself before attempting with the bot. +

+
+ +
+ +
+ +
+ + + +



+ + + +



+ +Reason +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const reason = this.evalMessage(data.reason, cache); + const role = await this.getRoleFromData(data.role, data.roleVarName, cache); + + const imageStorage = parseInt(data.image, 10); + const imageVarName = this.evalMessage(data.imageVarName, cache); + var imageOrEmoji = this.getVariable(imageStorage, imageVarName, cache); + + const Images = this.getDBM().Images; + const DiscordJS = this.getDBM().DiscordJS; + + if (Images.isImage(imageOrEmoji)) { + imageOrEmoji = await Images.createBuffer(imageOrEmoji); + } else if (imageOrEmoji instanceof DiscordJS.Emoji) { + // do nothing, setIcon accepts Emoji class + } else if (typeof imageOrEmoji === "string") { + if (imageOrEmoji.startsWith("http")) { + imageOrEmoji = await Images.getImage(image); + } else { + // otherwise, the string could be Emoji-resolvable, so do nothing + } + } + + if (Array.isArray(role)) { + this.callListFunc(role, "setIcon", [imageOrEmoji, reason]) + .then(() => this.callNextAction(cache)); + } else if (role?.setIcon) { + role + .setIcon(imageOrEmoji, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_server_icon.js b/French/actions/French/set_server_icon.js new file mode 100644 index 0000000..570e568 --- /dev/null +++ b/French/actions/French/set_server_icon.js @@ -0,0 +1,138 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir l'icône du serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle du serveur", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storeTypes = presets.variables; + return `${presets.getServerText(data.server, data.varName)} - ${storeTypes[parseInt(data.storage, 10)]} (${ + data.varName2 + })`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "storage", "varName2", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ + + +



+ +
+ +
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const { Images } = this.getDBM(); + const server = await this.getServerFromData(data.server, data.varName, cache); + const reason = this.evalMessage(data.reason, cache); + + if (!Array.isArray(server) && !server?.setIcon) { + return this.callNextAction(cache); + } + + const varName2 = this.evalMessage(data.varName2, cache); + const image = this.getVariable(parseInt(data.storage, 10), varName2, cache); + Images.createBuffer(image) + .then((buffer) => { + if (Array.isArray(server)) { + this.callListFunc(server, "setIcon", [buffer, reason]).then(() => this.callNextAction(cache)); + } else { + server + .setIcon(buffer, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } + }) + .catch((err) => this.displayError(data, cache, err)); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_server_name.js b/French/actions/French/set_server_name.js new file mode 100644 index 0000000..b9e0314 --- /dev/null +++ b/French/actions/French/set_server_name.js @@ -0,0 +1,125 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir le nom du serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle du serveur", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getServerText(data.server, data.varName)} - ${data.serverName}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "serverName", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Server Name
+ +
+ +
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const server = await this.getServerFromData(data.server, data.varName, cache); + const name = this.evalMessage(data.serverName, cache); + const reason = this.evalMessage(data.reason, cache); + if (Array.isArray(server)) { + this.callListFunc(server, "setName", [name, reason]).then(() => this.callNextAction(cache)); + } else if (server?.setName) { + server + .setName(name, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_server_region.js b/French/actions/French/set_server_region.js new file mode 100644 index 0000000..f217d6c --- /dev/null +++ b/French/actions/French/set_server_region.js @@ -0,0 +1,127 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir la région du serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle du serveur", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getServerText(data.server, data.varName)} - ${data.region}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "region", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Server Region
+ +
+ +
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_server_splash.js b/French/actions/French/set_server_splash.js new file mode 100644 index 0000000..e8c99b6 --- /dev/null +++ b/French/actions/French/set_server_splash.js @@ -0,0 +1,140 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir l'écran de démarrage du serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle du serveur", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storeTypes = presets.variables; + return `${presets.getServerText(data.server, data.varName)} - ${storeTypes[parseInt(data.storage, 10)]} (${ + data.varName2 + })`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "storage", "varName2", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+

+ Note:
+ Discord Splash Screens are only available to Discord Partners or for servers with boost level 1 or higher.
+ For more information, check out this or this. +

+
+ +
+ + + +


+ + + +


+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const { Images } = this.getDBM(); + const server = await this.getServerFromData(data.server, data.varName, cache); + const reason = this.evalMessage(data.reason, cache); + if (!Array.isArray(server) && !server?.setSplash) return this.callNextAction(cache); + const varName2 = this.evalMessage(data.varName2, cache); + const image = this.getVariable(parseInt(data.storage, 10), varName2, cache); + Images.createBuffer(image) + .then((buffer) => { + if (Array.isArray(server)) { + this.callListFunc(server, "setSplash", [buffer, reason]).then(() => this.callNextAction(cache)); + } else { + server + .setSplash(buffer, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } + }) + .catch((err) => this.displayError(data, cache, err)); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/set_server_verification.js b/French/actions/French/set_server_verification.js new file mode 100644 index 0000000..f4fb0a1 --- /dev/null +++ b/French/actions/French/set_server_verification.js @@ -0,0 +1,132 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Définir la vérification du serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle du serveur", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const verifications = ["None", "Low", "Medium", "High", "Highest"]; + return `${presets.getServerText(data.server, data.varName)} - ${verifications[parseInt(data.verification, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "verification", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Verification Level
+ +
+ +
+ +
+ Reason + +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const server = await this.getServerFromData(data.server, data.varName, cache); + const reason = this.evalMessage(data.reason, cache); + const level = ["NONE", "LOW", "MEDIUM", "HIGH", "VERY_HIGH"][parseInt(data.verification, 10)]; + if (Array.isArray(server)) { + this.callListFunc(server, "setVerificationLevel", [level, reason]).then(() => this.callNextAction(cache)); + } else if (server?.setVerificationLevel) { + server + .setVerificationLevel(level, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/show_modal.js b/French/actions/French/show_modal.js new file mode 100644 index 0000000..d495ba8 --- /dev/null +++ b/French/actions/French/show_modal.js @@ -0,0 +1,257 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Afficher le modal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `"${data.title}" with ${data.textInputs.length} Text Inputs`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + if (varType !== 1) return; + if (!data.textInputs) return; + const result = []; + for (let i = 0; i < data.textInputs.length; i++) { + if (data.textInputs[i].id) { + result.push(data.textInputs[i].id); + result.push("Text from Input"); + } + } + return result; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["title", "textInputs"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +Modal Title
+ + +

+ + +
+
+ Name + + +
+ + Placeholder
+ + +
+ + Minimum Length + + +
+ + Maximum Length + + +
+
+
+ Temp Var ID + + +
+ + Action Row (1 - 5) + + +
+ + Style + + +
+ + Required? + +
+ +
+
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + + const tempVariableNames = []; + let componentsArr = []; + + if (Array.isArray(data.textInputs)) { + const existingTempVars = []; + for (let i = 0; i < data.textInputs.length; i++) { + const textInput = data.textInputs[i]; + + const unusedNameTemplate = "unusedTempVarName"; + let j = 0; + let unusedName = unusedNameTemplate + "0"; + while(existingTempVars.includes(unusedName)) { + unusedName = unusedNameTemplate + (++j); + } + + const textInputData = this.generateTextInput(textInput, unusedName, cache); + this.addTextInputToActionRowArray(componentsArr, this.evalMessage(textInput.row, cache), textInputData, cache); + existingTempVars.push(textInputData.customId); + if(textInput.id) { + tempVariableNames.push(textInputData.customId); + } + } + } + + // if select components ever become valid components for modals + // in the future, copy the html from send_message.js, + // remove the action input, and uncomment the following code: + /* + if (Array.isArray(data.selectMenus)) { + for (let i = 0; i < data.selectMenus.length; i++) { + const select = data.selectMenus[i]; + const selectData = this.generateSelectMenu(select, cache); + this.addSelectToActionRowArray(componentsArr, this.evalMessage(select.row, cache), selectData, cache); + } + } + */ + + if (componentsArr.length > 0) { + componentsArr = componentsArr + .filter((comps) => comps.length > 0) + .map(function (comps) { + return { + type: "ACTION_ROW", + components: comps, + }; + }); + } + + if (cache.interaction) { + + if (cache.interaction.showModal) { + + const modalData = { + customId: cache.interaction.id, + title: this.evalMessage(data.title, cache), + components: componentsArr + }; + + this.registerModalSubmitResponses(cache.interaction.id, (newInteraction) => { + newInteraction.__originalInteraction = cache.interaction; + cache.interaction = newInteraction; + + for (let i = 0; i < tempVariableNames.length; i++) { + const name = tempVariableNames[i]; + const val = newInteraction.fields.getTextInputValue(name); + if(typeof val === "string") { + this.storeValue(val, 1, name, cache); + } + } + + this.callNextAction(cache); + }); + + cache.interaction.showModal(modalData); + + } else { + + this.displayError(data, cache, "Cannot show modal from current interaction, perhaps attempting to show modal multiple times?"); + this.callNextAction(cache); + + } + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/shuffle_queue.js b/French/actions/French/shuffle_queue.js new file mode 100644 index 0000000..bf8a44a --- /dev/null +++ b/French/actions/French/shuffle_queue.js @@ -0,0 +1,113 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Mélanger la file d'attente", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle audio", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return "La file d'attente est mélangée."; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: [], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ""; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const Audio = this.getDBM().Audio; + const server = cache.server; + const subscription = Audio.getSubscription(server); + const queue = subscription?.queue.slice(); + + if (!queue?.length) return this.callNextAction(cache); + + subscription.queueLock = true; + for (let i = queue.length - 1; i > 0; i--) { + let j = Math.floor(Math.random() * (i + 1)); + [queue[i], queue[j]] = [queue[j], queue[i]]; + } + subscription.queue = queue; + subscription.queueLock = false; + subscription.processQueue(); + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/start_thinking.js b/French/actions/French/start_thinking.js new file mode 100644 index 0000000..b29a95a --- /dev/null +++ b/French/actions/French/start_thinking.js @@ -0,0 +1,108 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Commencez à réfléchir", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "D'autres choses", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return "Inform User " + (data.ephemeral ? "Privately" : "Publicly"); + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["ephemeral"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + if (cache.interaction) { + cache.interaction + .deferReply({ ephemeral: data.ephemeral }) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_channel_info.js b/French/actions/French/store_channel_info.js new file mode 100644 index 0000000..395f8b6 --- /dev/null +++ b/French/actions/French/store_channel_info.js @@ -0,0 +1,239 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les informations du canal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Channel Object", + "Channel ID", + "Channel Name", + "Channel Topic", + "Channel Last Message (Removed)", + "Channel Position", + "Channel Is NSFW?", + "Channel Is DM?", + "Channel Is Deleteable?", + "Channel Creation Date", + "Channel Category ID", + "Channel Created At", + "Channel Created At Timestamp", + ]; + return `${presets.getChannelText(data.channel, data.varName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Channel"; + break; + case 1: + dataType = "Channel ID"; + break; + case 2: + case 3: + dataType = "Text"; + break; + case 5: + dataType = "Number"; + break; + case 6: + case 7: + case 8: + dataType = "Boolean"; + break; + case 10: + dataType = "Category ID"; + break; + case 11: + dataType = "Date"; + break; + case 12: + dataType = "Timestamp"; + break; + } + return [data.varName2, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName", "info", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Source Info
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const DiscordJS = this.getDBM().DiscordJS; + + const targetChannel = await this.getChannelFromData(data.channel, data.varName, cache); + + if (!targetChannel) { + this.callNextAction(cache); + return; + } + + const info = parseInt(data.info, 10); + + let result; + switch (info) { + case 0: + result = targetChannel; + break; + case 1: + result = targetChannel.id; + break; + case 2: + result = targetChannel.name; + break; + case 3: + result = targetChannel.topic; + break; + case 4: + result = ""; + break; + case 5: + result = targetChannel.position; + break; + case 6: + result = targetChannel.nsfw; + break; + case 7: + result = targetChannel.type === "DM"; + break; + case 8: + result = targetChannel.deletable; + break; + case 9: + case 11: + result = targetChannel.createdAt; + break; + case 10: + result = targetChannel.parentId; + break; + case 12: + result = targetChannel.createdTimestamp; + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_member_data.js b/French/actions/French/store_member_data.js new file mode 100644 index 0000000..3a017b5 --- /dev/null +++ b/French/actions/French/store_member_data.js @@ -0,0 +1,144 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les donnée du membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Données", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storage = presets.variables; + return `${presets.getMemberText(data.member, data.varName)} -> ${presets.getVariableText(data.storage, data.varName2)}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName2, "Unknown Type"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "dataName", "defaultVal", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Data Name
+ +
+
+ Default Value (if data doesn't exist)
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + + if (member?.data) { + const dataName = this.evalMessage(data.dataName, cache); + const defVal = this.eval(this.evalMessage(data.defaultVal, cache), cache); + let result; + if (defVal === undefined) { + result = member.data(dataName); + } else { + result = member.data(dataName, defVal); + } + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_member_info.js b/French/actions/French/store_member_info.js new file mode 100644 index 0000000..a1e1f2d --- /dev/null +++ b/French/actions/French/store_member_info.js @@ -0,0 +1,405 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les information du membre", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Member Object", + "Member ID", + "Member Username", + "Member Display Name", + "Member Color", + "Member Server", + "Member Last Message (Removed)", + "Member Highest Role", + "Member Hoist Role", + "Member Color Role", + "Member Is Owner?", + "Member Is Muted?", + "Member Is Deafened?", + "Member Is Bannable?", + "Member Playing Status Name", + "Member Status", + "Member Avatar URL", + "Member Roles List", + "Member Roles Amount", + "Member Voice Channel", + "Member Discriminator", + "Member Tag", + "Member Created At", + "Member Created Timestamp", + "Member Joined At", + "Member Joined Timestamp", + "Last Message Id (Removed)", + "Member Permission List", + "Member Flags List", + "Member Client Status", + "Member Custom Status", + "Member Server Avatar URL", + "Member Timed Out At", + "Member Timed Out Timestamp", + ]; + return `${presets.getMemberText(data.member, data.varName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Server Member"; + break; + case 1: + dataType = "Member ID"; + break; + case 2: + case 3: + dataType = "Text"; + break; + case 4: + dataType = "Color"; + break; + case 5: + dataType = "Server"; + break; + case 7: + case 8: + case 9: + dataType = "Role"; + break; + case 10: + case 11: + case 12: + case 13: + dataType = "Boolean"; + break; + case 14: + case 15: + dataType = "Text"; + break; + case 16: + case 31: + dataType = "Image URL"; + break; + case 17: + dataType = "List of Roles"; + break; + case 18: + dataType = "Number"; + break; + case 19: + dataType = "Voice Channel"; + break; + case 20: + dataType = "Member Discriminator"; + break; + case 21: + dataType = "Member Tag"; + break; + case 22: + dataType = "Date"; + break; + case 23: + dataType = "Timestamp"; + break; + case 24: + dataType = "Date"; + break; + case 25: + dataType = "Timestamp"; + break; + case 27: + case 28: + case 29: + dataType = "List"; + break; + case 30: + dataType = "Text"; + break; + case 31: + dataType = "Date"; + break; + case 32: + dataType = "Timestamp"; + break; + } + return [data.varName2, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "info", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Source Info
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + + if (!member) { + this.callNextAction(cache); + return; + } + + const info = parseInt(data.info, 10); + + let result; + switch (info) { + case 0: + result = member; + break; + case 1: + result = member.id; + break; + case 2: + result = member.user?.username; + break; + case 3: + result = member.displayName; + break; + case 4: + result = member.displayHexColor; + break; + case 5: + result = member.guild; + break; + case 7: + result = member.roles.highest; + break; + case 8: + result = member.roles.hoist; + break; + case 9: + result = member.roles.color; + break; + case 10: + result = member.id === member.guild?.ownerId; + break; + case 11: + result = member.voice.mute; + break; + case 12: + result = member.voice.deaf; + break; + case 13: + result = member.bannable; + break; + case 14: + if (member.presence?.activities.length) { + const status = member.presence.activities.filter((s) => s.type !== "CUSTOM"); + result = status[0]?.name; + } + break; + case 15: + if (member.presence?.status) { + const status = member.presence.status; + switch(status) { + case "online": { result = "Online"; break; } + case "offline": { result = "Offline"; break; } + case "idle": { result = "Idle"; break; } + case "dnd": { result = "Do Not Disturb"; break; } + } + } + break; + case 16: + if (member.user) { + result = member.user.displayAvatarURL({ dynamic: true, format: "png", size: 4096 }); + } + break; + case 17: + result = [...member.roles.cache.values()]; + break; + case 18: + result = member.roles.cache.size; + break; + case 19: + result = member.voice.channel; + break; + case 20: + result = member.user?.discriminator; + break; + case 21: + result = member.user?.tag; + break; + case 22: + result = member.user?.createdAt; + break; + case 23: + result = member.user?.createdTimestamp; + break; + case 24: + result = member.joinedAt; + break; + case 25: + result = member.joinedTimestamp; + break; + case 27: + result = member.permissions.toArray(); + break; + case 28: + result = member.user?.flags?.toArray() ?? (await member.user?.fetchFlags())?.toArray(); + break; + case 29: + const status = member.presence?.clientStatus; + result = status && Object.keys(status); + break; + case 30: + result = member.presence?.activities.find((s) => s.type === "CUSTOM")?.state; + break; + case 31: + result = member.displayAvatarURL({ dynamic: true, format: "png", size: 4096 }); + break; + case 32: + result = member.communicationDisabledUntil; + break; + case 33: + result = member.communicationDisabledUntilTimestamp; + break; + default: + break; + } + + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_message_data.js b/French/actions/French/store_message_data.js new file mode 100644 index 0000000..fe6b954 --- /dev/null +++ b/French/actions/French/store_message_data.js @@ -0,0 +1,141 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les donnée du message", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Données", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMessageText(data.message, data.varName)} -> ${presets.getVariableText(data.storage, data.varName2)}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName2, "Unknown Type"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["message", "varName", "dataName", "defaultVal", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Data Name
+ +
+
+ Default Value (if data doesn't exist)
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const message = await this.getMessageFromData(data.message, data.varName, cache); + + if (message?.data) { + const dataName = this.evalMessage(data.dataName, cache); + const defVal = this.eval(this.evalMessage(data.defaultVal, cache), cache); + let result; + if (defVal === undefined) { + result = message.data(dataName); + } else { + result = message.data(dataName, defVal); + } + this.storeValue(result, parseInt(data.storage, 10), this.evalMessage(data.varName2, cache), cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_message_info.js b/French/actions/French/store_message_info.js new file mode 100644 index 0000000..d15c808 --- /dev/null +++ b/French/actions/French/store_message_info.js @@ -0,0 +1,303 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + name: "Stocker les information du message", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + section: "Messages", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + subtitle(data, presets) { + const info = [ + "Message Object", + "Message ID", + "Message Text", + "Message Author", + "Message Channel", + "Message Timestamp", + "Message is Pinned", + "Message is TTS", + "Message Attachments List", + "Message Edits", + "", + "", + "Messages Reactions Count", + "Mentioned Users List", + "Mentioned Users Count", + "Message URL", + "Message Creation Date", + "Message Content Length", + "Message Attachments Count", + "Message Guild", + "Message Type", + "Message Webhook ID", + "Message Embed Object", + ]; + return `${presets.getMessageText(data.message, data.varName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Message"; + break; + case 1: + dataType = "Message ID"; + break; + case 2: + dataType = "Text"; + break; + case 3: + dataType = "Server Member"; + break; + case 4: + dataType = "Channel"; + break; + case 5: + dataType = "Text"; + break; + case 6: + case 7: + dataType = "Boolean"; + break; + case 8: + dataType = "Date"; + case 9: + dataType = "Messages List"; + case 12: + dataType = "Number"; + break; + case 13: + dataType = "Array"; + break; + case 14: + dataType = "Number"; + break; + case 15: + dataType = "URL"; + break; + case 16: + dataType = "Date"; + break; + case 17: + case 18: + dataType = "Number"; + break; + case 19: + dataType = "Guild"; + break; + case 20: + dataType = "Message Type"; + break; + case 21: + dataType = "Webhook ID"; + break; + case 22: + dataType = "Embed Message"; + break; + } + return [data.varName2, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + fields: ["message", "varName", "info", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + html(isEvent, data) { + return ` + + +


+ +
+ Source Info
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + async action(cache) { + const data = cache.actions[cache.index]; + const msg = await this.getMessageFromData(data.message, data.varName, cache); + + if (!msg) { + this.callNextAction(cache); + return; + } + + const info = parseInt(data.info, 10); + + let result; + switch (info) { + case 0: + result = msg; + break; + case 1: + result = msg.id; + break; + case 2: + result = msg.content; + break; + case 3: + result = msg.member ?? msg.author; + break; + case 4: + result = msg.channel; + break; + case 5: + result = msg.createdTimestamp; + break; + case 6: + result = msg.pinned; + break; + case 7: + result = msg.tts; + break; + case 8: + result = [...msg.attachments.values()]; + break; + case 9: + result = msg.edits; + break; + case 12: + result = msg.reactions.cache.size; + break; + case 13: + result = [...msg.mentions.users.values()]; + break; + case 14: + result = msg.mentions.users.size; + break; + case 15: + result = msg.url; + break; + case 16: + result = msg.createdAt; + break; + case 17: + result = msg.content.length; + break; + case 18: + result = msg.attachments.size; + break; + case 19: + result = msg.guild; + break; + case 20: + result = msg.type; + break; + case 21: + result = msg.webhookId; + break; + case 22: + result = msg.embeds[0]; + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + mod() {}, +}; diff --git a/French/actions/French/store_role_info.js b/French/actions/French/store_role_info.js new file mode 100644 index 0000000..3d7e90c --- /dev/null +++ b/French/actions/French/store_role_info.js @@ -0,0 +1,251 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stockage les informations du rôle", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des rôles", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Role Object", + "Role ID", + "Role Name", + "Role Color", + "Role Position", + "Role Timestamp", + "Role Is Mentionable?", + "Role Is Separate From Others?", + "Role Is Managed?", + "Role Members List", + "Role Creation Date", + "Role Permissions", + "Role Members Amount", + "Role Icon", + ]; + return `${presets.getRoleText(data.role, data.varName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Role"; + break; + case 1: + dataType = "Role ID"; + break; + case 2: + dataType = "Text"; + break; + case 3: + dataType = "Color"; + break; + case 4: + case 5: + dataType = "Text"; + break; + case 6: + case 7: + dataType = "Boolean"; + break; + case 8: + dataType = "Boolean"; + break; + case 9: + dataType = "Member List"; + break; + case 10: + dataType = "Date"; + break; + case 11: + case 12: + dataType = "Number"; + break; + case 13: + dataType = "Image URL"; + break; + } + return [data.varName2, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["role", "varName", "info", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Source Info
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const targetRole = await this.getRoleFromData(data.role, data.varName, cache); + const info = parseInt(data.info, 10); + if (!targetRole) { + this.callNextAction(cache); + return; + } + let result; + switch (info) { + case 0: + result = targetRole; + break; + case 1: + result = targetRole.id; + break; + case 2: + result = targetRole.name; + break; + case 3: + result = targetRole.hexColor; + break; + case 4: + result = targetRole.position; + break; + case 5: + result = targetRole.createdTimestamp; + break; + case 6: + result = targetRole.mentionable; + break; + case 7: + result = targetRole.hoist; + break; + case 8: + result = targetRole.managed; + break; + case 9: + result = [...targetRole.members.values()]; + break; + case 10: + result = targetRole.createdAt; + break; + case 11: + result = targetRole.permissions.toArray(); + break; + case 12: + result = targetRole.members.size; + break; + case 13: + result = targetRole.iconURL({ dynamic: true, format: "png", size: 4096 }); + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_server_data.js b/French/actions/French/store_server_data.js new file mode 100644 index 0000000..4f5629a --- /dev/null +++ b/French/actions/French/store_server_data.js @@ -0,0 +1,143 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les données serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Données", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const storage = presets.variables; + return `${presets.getServerText(data.server, data.varName)} -> ${presets.getVariableText(data.storage, data.varName2)}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + return [data.varName2, "Unknown Type"]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "dataName", "defaultVal", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Data Name
+ +
+
+ Default Value (if data doesn't exist)
+ +
+
+ +


+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const server = await this.getServerFromData(data.server, data.varName, cache); + if (server?.data) { + const dataName = this.evalMessage(data.dataName, cache); + const defVal = this.eval(this.evalMessage(data.defaultVal, cache), cache); + let result; + if (defVal === undefined) { + result = server.data(dataName); + } else { + result = server.data(dataName, defVal); + } + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_server_info.js b/French/actions/French/store_server_info.js new file mode 100644 index 0000000..eb4e161 --- /dev/null +++ b/French/actions/French/store_server_info.js @@ -0,0 +1,524 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les informations serveur", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle du serveur", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Server Object", + "Server ID", + "Server Name", + "Server Name Acronym", + "Server Region (Removed)", + "Server Icon URL", + "Server Verification Level", + "Server Default Channel", + "Server AFK Channel", + "Server System Channel", + "Server Default Role", + "Server Owner Object", + "Server Bot Member", + "Server Channels List", + "Server Roles List", + "Server Members List", + "Server Emojis List", + "Server Member Count", + "Server Created At", + "Server AFK Timeout", + "Server Available", + "Server Large", + "Server Joined At", + "Server Channels Count", + "Server Emojis Count", + "Server Embed Enabled", + "Server Do Not Disturb Members Count", + "Server Online Members Count", + "Server Offline Members Count", + "Server Idle Members Count", + "Server Bot Count", + "Server Channels IDs List", + "Server Roles IDs List", + "Server Members IDs List", + "", + "Server Human Count", + "", + "Server Roles Count", + "Server Text Channels Count", + "Server Voice Channels Count", + "Server Verified", + "Server Bans List", + "Server Invites List", + "Server Explicit Content Filter", + "Server Boosts Count", + "Server Boost Tier", + "Server Banner URL", + "Server Features List", + "Server Owner ID", + "Server Vanity URL Code", + "Server Widget Channel ID", + ]; + return `${presets.getServerText(data.server, data.varName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Server"; + break; + case 1: + dataType = "Server ID"; + break; + case 2: + case 3: + case 5: + dataType = "Icon URL"; + break; + case 6: + dataType = "Text"; + break; + case 7: + case 8: + case 9: + dataType = "Channel"; + break; + case 10: + dataType = "Role"; + break; + case 11: + dataType = "Server Member"; + break; + case 12: + dataType = "Server Member"; + break; + case 13: + dataType = "Channels List"; + break; + case 14: + dataType = "Roles List"; + break; + case 15: + dataType = "Members List"; + break; + case 16: + dataType = "Emojis List"; + break; + case 17: + dataType = "Number"; + break; + case 18: + dataType = "Date"; + break; + case 19: + dataType = "Number"; + break; + case 20: + case 21: + dataType = "Boolean"; + break; + case 22: + dataType = "Date"; + break; + case 23: + case 24: + dataType = "Number"; + break; + case 25: + dataType = "Boolean"; + break; + case 26: + case 27: + case 28: + case 29: + case 30: + dataType = "Number"; + break; + case 31: + case 32: + case 33: + dataType = "IDs List"; + break; + case 35: + dataType = "Number"; + break; + case 37: + case 38: + case 39: + dataType = "Number"; + break; + case 40: + dataType = "Boolean"; + break; + case 41: + dataType = "Bans List"; + break; + case 42: + dataType = "Invites List"; + break; + case 43: + dataType = "Text"; + break; + case 44: + case 45: + dataType = "Number"; + break; + case 46: + dataType = "Banner URL"; + break; + case 47: + dataType = "Server Features List"; + break; + case 48: + case 49: + dataType = "Text"; + break; + case 50: + dataType = "Channel ID"; + break; + } + return [data.varName2, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["server", "varName", "info", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+
+ Source Info
+ +
+
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const targetServer = await this.getServerFromData(data.server, data.varName, cache); + + if (!targetServer) { + return this.callNextAction(cache); + } + + const fetchMembers = async (withPresences = false) => { + if (targetServer.memberCount !== targetServer.members.cache.size) { + await targetServer.members.fetch({ withPresences }); + } + } + + const info = parseInt(data.info, 10); + + let result; + switch (info) { + case 0: + result = targetServer; + break; + case 1: + result = targetServer.id; + break; + case 2: + result = targetServer.name; + break; + case 3: + result = targetServer.nameAcronym; + break; + case 4: // Server region + result = "unknown"; + break; + case 5: + result = targetServer.iconURL({ dynamic: true, format: "png", size: 4096 }); + break; + case 6: + result = targetServer.verificationLevel; + break; + case 7: + result = targetServer.getDefaultChannel(); + break; + case 8: + result = targetServer.afkChannel; + break; + case 9: + result = targetServer.systemChannel; + break; + case 10: + result = targetServer.roles.resolve(targetServer.id); + break; + case 11: + result = await targetServer.fetchOwner(); + break; + case 12: + result = targetServer.me; + break; + case 13: + result = [...targetServer.channels.cache.values()]; + break; + case 14: + result = [...targetServer.roles.cache.values()]; + break; + case 15: + result = [...targetServer.members.cache.values()]; + break; + case 16: + result = [...targetServer.emojis.cache.values()]; + break; + case 17: + result = targetServer.memberCount; + break; + case 18: + result = targetServer.createdAt; + break; + case 19: + result = targetServer.afkTimeout ?? 0; + break; + case 20: + result = targetServer.available; + break; + case 21: + result = targetServer.large; + break; + case 22: + result = targetServer.joinedAt; + break; + case 23: + result = targetServer.channels.cache.size; + break; + case 24: + result = targetServer.emojis.cache.size; + break; + case 25: + result = !!targetServer.widgetEnabled; + break; + case 26: + await fetchMembers(true); + result = targetServer.members.cache.filter((m) => m.presence?.status === "dnd").size; + break; + case 27: + await fetchMembers(true); + result = targetServer.members.cache.filter((m) => m.presence?.status === "online").size; + break; + case 28: + await fetchMembers(true); + result = targetServer.members.cache.filter((m) => m.presence?.status === "offline").size; + break; + case 29: + await fetchMembers(true); + result = targetServer.members.cache.filter((m) => m.presence?.status === "idle").size; + break; + case 30: + result = targetServer.members.cache.filter((m) => m.user?.bot).size; + break; + case 31: + result = [...targetServer.channels.cache.keys()]; + break; + case 32: + result = [...targetServer.roles.cache.keys()]; + break; + case 33: + await fetchMembers(); + result = [...targetServer.members.cache.keys()]; + break; + case 35: + await fetchMembers(); + result = targetServer.members.cache.filter((m) => !m.user?.bot).size; + break; + case 37: + result = targetServer.roles.cache.size; + break; + case 38: + result = targetServer.channels.cache.filter((c) => c.type === "GUILD_TEXT" || c.type === "GUILD_NEWS").size; + break; + case 39: + result = targetServer.channels.cache.filter((c) => c.type === "GUILD_VOICE").size; + break; + case 40: + result = targetServer.verified; + break; + case 41: + const bans = await targetServer.bans.fetch(); + result = [...bans.values()]; + break; + case 42: + const invites = await targetServer.invites.fetch(); + result = [...invites.values()]; + break; + case 43: + result = targetServer.explicitContentFilter; + break; + case 44: + result = targetServer.premiumSubscriptionCount ?? 0; + break; + case 45: + result = targetServer.premiumTier; + break; + case 46: + result = targetServer.bannerURL({ format: "png", size: 4096 }); + break; + case 47: + result = targetServer.features; + break; + case 48: + result = targetServer.ownerId; + break; + case 49: + result = targetServer.vanityURLCode; + break; + case 50: + result = targetServer.widgetChannelId; + break; + default: + break; + } + + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_thread_channel_info.js b/French/actions/French/store_thread_channel_info.js new file mode 100644 index 0000000..f614620 --- /dev/null +++ b/French/actions/French/store_thread_channel_info.js @@ -0,0 +1,210 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stockage des informations du fil de discution", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Thread Channel Object", + "Thread Channel ID", + "Thread Channel Name", + "Thread Channel Is Archived?", + "Thread Channel Is Locked?", + "Thread Channel Is Invitable?", + "Thread Channel Archived At", + "Thread Channel Archived At Timestamp", + ]; + return `${presets.getChannelText(data.thread, data.threadVarName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Thread Channel"; + break; + case 1: + dataType = "Thread Channel ID"; + break; + case 2: + dataType = "Text"; + break; + case 3: + case 4: + case 5: + dataType = "Boolean"; + break; + case 6: + dataType = "Date"; + break; + case 7: + dataType = "Timestamp"; + break; + } + return [data.storageVarName, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["thread", "threadVarName", "info", "storage", "storageVarName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Source Info
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + + const targetChannel = await this.getChannelFromData(data.thread, data.threadVarName, cache); + + if (!targetChannel) { + this.callNextAction(cache); + return; + } + + let result; + const info = parseInt(data.info, 10); + switch (info) { + case 0: + result = targetChannel; + break; + case 1: + result = targetChannel.id; + break; + case 2: + result = targetChannel.name; + break; + case 3: + result = targetChannel.archived; + break; + case 4: + result = targetChannel.locked; + break; + case 5: + result = targetChannel.invitable; + break; + case 6: + result = targetChannel.archivedAt; + break; + case 7: + result = targetChannel.archiveTimestamp; + break; + default: + break; + } + + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const storageVarName = this.evalMessage(data.storageVarName, cache); + this.storeValue(result, storage, storageVarName, cache); + } + + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_time_info.js b/French/actions/French/store_time_info.js new file mode 100644 index 0000000..2511684 --- /dev/null +++ b/French/actions/French/store_time_info.js @@ -0,0 +1,183 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les informations sur le temps", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "D'autres choses", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const time = ["Year", "Month", "Day of the Month", "Hour", "Minute", "Second", "Milisecond", "Month Text"]; + return `${time[parseInt(data.type, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + let result = "Number"; + if (data.type === "7") { + result = "Text"; + } + return [data.varName, result]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["type", "storage", "varName"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` +
+
+ Time Info
+ +
+
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + action(cache) { + const data = cache.actions[cache.index]; + const type = parseInt(data.type, 10); + const date = new Date(); + let result; + switch (type) { + case 0: + result = date.getFullYear(); + break; + case 1: + result = date.getMonth() + 1; + break; + case 2: + result = date.getDate(); + break; + case 3: + result = date.getHours(); + break; + case 4: + result = date.getMinutes(); + break; + case 5: + result = date.getSeconds(); + break; + case 6: + result = date.getMilliseconds(); + break; + case 7: + result = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ][date.getMonth()]; + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName = this.evalMessage(data.varName, cache); + this.storeValue(result, storage, varName, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/store_voice_channel_info.js b/French/actions/French/store_voice_channel_info.js new file mode 100644 index 0000000..ff8e733 --- /dev/null +++ b/French/actions/French/store_voice_channel_info.js @@ -0,0 +1,192 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Stocker les informations du canal vocal", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des salons", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + const info = [ + "Voice Channel Object", + "Voice Channel ID", + "Voice Channel Name", + "Voice Channel Position", + "Voice Channel User Limit", + "Voice Channel Bitrate", + ]; + return `${presets.getVoiceChannelText(data.channel, data.varName)} - ${info[parseInt(data.info, 10)]}`; + }, + + //--------------------------------------------------------------------- + // Action Storage Function + // + // Stores the relevant variable info for the editor. + //--------------------------------------------------------------------- + + variableStorage(data, varType) { + const type = parseInt(data.storage, 10); + if (type !== varType) return; + const info = parseInt(data.info, 10); + let dataType = "Unknown Type"; + switch (info) { + case 0: + dataType = "Voice Channel"; + break; + case 1: + dataType = "Voice Channel ID"; + break; + case 2: + dataType = "Text"; + break; + case 3: + case 4: + case 5: + dataType = "Number"; + break; + } + return [data.varName2, dataType]; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["channel", "varName", "info", "storage", "varName2"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Source Info
+ +
+ +
+ +`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const targetChannel = await this.getVoiceChannelFromData(data.channel, data.varName, cache); + + if (!targetChannel) { + this.callNextAction(cache); + return; + } + + const info = parseInt(data.info, 10); + + let result; + switch (info) { + case 0: + result = targetChannel; + break; + case 1: + result = targetChannel.id; + break; + case 2: + result = targetChannel.name; + break; + case 3: + result = targetChannel.position; + break; + case 4: + result = targetChannel.userLimit; + break; + case 5: + result = targetChannel.bitrate; + break; + default: + break; + } + if (result !== undefined) { + const storage = parseInt(data.storage, 10); + const varName2 = this.evalMessage(data.varName2, cache); + this.storeValue(result, storage, varName2, cache); + } + this.callNextAction(cache); + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/timeout_member.js b/French/actions/French/timeout_member.js new file mode 100644 index 0000000..d0b3653 --- /dev/null +++ b/French/actions/French/timeout_member.js @@ -0,0 +1,127 @@ +module.exports = { + //--------------------------------------------------------------------- + // Action Name + // + // This is the name of the action displayed in the editor. + //--------------------------------------------------------------------- + + name: "Membre en temps d'attente", + + //--------------------------------------------------------------------- + // Action Section + // + // This is the section the action will fall into. + //--------------------------------------------------------------------- + + section: "Contrôle des membres", + + //--------------------------------------------------------------------- + // Action Subtitle + // + // This function generates the subtitle displayed next to the name. + //--------------------------------------------------------------------- + + subtitle(data, presets) { + return `${presets.getMemberText(data.member, data.varName)}`; + }, + + //--------------------------------------------------------------------- + // Action Meta Data + // + // Helps check for updates and provides info if a custom mod. + // If this is a third-party mod, please set "author" and "authorUrl". + // + // It's highly recommended "preciseCheck" is set to false for third-party mods. + // This will make it so the patch version (0.0.X) is not checked. + //--------------------------------------------------------------------- + + meta: { version: "2.1.7", preciseCheck: true, author: null, authorUrl: null, downloadUrl: null }, + + //--------------------------------------------------------------------- + // Action Fields + // + // These are the fields for the action. These fields are customized + // by creating elements with corresponding IDs in the HTML. These + // are also the names of the fields stored in the action's JSON data. + //--------------------------------------------------------------------- + + fields: ["member", "varName", "time", "reason"], + + //--------------------------------------------------------------------- + // Command HTML + // + // This function returns a string containing the HTML used for + // editing actions. + // + // The "isEvent" parameter will be true if this action is being used + // for an event. Due to their nature, events lack certain information, + // so edit the HTML to reflect this. + //--------------------------------------------------------------------- + + html(isEvent, data) { + return ` + + +


+ +
+ Time
+ +
+ +
+ Reason
+ +
`; + }, + + //--------------------------------------------------------------------- + // Action Editor Init Code + // + // When the HTML is first applied to the action editor, this code + // is also run. This helps add modifications or setup reactionary + // functions for the DOM elements. + //--------------------------------------------------------------------- + + init() {}, + + //--------------------------------------------------------------------- + // Action Bot Function + // + // This is the function for the action within the Bot's Action class. + // Keep in mind event calls won't have access to the "msg" parameter, + // so be sure to provide checks for variable existence. + //--------------------------------------------------------------------- + + async action(cache) { + const data = cache.actions[cache.index]; + const member = await this.getMemberFromData(data.member, data.varName, cache); + + let time = this.evalMessage(data.time, cache); + time = time ? Date.now() + time * 1000 : null; + const reason = this.evalMessage(data.reason, cache); + + if (Array.isArray(member)) { + this.callListFunc(member, "disableCommunicationUntil", [time, reason]) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else if (member?.disableCommunicationUntil) { + member.disableCommunicationUntil(time, reason) + .then(() => this.callNextAction(cache)) + .catch((err) => this.displayError(data, cache, err)); + } else { + this.callNextAction(cache); + } + }, + + //--------------------------------------------------------------------- + // Action Bot Mod + // + // Upon initialization of the bot, this code is run. Using the bot's + // DBM namespace, one can add/modify existing functions if necessary. + // In order to reduce conflicts between mods, be sure to alias + // functions you wish to overwrite. + //--------------------------------------------------------------------- + + mod() {}, +}; diff --git a/French/actions/French/transfer_variable.js b/French/actions/French/transfer_variable.js index 8aae6cd..94d6f37 100644 --- a/French/actions/French/transfer_variable.js +++ b/French/actions/French/transfer_variable.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Transféré une variable", + name: "Transférer une variable", //--------------------------------------------------------------------- // Action Section diff --git a/French/actions/French/wait.js b/French/actions/French/wait.js index df5d52e..c8c280a 100644 --- a/French/actions/French/wait.js +++ b/French/actions/French/wait.js @@ -5,7 +5,7 @@ module.exports = { // This is the name of the action displayed in the editor. //--------------------------------------------------------------------- - name: "Attendre", + name: "Attendez", //--------------------------------------------------------------------- // Action Section