MysteryPancake / Discord-Reposter

Bot for reposting Discord messages (work in progress)
MIT License
92 stars 121 forks source link

TypeError: from.guild.members.values is not a function or its return value is not iterable #50

Open Kuromi789 opened 4 years ago

Kuromi789 commented 4 years ago

I have absolutely no knowledge about coding, but I managed to solve most issues by using google.

(node:11104) UnhandledPromiseRejectionWarning: TypeError: from.guild.channels.values is not a function or its return value is not iterable at sendInfo (C:\Users\:316:45) at repost (C:\Users\:421:10) at processTicksAndRejections (internal/process/task_queues.js:97:5)

(node:11104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:11104) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Though I can't seem to find what would be wrong here. I believe it is this part.

} rich.setTimestamp(); if (from.parent) { rich.addField("Channel Category", from.parent.name, true); } rich.addField("NSFW Channel", from.nsfw || "false", true); rich.addField("Channel ID", from.id, true); rich.addField("Channel Type", from.type, true); rich.addField("Channel Creation Date", from.createdAt, true); rich.addField("Channel Creation Time", from.createdTimestamp, true); if (from.guild) { rich.addField("Server ID", from.guild.id, true); rich.addField("Server Owner", niceName(to, from, from.guild.owner.user), true); rich.addField("Server Region", from.guild.region, true); const channels = new Map(); for (const channel of from.guild.channels.values()) { channels.set(channel.type, (channels.get(channel.type) || 0) + 1); } for (const channel of channels.entries()) { rich.addField(capitalizeFirst(channel[0]) + " Channels", channel[1], true); } let bots = 0; for (const member of from.guild.members.values()) { if (member.user.bot) { bots++; } }

MysteryPancake commented 3 years ago

This may be an issue with the Discord.js API version 12. I have updated the bot to v12 now, please see if this is still an issue.