简体   繁体   中英

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: 在此处输入图像描述

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.

  • I use Node 14.4.0

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM