Skip to content

Selections

paige edited this page Aug 28, 2023 · 4 revisions

Selections function similarly to how they do in Discord.JS except with a few adjustments to make things generally easier
For more info on select menus and how they're formatted check out this

Creating Selections

Selections are classes so they are created like this:

let selection = new wc.Selection({/* stuff */});

// or

let selection = new wc.SelectMenu({/* stuff */});



Selection Structures

If you want more info on how selections function this is the code:

Selection = class {
	constructor(obj) {
		obj.type = 3;
		if (obj.id) {
			obj.custom_id = obj.id;
		}
		if (obj.label || obj.text) {
			obj.placeholder = (obj.label) ? obj.label : obj.text;
		}
		if (obj.minimum || obj.min) {
			obj.min_values = (obj.minimum) ? obj.minimum : obj.min;
		}
		if (obj.maximum || obj.max) {
			obj.max_values = (obj.maximum) ? obj.maximum : obj.max;
		}

		return obj;
	}
}
Clone this wiki locally