File tree 3 files changed +25
-10
lines changed
3 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,11 @@ public async Task<Result> HelpAsync()
175
175
{
176
176
return Result . FromSuccess ( ) ;
177
177
}
178
+ if ( lease . Data . Appearance . HelpEmbed == null )
179
+ {
180
+ return new InvalidOperationError ( "Help embed is not available." ) ;
181
+ }
182
+
178
183
return ( Result ) await _feedback . SendContextualEmbedAsync
179
184
(
180
185
lease . Data . Appearance . HelpEmbed ,
Original file line number Diff line number Diff line change @@ -37,10 +37,11 @@ public sealed record PaginatedAppearanceOptions
37
37
ButtonComponent Previous ,
38
38
ButtonComponent Next ,
39
39
ButtonComponent Last ,
40
- ButtonComponent Close ,
41
- ButtonComponent Help ,
42
- Embed HelpEmbed ,
43
- string FooterFormat = "Page {0}/{1}"
40
+ ButtonComponent ? Close ,
41
+ ButtonComponent ? Help ,
42
+ Embed ? HelpEmbed ,
43
+ string FooterFormat = "Page {0}/{1}" ,
44
+ ButtonComponent [ ] ? CustomButtons = null
44
45
)
45
46
{
46
47
/// <summary>
@@ -94,7 +95,7 @@ public sealed record PaginatedAppearanceOptions
94
95
/// <summary>
95
96
/// Gets the appearance options' configured buttons as an array.
96
97
/// </summary>
97
- public IReadOnlyList < ButtonComponent > Buttons { get ; } = new [ ]
98
+ public IReadOnlyList < ButtonComponent ? > Buttons { get ; } = new [ ]
98
99
{
99
100
First ,
100
101
Previous ,
Original file line number Diff line number Diff line change @@ -156,6 +156,19 @@ public Embed GetCurrentPage()
156
156
/// <returns>The buttons.</returns>
157
157
public IReadOnlyList < IMessageComponent > GetCurrentComponents ( )
158
158
{
159
+ List < ButtonComponent > customComponents = new List < ButtonComponent > ( ) ;
160
+ if ( this . Appearance . Help != null )
161
+ {
162
+ customComponents . Add ( this . Appearance . Help with { CustomID = CustomIDHelpers . CreateButtonID ( "help" ) } ) ;
163
+ }
164
+ if ( this . Appearance . Close != null )
165
+ {
166
+ customComponents . Add ( this . Appearance . Close with { CustomID = CustomIDHelpers . CreateButtonID ( "close" ) } ) ;
167
+ }
168
+ if ( this . Appearance . CustomButtons != null )
169
+ {
170
+ customComponents . AddRange ( this . Appearance . CustomButtons ) ;
171
+ }
159
172
return new [ ]
160
173
{
161
174
new ActionRowComponent
@@ -186,11 +199,7 @@ this.Appearance.Last with
186
199
) ,
187
200
new ActionRowComponent
188
201
(
189
- new [ ]
190
- {
191
- this . Appearance . Close with { CustomID = CustomIDHelpers . CreateButtonID ( "close" ) } ,
192
- this . Appearance . Help with { CustomID = CustomIDHelpers . CreateButtonID ( "help" ) }
193
- }
202
+ customComponents
194
203
)
195
204
} ;
196
205
}
You can’t perform that action at this time.
0 commit comments