-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for names in Text Splitting functions. #500
Conversation
src/core/interpreter.js
Outdated
@@ -87,7 +87,7 @@ const Interpreter = async ( | |||
data.vars || {}, | |||
data.object || {}, | |||
["roles", "users", "everyone"], | |||
data.array || [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're changing into object, this doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is since the data inside d.array will be arrays.
@@ -2,7 +2,7 @@ module.exports = async (d) => { | |||
const data = d.util.aoiFunc(d); | |||
if (data.err) return d.error(data.err); | |||
|
|||
let [index, text] = data.inside.splits; | |||
let [index, text, name = 'main'] = data.inside.splits; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't be default of main at all.
let elements = data.inside.splits, name = elements.length < 1 ? 'main' : elements.pop() | ||
|
||
// If the split array is not found, returns the command name into the list. | ||
if (!(name in d.array)) elements.push(name), name = 'main'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was fine how it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required.
Type
Dependencies (Third Party Modules) needed: None
Want a credit? Discord tag or other social media link: @Cyberghxst
Referenced Issue: #NaN
Description
According to a suggestion on the Discord server, I added name support for text splitting functions that are NOT BREAKING due to the positioning of the new optional name.
Before submitting this pull request, I did some tests using the following code:
Getting the expected output:
I hope this gets accepted. If you have any comments or suggestions, feel free to tell me.