Skip to content

Webhook does not work if user has no avatar #529

Closed
@brndd

Description

@brndd

Relevant error:

2020-01-04T19:31:20.118Z error: Received error event from IRCCannot read property 'replace' of null {
  level: undefined,
  message: undefined,
  stack: "TypeError: Cannot read property 'replace' of null\n" +
    '    at Bot.getDiscordAvatar (/bot/dist/bot.js:9056:42)\n' +
    '    at Bot.sendToDiscord (/bot/dist/bot.js:9369:55)\n' +
    '    at Client.emit (events.js:210:5)\n' +
    '    at Client.<anonymous> (/bot/node_modules/irc-upd/lib/irc.js:581:22)\n' +
    '    at Client.emit (events.js:210:5)\n' +
    '    at /bot/node_modules/irc-upd/lib/irc.js:896:26\n' +
    '    at Array.forEach (<anonymous>)\n' +
    '    at Socket.handleData (/bot/node_modules/irc-upd/lib/irc.js:890:15)\n' +
    '    at Socket.emit (events.js:210:5)\n' +
    '    at addChunk (_stream_readable.js:309:12)',
  timestamp: '2020-01-04T19:31:20.118Z',
  splat: undefined,
  [Symbol(level)]: 'error',
  [Symbol(splat)]: [
    TypeError: Cannot read property 'replace' of null
        at Bot.getDiscordAvatar (/bot/dist/bot.js:9056:42)
        at Bot.sendToDiscord (/bot/dist/bot.js:9369:55)
        at Client.emit (events.js:210:5)
        at Client.<anonymous> (/bot/node_modules/irc-upd/lib/irc.js:581:22)
        at Client.emit (events.js:210:5)
        at /bot/node_modules/irc-upd/lib/irc.js:896:26
        at Array.forEach (<anonymous>)
        at Socket.handleData (/bot/node_modules/irc-upd/lib/irc.js:890:15)
        at Socket.emit (events.js:210:5)
        at addChunk (_stream_readable.js:309:12)
  ]
}

Config:

[
  {
    "nickname": "bot",
    "server": "irc.server.net",
    "discordToken": "redacted",
    "channelMapping": {
      "1234567890": "#channel"
    },
    "ircOptions": {
      "username": "hrsms"
    },
    "parallelPingFix": true,
    "format": {
        "webhookAvatarURL": "https://robohash.org/{$nickname}"
    },
    "webhooks": {
      "1234567890": "https://discordapp.com/api/webhooks/1234567890/aaaaaaaaaaaaaaa
    }
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions