Skip to content

Commit

Permalink
fix: handle errors on default callbacks (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzDerock committed Sep 29, 2022
1 parent ac1e46e commit 9a0b8a9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export async function generateFromMessages<T extends ExportReturnType = ExportRe
messages: transformedMessages,
channel,
saveImages: options.saveImages ?? false,
callbacks: options.callbacks ?? {
resolveChannel: async (id) => channel.client.channels.fetch(id),
resolveUser: async (id) => channel.client.users.fetch(id),
resolveRole: channel.isDMBased() ? () => null : async (id) => channel.guild?.roles.fetch(id),
callbacks: {
resolveChannel: async (id) => channel.client.channels.fetch(id).catch(() => null),
resolveUser: async (id) => channel.client.users.fetch(id).catch(() => null),
resolveRole: channel.isDMBased() ? () => null : async (id) => channel.guild?.roles.fetch(id).catch(() => null),

...(options.callbacks ?? {}),
},
poweredBy: options.poweredBy ?? true,
favicon: options.favicon ?? 'guild',
Expand Down

0 comments on commit 9a0b8a9

Please sign in to comment.