@@ -7,8 +7,8 @@ const { setTimeout: sleep } = require('node:timers/promises');
77const util = require ( 'node:util' ) ;
88const { GatewayIntentBits } = require ( 'discord-api-types/v10' ) ;
99const { fetch } = require ( 'undici' ) ;
10+ const { Client, MessageAttachment, Embed } = require ( '../src/index.js' ) ;
1011const { owner, token, webhookChannel, webhookToken } = require ( './auth.js' ) ;
11- const { Client, MessageAttachment, Embed, WebhookClient } = require ( '../src/index.js' ) ;
1212
1313const client = new Client ( { intents : [ GatewayIntentBits . Guilds , GatewayIntentBits . GuildMessages ] } ) ;
1414
@@ -84,30 +84,26 @@ client.on('messageCreate', async message => {
8484 if ( message . author . id !== owner ) return ;
8585 const match = message . content . match ( / ^ d o ( .+ ) $ / ) ;
8686 const hooks = [
87- { type : 'WebhookClient' , hook : new WebhookClient ( { id : webhookChannel , token : webhookToken } ) } ,
8887 { type : 'TextChannel#fetchWebhooks' , hook : await message . channel . fetchWebhooks ( ) . then ( x => x . first ( ) ) } ,
8988 { type : 'Guild#fetchWebhooks' , hook : await message . guild . fetchWebhooks ( ) . then ( x => x . first ( ) ) } ,
9089 ] ;
9190 if ( match ?. [ 1 ] === 'it' ) {
92- /* eslint-disable no-await-in-loop */
9391 for ( const { type, hook } of hooks ) {
9492 for ( const [ i , test ] of tests . entries ( ) ) {
9593 await message . channel . send ( `**#${ i } -Hook: ${ type } **\n\`\`\`js\n${ test . toString ( ) } \`\`\`` ) ;
96- await test ( message , hook ) . catch ( e => message . channel . send ( `Error!\n\`\`\`\n${ e } \`\`\`` ) ) ;
94+ await test ( message , hook ) . catch ( error => message . channel . send ( `Error!\n\`\`\`\n${ error } \`\`\`` ) ) ;
9795 await sleep ( 1_000 ) ;
9896 }
9997 }
100- /* eslint-enable no-await-in-loop */
10198 } else if ( match ) {
102- const n = parseInt ( match [ 1 ] ) || 0 ;
99+ const n = Number . parseInt ( match [ 1 ] ) || 0 ;
103100 const test = tests . slice ( n ) [ 0 ] ;
104101 const i = tests . indexOf ( test ) ;
105- /* eslint-disable no-await-in-loop */
102+
106103 for ( const { type, hook } of hooks ) {
107104 await message . channel . send ( `**#${ i } -Hook: ${ type } **\n\`\`\`js\n${ test . toString ( ) } \`\`\`` ) ;
108- await test ( message , hook ) . catch ( e => message . channel . send ( `Error!\n\`\`\`\n${ e } \`\`\`` ) ) ;
105+ await test ( message , hook ) . catch ( error => message . channel . send ( `Error!\n\`\`\`\n${ error } \`\`\`` ) ) ;
109106 }
110- /* eslint-enable no-await-in-loop */
111107 }
112108} ) ;
113109
0 commit comments