Get my bots webhook ID and Token on ready

Hi, Long story short - I accidentally deleted my database so I have lost webhook details of a few servers. I was wondering if I could add something into my ready event to regain my existing webhooks for my bot. My ideal one off solution would be on ready, to go get webhooks of guilds the bot is in, filter to my bot only, and then grab the ID and Token from it to write to my DB. I'm thinking of going down the await client.guilds.cache but honestly I haven't done Discord dev work in a while so I don't really know. Thanks.
4 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
ThatSameer
ThatSameerOP3y ago
node: v16.17.0 [email protected]
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ThatSameer
ThatSameerOP3y ago
awesome it worked. Only change I made was instead of client.guilds.fetch() I did
const guilds = await client.guilds.cache;
guilds.forEach(guild => {....
const guilds = await client.guilds.cache;
guilds.forEach(guild => {....
Have managed to update my DB with existing webhook information exactly as I needed. At least that's SOME recovery from accidentally deleting my database lol. Thannk you all very much
Want results from more Discord servers?
Add your server