mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
new select menus (#122)
This commit is contained in:
parent
6a5fce0f58
commit
f6b745c726
@ -79,6 +79,14 @@ export enum MessageComponentTypes {
|
|||||||
SelectMenu = 3,
|
SelectMenu = 3,
|
||||||
/** A text input object */
|
/** A text input object */
|
||||||
InputText = 4,
|
InputText = 4,
|
||||||
|
/** A select menu for picking from users */
|
||||||
|
UserSelect = 5,
|
||||||
|
/** A select menu for picking from roles */
|
||||||
|
RoleSelect = 6,
|
||||||
|
/** A select menu for picking from users and roles */
|
||||||
|
MentionableSelect = 7,
|
||||||
|
/** A select menu for picking from channels */
|
||||||
|
ChannelSelect = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TextStyles {
|
export enum TextStyles {
|
||||||
|
@ -1187,7 +1187,11 @@ export interface DiscordActionRow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DiscordSelectMenuComponent {
|
export interface DiscordSelectMenuComponent {
|
||||||
type: MessageComponentTypes.SelectMenu;
|
type: MessageComponentTypes.SelectMenu |
|
||||||
|
MessageComponentTypes.RoleSelect |
|
||||||
|
MessageComponentTypes.UserSelect |
|
||||||
|
MessageComponentTypes.MentionableSelect |
|
||||||
|
MessageComponentTypes.ChannelSelect;
|
||||||
/** A custom identifier for this component. Maximum 100 characters. */
|
/** A custom identifier for this component. Maximum 100 characters. */
|
||||||
custom_id: string;
|
custom_id: string;
|
||||||
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
|
/** A custom placeholder text if nothing is selected. Maximum 150 characters. */
|
||||||
|
@ -223,6 +223,10 @@ export class ActionRow extends BaseComponent implements ActionRowComponent {
|
|||||||
}
|
}
|
||||||
return new Button(session, component);
|
return new Button(session, component);
|
||||||
case MessageComponentTypes.SelectMenu:
|
case MessageComponentTypes.SelectMenu:
|
||||||
|
case MessageComponentTypes.RoleSelect:
|
||||||
|
case MessageComponentTypes.UserSelect:
|
||||||
|
case MessageComponentTypes.MentionableSelect:
|
||||||
|
case MessageComponentTypes.ChannelSelect:
|
||||||
return new SelectMenu(session, component);
|
return new SelectMenu(session, component);
|
||||||
case MessageComponentTypes.InputText:
|
case MessageComponentTypes.InputText:
|
||||||
return new TextInput(
|
return new TextInput(
|
||||||
@ -257,6 +261,10 @@ export class ComponentFactory {
|
|||||||
}
|
}
|
||||||
return new Button(session, component);
|
return new Button(session, component);
|
||||||
case MessageComponentTypes.SelectMenu:
|
case MessageComponentTypes.SelectMenu:
|
||||||
|
case MessageComponentTypes.RoleSelect:
|
||||||
|
case MessageComponentTypes.UserSelect:
|
||||||
|
case MessageComponentTypes.MentionableSelect:
|
||||||
|
case MessageComponentTypes.ChannelSelect:
|
||||||
return new SelectMenu(session, component);
|
return new SelectMenu(session, component);
|
||||||
case MessageComponentTypes.InputText:
|
case MessageComponentTypes.InputText:
|
||||||
return new TextInput(
|
return new TextInput(
|
||||||
|
@ -47,9 +47,19 @@ export class SelectMenuBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#data: DiscordSelectMenuComponent;
|
#data: DiscordSelectMenuComponent;
|
||||||
type: MessageComponentTypes.SelectMenu;
|
type: MessageComponentTypes.SelectMenu |
|
||||||
|
MessageComponentTypes.RoleSelect |
|
||||||
|
MessageComponentTypes.UserSelect |
|
||||||
|
MessageComponentTypes.MentionableSelect |
|
||||||
|
MessageComponentTypes.ChannelSelect;
|
||||||
|
|
||||||
options: SelectMenuOptionBuilder[];
|
options: SelectMenuOptionBuilder[];
|
||||||
|
|
||||||
|
setType(type: this['type']) {
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
setPlaceholder(placeholder: string): this {
|
setPlaceholder(placeholder: string): this {
|
||||||
this.#data.placeholder = placeholder;
|
this.#data.placeholder = placeholder;
|
||||||
return this;
|
return this;
|
||||||
|
@ -73,7 +73,7 @@ export class DefaultRestAdapter implements RestAdapter {
|
|||||||
private url: string;
|
private url: string;
|
||||||
|
|
||||||
constructor(options: DefaultRestOptions) {
|
constructor(options: DefaultRestOptions) {
|
||||||
this.options = Object.assign(Object.create(DefaultRestAdapter.DEFAULTS), options);
|
this.options = Object.assign({}, DefaultRestAdapter.DEFAULTS, options);
|
||||||
|
|
||||||
if (this.options.url) {
|
if (this.options.url) {
|
||||||
this.url = `${options.url}/v${this.options.version}`;
|
this.url = `${options.url}/v${this.options.version}`;
|
||||||
|
@ -33,7 +33,7 @@ export class ShardManager {
|
|||||||
readonly shards = new Map<number, Shard>();
|
readonly shards = new Map<number, Shard>();
|
||||||
|
|
||||||
constructor(options: ShardManagerOptions) {
|
constructor(options: ShardManagerOptions) {
|
||||||
this.options = Options({}, ShardManager.DEFAULTS, options);
|
this.options = Options(ShardManager.DEFAULTS, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Invokes internal processing and respawns shards */
|
/** Invokes internal processing and respawns shards */
|
||||||
|
@ -27,7 +27,7 @@ export class Shard {
|
|||||||
resumeURL: string | null = null;
|
resumeURL: string | null = null;
|
||||||
sessionID: string | null = null;
|
sessionID: string | null = null;
|
||||||
|
|
||||||
sequence = 0 ;
|
sequence = 0;
|
||||||
|
|
||||||
resolves: Map<string, (payload?: unknown) => void> = new Map();
|
resolves: Map<string, (payload?: unknown) => void> = new Map();
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ export class Shard {
|
|||||||
ws: WebSocket | null = null;
|
ws: WebSocket | null = null;
|
||||||
|
|
||||||
constructor(options: ShardOptions) {
|
constructor(options: ShardOptions) {
|
||||||
this.options = Options({}, Shard.DEFAULTS, options);
|
this.options = Options(Shard.DEFAULTS, options);
|
||||||
|
|
||||||
this.bucket = createLeakyBucket({
|
this.bucket = createLeakyBucket({
|
||||||
max: 120,
|
max: 120,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user