SileNce5k / discord_bot

My second attempt at making a bot in javascript
The Unlicense
0 stars 0 forks source link

Bot crashes if no custom message is provided with a timer command #59

Closed SileNce5k closed 1 year ago

SileNce5k commented 1 year ago

Example: User: \<prefix> timer 10m Bot: Please specify a time, and a message to send after the timer has finished \<Bot crashes after sending this message>

The issue happens in both devbot and master branch

SileNce5k commented 1 year ago

Anonymized log:

User(id: <id>) executed timer with '10m' as arguments in 1.32 ms
sendText:  <ref *1> Message {
  channelId: '<channelID>',
  guildId: '<guildid>',
  id: '<id>',
  createdTimestamp: 1687856588436,
  type: 'DEFAULT',
  system: false,
  content: 'Please specify a time, and a message to send after the timer has finished',
  author: ClientUser {
    id: '<idofbot>',
    bot: true,
    system: false,
    flags: UserFlags { bitfield: 0 },
    username: '<usernameofbot>',
    discriminator: '<discrim>',
    avatar: '<avatar>',
    banner: undefined,
    accentColor: undefined,
    verified: true,
    mfaEnabled: true
  },
  pinned: false,
  tts: false,
  nonce: null,
  embeds: [],
  components: [],
  attachments: Collection(0) [Map] {},
  stickers: Collection(0) [Map] {},
  editedTimestamp: null,
  reactions: ReactionManager { message: [Circular *1] },
  mentions: MessageMentions {
    everyone: false,
    users: Collection(0) [Map] {},
    roles: Collection(0) [Map] {},
    _members: null,
    _channels: null,
    _parsedUsers: null,
    crosspostedChannels: Collection(0) [Map] {},
    repliedUser: null
  },
  webhookId: null,
  groupActivityApplication: null,
  applicationId: null,
  activity: null,
  flags: MessageFlags { bitfield: 0 },
  reference: null,
  interaction: null
}
<basedir>/node_modules/discord.js/src/structures/MessagePayload.js:137
        throw new RangeError('MESSAGE_NONCE_TYPE');
              ^

RangeError [MESSAGE_NONCE_TYPE]: Message nonce must be an integer or a string.
    at MessagePayload.resolveData (<basedir>/node_modules/discord.js/src/structures/MessagePayload.js:137:15)
    at TextChannel.send (<basedir>/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:61)
    at Object.execute (<basedir>/commands/misc/timer.js:41:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [Symbol(code)]: 'MESSAGE_NONCE_TYPE'
}