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) {
|
||||
super()
|
||||
const err: any = typeof error === 'object' ? { ...error } : {}
|
||||
delete err.url
|
||||
delete err.status
|
||||
delete err.message
|
||||
|
||||
const fmt = Object.entries(
|
||||
typeof error === 'object' ? simplifyAPIError(error.errors) : {}
|
||||
)
|
||||
this.message =
|
||||
typeof error === 'string'
|
||||
? error
|
||||
: `\n${error.method} ${error.url.slice(7)} returned ${error.status}\n${
|
||||
error.message
|
||||
}${
|
||||
? `${error} `
|
||||
: `\n${error.method} ${error.url.slice(7)} returned ${error.status}\n(${
|
||||
error.code ?? 'unknown'
|
||||
}) ${error.message}${
|
||||
fmt.length === 0
|
||||
? ''
|
||||
: fmt
|
||||
: `\n${fmt
|
||||
.map(
|
||||
(e) =>
|
||||
` at ${e[0]}:\n${e[1]
|
||||
.map((e) => ` - ${e}`)
|
||||
` at ${e[0]}:\n${e[1]
|
||||
.map((e) => ` - ${e}`)
|
||||
.join('\n')}`
|
||||
)
|
||||
.join('\n')
|
||||
} ${Deno.inspect(err, {
|
||||
depth: Infinity
|
||||
})}`
|
||||
.join('\n')}\n`
|
||||
}`
|
||||
if (typeof error === 'object') this.error = error
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,14 @@ client.on('messageCreate', async (msg: Message) => {
|
|||
} else if (msg.content === '!react') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
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') {
|
||||
msg.channel.send('Send anything!')
|
||||
const [receivedMsg] = await client.waitFor(
|
||||
|
|
Loading…
Reference in a new issue