ErythroGuild / irene

<Erythro>'s server admin bot.
Mozilla Public License 2.0
0 stars 0 forks source link

Add `.ModifyEntries()` method to selector interactables #458

Open Ernest314 opened 1 year ago

Ernest314 commented 1 year ago

(This includes both Selector and PagedSelector. SelectorPages will automatically get the functionally since it will have a PagedSelector component.)

Have the method take a dictionary of entries, keyed on the ID of each entry. This would actually even allow for modifying the IDs of the entries, but not sure if that's a good idea...

The actual modification could be implemented in two different ways. One is to search for "contains" for each entry to be replaced, and the other is to iterate through each entry and check if each one needs modification.

The first approach has better typical-case and best-case run time, while the second approach has much better worst-case run time. Could use a heuristic to decide between the two based on how many entries need modification, but that's getting to be a lot of complexity for a simple task.

Ernest314 commented 1 year ago

Also rewrite /crafter to use this to update select menus.