Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Adding multiple duplicate items to a SG array #614

Closed
1 of 2 tasks
gc opened this issue Mar 9, 2019 · 2 comments
Closed
1 of 2 tasks

Adding multiple duplicate items to a SG array #614

gc opened this issue Mar 9, 2019 · 2 comments

Comments

@gc
Copy link
Contributor

gc commented Mar 9, 2019

Describe the issue

I can't seem to add multiple duplicate values to a SG array, e.g. ["string", "string"], is there a way to do this?

Code or steps to reproduce

These are what I tried to do. Both of these snippets are ran when author.settings.badges is ["EASTER_EGG"], neither of them change that

msg.author.settings.update("badges", "EASTER_EGG", { action: 'add' });
// Errors: [The value EASTER_EGG for the key badges already exists.]
// Updated: []

const newBadge = "EASTER_EGG";
const currentBadges = msg.author.settings.get("badges");
const newBadges = [...currentBadges , newBadge];
console.log(newBadges); // [ 'EASTER_EGG', 'EASTER_EGG' ]
msg.author.settings.update("badges", newBadges);
// Errors: []
// Updated: [ {
//    data: [ 'badges', [ 'EASTER_EGG' ] ],
//    piece: SchemaPiece } 
//    ]

Expected and actual behavior

It's not a bug (I think), but I expected that duplicate items could be added in some way, even if it requires a special way to do it

Further details

  • discord.js version:
  • node.js version:
  • Klasa version:
  • I have modified core files.
  • I have tested the issue on latest master. Commit hash:
@kyranet
Copy link
Contributor

kyranet commented Mar 9, 2019

You can use overwrite while it's bugged (doesn't check for duplicates).

You should suggest this in #425 though

@bdistin
Copy link
Contributor

bdistin commented Mar 9, 2019

closing this in favor of the existing issue #425

@bdistin bdistin closed this as completed Mar 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants