x
This commit is contained in:
		
							parent
							
								
									a47d5ae770
								
							
						
					
					
						commit
						1c515dcb37
					
				
					 2 changed files with 17 additions and 16 deletions
				
			
		|  | @ -47,33 +47,26 @@ export class DiscordAPIError extends Error { | ||||||
| 
 | 
 | ||||||
|   constructor(error: string | DiscordAPIErrorPayload) { |   constructor(error: string | DiscordAPIErrorPayload) { | ||||||
|     super() |     super() | ||||||
|     const err: any = typeof error === 'object' ? { ...error } : {} |  | ||||||
|     delete err.url |  | ||||||
|     delete err.status |  | ||||||
|     delete err.message |  | ||||||
| 
 |  | ||||||
|     const fmt = Object.entries( |     const fmt = Object.entries( | ||||||
|       typeof error === 'object' ? simplifyAPIError(error.errors) : {} |       typeof error === 'object' ? simplifyAPIError(error.errors) : {} | ||||||
|     ) |     ) | ||||||
|     this.message = |     this.message = | ||||||
|       typeof error === 'string' |       typeof error === 'string' | ||||||
|         ? error |         ? `${error} ` | ||||||
|         : `\n${error.method} ${error.url.slice(7)} returned ${error.status}\n${ |         : `\n${error.method} ${error.url.slice(7)} returned ${error.status}\n(${ | ||||||
|             error.message |             error.code ?? 'unknown' | ||||||
|           }${ |           }) ${error.message}${ | ||||||
|             fmt.length === 0 |             fmt.length === 0 | ||||||
|               ? '' |               ? '' | ||||||
|               : fmt |               : `\n${fmt | ||||||
|                   .map( |                   .map( | ||||||
|                     (e) => |                     (e) => | ||||||
|                       `    at ${e[0]}:\n${e[1] |                       `  at ${e[0]}:\n${e[1] | ||||||
|                         .map((e) => `      - ${e}`) |                         .map((e) => `   - ${e}`) | ||||||
|                         .join('\n')}` |                         .join('\n')}` | ||||||
|                   ) |                   ) | ||||||
|                   .join('\n') |                   .join('\n')}\n` | ||||||
|           } ${Deno.inspect(err, { |           }` | ||||||
|             depth: Infinity |  | ||||||
|           })}` |  | ||||||
|     if (typeof error === 'object') this.error = error |     if (typeof error === 'object') this.error = error | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -119,6 +119,14 @@ client.on('messageCreate', async (msg: Message) => { | ||||||
|   } else if (msg.content === '!react') { |   } else if (msg.content === '!react') { | ||||||
|     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
 |     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
 | ||||||
|     msg.addReaction('😂') |     msg.addReaction('😂') | ||||||
|  |     msg.channel.send('x'.repeat(6969), { | ||||||
|  |       embed: new Embed() | ||||||
|  |         .setTitle('pepega'.repeat(6969)) | ||||||
|  |         .setDescription('pepega'.repeat(6969)) | ||||||
|  |         .addField('uwu', 'uwu'.repeat(6969)) | ||||||
|  |         .addField('uwu', 'uwu'.repeat(6969)) | ||||||
|  |         .setFooter('uwu'.repeat(6969)) | ||||||
|  |     }) | ||||||
|   } else if (msg.content === '!wait_for') { |   } else if (msg.content === '!wait_for') { | ||||||
|     msg.channel.send('Send anything!') |     msg.channel.send('Send anything!') | ||||||
|     const [receivedMsg] = await client.waitFor( |     const [receivedMsg] = await client.waitFor( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue