Discord bot TypeError. Can't connect it to my server

I am trying to make a Discord bot that sends a specific message ("!clean") to a specified text channel on Discord every 30 minutes or something like that. I've run into a bunch of problems, and this is the furthest I've gotten. I get this error:

TypeError: Cannot read property 'find' of undefined

This is what happens when I try to start the bot: enter image description here

My Code

No, I did not write any of the code myself... This is my first time ever using JS. I copied someone else's code and combined it.

Edit: All I want to do is to make a simple bot that sends a message to a specific text channel, the message being "!clean" every 30 minutes. My attempts have all failed miserably.

Thanks for your assistance!

Upvotes: 0

Views: 1079

Answers (1)

Rek
Rek

Reputation: 149

Tad late, but when working with Eris, you cannot that easily access every channel from the Client. You can instead use Client.getChannel(<ChannelID>). If you must filter all channels, you can use Client.channelGuildMap which returns an Object of Guild IDs and their Channel IDs.

If the Channel ID changes based on what the user gives, make sure to check if the Channel allows sending messages!

(Be sure to replace Client with whatever your bot variable is :>)

EDIT: Keep in mind this as well: Bots ignore other bot accounts usually by design. To be on the safe side, you would have to make your own message purge command yourself. If this bot is running on a User account and not a bot account, I'd advise against that as you could be banned from Discord entirely.

Upvotes: 0

Related Questions