1
+ using System ;
1
2
using System . Collections . Generic ;
2
3
using System . Linq ;
3
4
@@ -52,6 +53,21 @@ public static BuilderT WithTextDisplay<BuilderT>(this BuilderT container,
52
53
. WithContent ( content )
53
54
. WithId ( id ) ) ;
54
55
56
+ /// <summary>
57
+ /// Adds a <see cref="TextDisplayBuilder"/> to the container.
58
+ /// </summary>
59
+ /// <returns>
60
+ /// The current container.
61
+ /// </returns>
62
+ public static BuilderT WithTextDisplay < BuilderT > ( this BuilderT container ,
63
+ Action < TextDisplayBuilder > options )
64
+ where BuilderT : class , IStaticComponentContainer
65
+ {
66
+ var comp = new TextDisplayBuilder ( ) ;
67
+ options ( comp ) ;
68
+ return container . WithTextDisplay ( comp ) ;
69
+ }
70
+
55
71
/// <summary>
56
72
/// Adds a <see cref="SectionBuilder"/> to the container.
57
73
/// </summary>
@@ -65,6 +81,21 @@ public static BuilderT WithSection<BuilderT>(this BuilderT container, SectionBui
65
81
return container ;
66
82
}
67
83
84
+ /// <summary>
85
+ /// Adds a <see cref="SectionBuilder"/> to the container.
86
+ /// </summary>
87
+ /// <returns>
88
+ /// The current container.
89
+ /// </returns>
90
+ public static BuilderT WithSection < BuilderT > ( this BuilderT container ,
91
+ Action < SectionBuilder > options )
92
+ where BuilderT : class , IStaticComponentContainer
93
+ {
94
+ var comp = new SectionBuilder ( ) ;
95
+ options ( comp ) ;
96
+ return container . WithSection ( comp ) ;
97
+ }
98
+
68
99
/// <summary>
69
100
/// Adds a <see cref="SectionBuilder"/> to the container.
70
101
/// </summary>
@@ -122,6 +153,21 @@ public static BuilderT WithMediaGallery<BuilderT>(this BuilderT container,
122
153
. WithItems ( urls . Select ( x => new MediaGalleryItemProperties ( new UnfurledMediaItemProperties ( x ) ) ) )
123
154
. WithId ( id ) ) ;
124
155
156
+ /// <summary>
157
+ /// Adds a <see cref="MediaGalleryBuilder"/> to the container.
158
+ /// </summary>
159
+ /// <returns>
160
+ /// The current container.
161
+ /// </returns>
162
+ public static BuilderT WithMediaGallery < BuilderT > ( this BuilderT container ,
163
+ Action < MediaGalleryBuilder > options )
164
+ where BuilderT : class , IStaticComponentContainer
165
+ {
166
+ var comp = new MediaGalleryBuilder ( ) ;
167
+ options ( comp ) ;
168
+ return container . WithMediaGallery ( comp ) ;
169
+ }
170
+
125
171
/// <summary>
126
172
/// Adds a <see cref="SeparatorBuilder"/> to the container.
127
173
/// </summary>
@@ -151,6 +197,21 @@ public static BuilderT WithSeparator<BuilderT>(this BuilderT container,
151
197
. WithIsDivider ( isDivider )
152
198
. WithId ( id ) ) ;
153
199
200
+ /// <summary>
201
+ /// Adds a <see cref="SeparatorBuilder"/> to the container.
202
+ /// </summary>
203
+ /// <returns>
204
+ /// The current container.
205
+ /// </returns>
206
+ public static BuilderT WithSeparator < BuilderT > ( this BuilderT container ,
207
+ Action < SeparatorBuilder > options )
208
+ where BuilderT : class , IStaticComponentContainer
209
+ {
210
+ var comp = new SeparatorBuilder ( ) ;
211
+ options ( comp ) ;
212
+ return container . WithSeparator ( comp ) ;
213
+ }
214
+
154
215
/// <summary>
155
216
/// Adds a <see cref="FileComponentBuilder"/> to the container.
156
217
/// </summary>
@@ -180,6 +241,21 @@ public static BuilderT WithFile<BuilderT>(this BuilderT container,
180
241
. WithIsSpoiler ( isSpoiler )
181
242
. WithId ( id ) ) ;
182
243
244
+ /// <summary>
245
+ /// Adds a <see cref="FileComponentBuilder"/> to the container.
246
+ /// </summary>
247
+ /// <returns>
248
+ /// The current container.
249
+ /// </returns>
250
+ public static BuilderT WithFile < BuilderT > ( this BuilderT container ,
251
+ Action < FileComponentBuilder > options )
252
+ where BuilderT : class , IStaticComponentContainer
253
+ {
254
+ var comp = new FileComponentBuilder ( ) ;
255
+ options ( comp ) ;
256
+ return container . WithFile ( comp ) ;
257
+ }
258
+
183
259
/// <summary>
184
260
/// Adds a <see cref="ContainerBuilder"/> to the container.
185
261
/// </summary>
@@ -223,6 +299,21 @@ public static BuilderT WithContainer<BuilderT>(this BuilderT container,
223
299
=> container . WithContainer ( new ContainerBuilder ( )
224
300
. WithComponents ( components ) ) ;
225
301
302
+ /// <summary>
303
+ /// Adds a <see cref="ContainerBuilder"/> to the container.
304
+ /// </summary>
305
+ /// <returns>
306
+ /// The current container.
307
+ /// </returns>
308
+ public static BuilderT WithContainer < BuilderT > ( this BuilderT container ,
309
+ Action < ContainerBuilder > options )
310
+ where BuilderT : class , IStaticComponentContainer
311
+ {
312
+ var comp = new ContainerBuilder ( ) ;
313
+ options ( comp ) ;
314
+ return container . WithContainer ( comp ) ;
315
+ }
316
+
226
317
/// <summary>
227
318
/// Adds a <see cref="ButtonBuilder"/> to the container.
228
319
/// </summary>
@@ -262,6 +353,21 @@ public static BuilderT WithButton<BuilderT>(this BuilderT container,
262
353
. WithSkuId ( skuId )
263
354
. WithId ( id ) ) ;
264
355
356
+ /// <summary>
357
+ /// Adds a <see cref="ButtonBuilder"/> to the container.
358
+ /// </summary>
359
+ /// <returns>
360
+ /// The current container.
361
+ /// </returns>
362
+ public static BuilderT WithButton < BuilderT > ( this BuilderT container ,
363
+ Action < ButtonBuilder > options )
364
+ where BuilderT : class , IInteractableComponentContainer
365
+ {
366
+ var comp = new ButtonBuilder ( ) ;
367
+ options ( comp ) ;
368
+ return container . WithButton ( comp ) ;
369
+ }
370
+
265
371
/// <summary>
266
372
/// Adds a <see cref="SelectMenuBuilder"/> to the container.
267
373
/// </summary>
@@ -306,6 +412,21 @@ public static BuilderT WithSelectMenu<BuilderT>(this BuilderT container,
306
412
. WithDefaultValues ( defaultValues )
307
413
. WithId ( id ) ) ;
308
414
415
+ /// <summary>
416
+ /// Adds a <see cref="ButtonBuilder"/> to the container.
417
+ /// </summary>
418
+ /// <returns>
419
+ /// The current container.
420
+ /// </returns>
421
+ public static BuilderT WithSelectMenu < BuilderT > ( this BuilderT container ,
422
+ Action < SelectMenuBuilder > options )
423
+ where BuilderT : class , IInteractableComponentContainer
424
+ {
425
+ var comp = new SelectMenuBuilder ( ) ;
426
+ options ( comp ) ;
427
+ return container . WithSelectMenu ( comp ) ;
428
+ }
429
+
309
430
/// <summary>
310
431
/// Adds a <see cref="ActionRowBuilder"/> to the container.
311
432
/// </summary>
@@ -333,6 +454,21 @@ public static BuilderT WithActionRow<BuilderT>(this BuilderT container,
333
454
. WithComponents ( components )
334
455
. WithId ( id ) ) ;
335
456
457
+ /// <summary>
458
+ /// Adds a <see cref="SectionBuilder"/> to the container.
459
+ /// </summary>
460
+ /// <returns>
461
+ /// The current container.
462
+ /// </returns>
463
+ public static BuilderT WithActionRow < BuilderT > ( this BuilderT container ,
464
+ Action < ActionRowBuilder > options )
465
+ where BuilderT : class , IStaticComponentContainer
466
+ {
467
+ var cont = new ActionRowBuilder ( ) ;
468
+ options ( cont ) ;
469
+ return container . WithActionRow ( cont ) ;
470
+ }
471
+
336
472
/// <summary>
337
473
/// Finds the first <see cref="IMessageComponentBuilder"/> in the <see cref="IComponentContainer"/>
338
474
/// or any of its child <see cref="IComponentContainer"/>s with matching id.
0 commit comments