fix: set welcome/bye variable inconsistency and placeholder docs#24
fix: set welcome/bye variable inconsistency and placeholder docs#24znanx merged 1 commit intoznanx:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix custom welcome/bye text configuration by aligning the stored group settings keys with the keys actually read by the group participant listeners, and to correct placeholder documentation shown to admins when using the commands.
Changes:
- Update
setwelcome/setbyesetters to writegroupSet.text_welcomeandgroupSet.text_left. - Fix help/usage strings to reference
@user(instead of@tag/+tag) in placeholder examples.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!text) return conn.reply(m.chat, formatWel(usedPrefix, command), m); | ||
| groupSet.text_welcome = text; | ||
| await conn.reply(m.chat, Func.texted("bold", `🚩 Successfully set.`), m); | ||
| } else if (/set(out|left)/i.test(command)) { |
There was a problem hiding this comment.
help lists setbye, but the handler branch for setting the left/bye text only matches /set(out|left)/i. As a result, invoking setbye won’t set groupSet.text_left (no branch runs). Update the condition to explicitly handle setbye (or change help to match the supported command names) so the command actually works.
| } else if (/set(out|left)/i.test(command)) { | |
| } else if (command === "setbye" || /set(out|left)/i.test(command)) { |
|
|
||
| • *Example* : ${prefix + command} Good by +tag` | ||
| } No newline at end of file | ||
| • *Example* : ${prefix + command} Good by @user`; |
There was a problem hiding this comment.
User-facing example has a typo: “Good by”. Consider changing it to “Goodbye” (or “Good bye”) for correct wording.
| • *Example* : ${prefix + command} Good by @user`; | |
| • *Example* : ${prefix + command} Goodbye @user`; |
| help: ["setwelcome", "setbye"], | ||
| use: "text", | ||
| tags: "admin", | ||
| run: async (m, { conn, usedPrefix, command, text, groupSet, Func }) => { | ||
| if (command == "setwelcome") { | ||
| if (!text) return conn.reply(m.chat, formatWel(usedPrefix, command), m); | ||
| groupSet.text_welcome = text; | ||
| await conn.reply(m.chat, Func.texted("bold", `🚩 Successfully set.`), m); | ||
| } else if (/set(out|left)/i.test(command)) { | ||
| if (!text) return conn.reply(m.chat, formatLef(usedPrefix, command), m); | ||
| groupSet.text_left = text; | ||
| await conn.reply(m.chat, Func.texted("bold", `🚩 Successfully set.`), m); | ||
| } | ||
| }, | ||
| group: true, | ||
| admin: true, | ||
| error: false, | ||
| }; |
There was a problem hiding this comment.
This file switches to double quotes + semicolons, while other plugins in this repo consistently use single quotes and omit semicolons (e.g. plugins/admin/action.js, plugins/admin/groupset.js). Consider aligning formatting here to match the established plugin style to reduce inconsistency/churn.
Changes Made
Variable Standardization: Updated
settext.jsto use consistent variable names (sWelcome→text_welcome,sBye→text_left) to match the keys used inlisteners.jsandmodels.js.Documentation Fix: Corrected placeholder examples in help messages from
@tag/+tagto@userfor accurate usage guidance. This aligns with the replacement logic inlisteners.js:Issue Resolved
@user,@subject,@descwithout confusion.