File tree Expand file tree Collapse file tree 4 files changed +40
-7
lines changed Expand file tree Collapse file tree 4 files changed +40
-7
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ import {
92
92
type RESTPostAPIGuildsMFAResult ,
93
93
type RESTPostAPIGuildsResult ,
94
94
type RESTPutAPIGuildBanJSONBody ,
95
+ type RESTPutAPIGuildOnboardingJSONBody ,
96
+ type RESTPutAPIGuildOnboardingResult ,
95
97
type RESTPutAPIGuildTemplateSyncResult ,
96
98
type Snowflake ,
97
99
} from 'discord-api-types/v10' ;
@@ -1252,15 +1254,13 @@ export class GuildsAPI {
1252
1254
*/
1253
1255
public async editOnboarding (
1254
1256
guildId : Snowflake ,
1255
- body : any ,
1256
- // body: RESTPutAPIGuildOnboardingJSONBody,
1257
+ body : RESTPutAPIGuildOnboardingJSONBody ,
1257
1258
{ reason, signal } : Pick < RequestData , 'reason' | 'signal' > = { } ,
1258
1259
) {
1259
1260
return this . rest . put ( Routes . guildOnboarding ( guildId ) , {
1260
1261
reason,
1261
1262
body,
1262
1263
signal,
1263
- } ) as Promise < any > ;
1264
- // }) as Promise<RESTPutAPIGuildOnboardingResult>;
1264
+ } ) as Promise < RESTPutAPIGuildOnboardingResult > ;
1265
1265
}
1266
1266
}
Original file line number Diff line number Diff line change @@ -909,7 +909,7 @@ class Guild extends AnonymousGuild {
909
909
* @returns {Promise<GuildOnboarding> }
910
910
*/
911
911
async editOnboarding ( options ) {
912
- const newData = await this . client . rest . put ( `/guilds/ ${ this . id } /onboarding` , {
912
+ const newData = await this . client . rest . put ( Routes . guildOnboarding ( this . id ) , {
913
913
body : {
914
914
prompts : options . prompts . map ( prompt => ( {
915
915
title : prompt . title ,
Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ import {
166
166
APIGuildOnboardingPrompt ,
167
167
APIGuildOnboardingPromptOption ,
168
168
GuildOnboardingPromptType ,
169
+ GuildOnboardingMode ,
169
170
} from 'discord-api-types/v10' ;
170
171
import { ChildProcess } from 'node:child_process' ;
171
172
import { EventEmitter } from 'node:events' ;
@@ -1578,8 +1579,6 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
1578
1579
public valueOf ( ) : string ;
1579
1580
}
1580
1581
1581
- type GuildOnboardingMode = any ;
1582
-
1583
1582
export class GuildOnboarding extends Base {
1584
1583
private constructor ( client : Client , data : RESTGetAPIGuildOnboardingResult ) ;
1585
1584
public get guild ( ) : Guild ;
Original file line number Diff line number Diff line change
1
+ import { Client , GatewayIntentBits } from './packages/discord.js/src/index.js' ;
2
+
3
+ const client = new Client ( {
4
+ intents : GatewayIntentBits . Guilds ,
5
+ } ) ;
6
+
7
+ client . on ( 'ready' , async ( ) => {
8
+ console . log ( 'Ready!' ) ;
9
+
10
+ const guild = client . guilds . cache . get ( '505181778718228480' ) ;
11
+
12
+ const onboarding = await guild . fetchOnboarding ( ) ;
13
+
14
+ console . log ( onboarding ) ;
15
+
16
+ const newOnboarding = await guild . editOnboarding ( {
17
+ // enabled: true,
18
+ // mode: GuildOnboardingMode.OnboardingAdvanced,
19
+
20
+ defaultChannels : [
21
+ '969941543337218088' ,
22
+ '969941501415153674' ,
23
+ '969941431227658310' ,
24
+ '1003418048260231209' ,
25
+ '1020724886848671856' ,
26
+ '1020725777857257555' ,
27
+ '1088171977312849921' ,
28
+ ] ,
29
+ } ) ;
30
+
31
+ console . log ( newOnboarding ) ;
32
+ } ) ;
33
+
34
+ await client . login ( ) ;
You can’t perform that action at this time.
0 commit comments