ChatSift / ModMail

Helping sift through user concerns
Other
29 stars 31 forks source link

DMing the bot a message with no content causes a hard crash #38

Closed configari closed 2 years ago

configari commented 2 years ago

CombinedError: Received one or more errors
    at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:111:21)
    at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
    at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
    at null.sendMemberThreadMessage (/root/mod/ModMail/packages/bot/src/util/sendMemberThreadMessage.ts:40:5)
    at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:384:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21) {
  errors: [
    ExpectedValidationError: Expected values to be equals
        at LiteralValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/LiteralValidator.ts:17:17)
        at LiteralValidator.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:62:21)
        at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:106:29)
        at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
        at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
        at null.sendMemberThreadMessage (/root/mod/ModMail/packages/bot/src/util/sendMemberThreadMessage.ts:40:5)
        at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9) {
      validator: 's.literal(V)',
      given: '',
      expected: null
    },
    ExpectedConstraintError: Invalid string length
        at Object.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/constraints/StringConstraints.ts:40:18)
        at StringValidator.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:66:24)
        at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:106:29)
        at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
        at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
        at null.sendMemberThreadMessage (/root/mod/ModMail/packages/bot/src/util/sendMemberThreadMessage.ts:40:5)
        at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9) {
      constraint: 's.string.lengthGreaterThanOrEqual',
      given: '',
      expected: 'expected.length >= 1'
    }
  ]
}```
configari commented 2 years ago

This happened to me while sending an attachment.

configari commented 2 years ago

It might be with my dependencies? I'm using Node 16 and yarn 3.2.1.

Tamim468 commented 2 years ago

vouch ❤️

didinele commented 2 years ago

So, just to confirm, this is reproduceable when the user DMs an attachment to the bot?

didinele commented 2 years ago

Nevermind. Can reproduce. Seems I don't account for there being no message content. Will look into this issue shortly.

didinele commented 2 years ago

Can you update to the latest commit (1134d3047dc8d4bf7b99ef3fc53cfe2c88d8d837)? Should be fixed now.

configari commented 2 years ago

Even if the user has a message content it does not appear in the embed for some reason..

didinele commented 2 years ago

Even if the user has a message content it does not appear in the embed for some reason..

That would be because you haven't enabled the message content intent in the dev portal, most likely.

configari commented 2 years ago

I have enabled every intent.

didinele commented 2 years ago

Regardless, try things again on the latest commit and let me know if you can still reproduce the original problem.

configari commented 2 years ago

Okay, thank you.

configari commented 2 years ago

Still happens for me I did git pull, message content etc intent is enabled though.


CombinedError: Received one or more errors
    at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:111:21)
    at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
    at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
    at null.sendMemberThreadMessage (/root/mod/ModMail/packages/bot/src/util/sendMemberThreadMessage.ts:40:5)
    at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:384:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21) {
  errors: [
    ExpectedValidationError: Expected values to be equals
        at LiteralValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/LiteralValidator.ts:17:17)
        at LiteralValidator.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:62:21)
        at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:106:29)
        at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
        at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
        at null.sendMemberThreadMessage (/root/mod/ModMail/packages/bot/src/util/sendMemberThreadMessage.ts:40:5)
        at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9) {
      validator: 's.literal(V)',
      given: '',
      expected: null
    },
    ExpectedConstraintError: Invalid string length
        at Object.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/constraints/StringConstraints.ts:40:18)
        at StringValidator.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:66:24)
        at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:106:29)
        at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
        at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
        at null.sendMemberThreadMessage (/root/mod/ModMail/packages/bot/src/util/sendMemberThreadMessage.ts:40:5)
        at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9) {
      constraint: 's.string.lengthGreaterThanOrEqual',
      given: '',
      expected: 'expected.length >= 1'
    }
  ]
}```
didinele commented 2 years ago

Did you actually re-build? yarn build

configari commented 2 years ago

Oop- I forgot. Sorry, but attachment + message does not work:


CombinedError: Received one or more errors
    at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
(Use `node --trace-warnings ...` to show where the warning was created)
    at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:111:21)
    at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
    at default_1.handle (/root/mod/ModMail/packages/bot/src/events/modmail/modmailMessageCreate.ts:114:9)
    ExpectedValidationError: Expected values to be equals
        at LiteralValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/LiteralValidator.ts:17:17)
        at LiteralValidator.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:62:21)
        at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
    ExpectedConstraintError: Invalid string length
        at Object.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/constraints/StringConstraints.ts:40:18)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:177381) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
CombinedError: Received one or more errors
    at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:111:21)
    at UnionValidator.parse (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:80:86)
    at EmbedBuilder.setDescription (/root/mod/ModMail/node_modules/@discordjs/builders/src/messages/embed/Embed.ts:56:52)
    at processTicksAndRejections (node:internal/process/task_queues:85:21) {
        at UnionValidator.handle (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/validators/UnionValidator.ts:106:29)
    ExpectedConstraintError: Invalid string length
        at Object.run (/root/mod/ModMail/node_modules/@sapphire/shapeshift/src/constraints/StringConstraints.ts:40:18)
      expected: 'expected.length >= 1'
    }```
didinele commented 2 years ago

I... can't seem to reproduce?

What did you DM to the bot?

configari commented 2 years ago

A message + gif (not from gif picker)

didinele commented 2 years ago

Like... did you literally upload a gif file? let me have a look

didinele commented 2 years ago

Nope. Cannot reproduce. What gif file are you using?

configari commented 2 years ago

Alright, after ubuntu restart it works. Sorry if I made you wait long.