I'm using Discord.js to create a basic Discord bot. When the bot is first started, I run client.guilds.array() to get a list of all guilds that the bot is currently subscribed to. I save this to a database that's used by other programs.
However, as people add / remove the bot from their guilds, I'd like to keep an updated list of guilds. I realize I could just re-run clients.guilds.array() every minute or something, but that seems inefficient.
Is there an event that fires when your bot is added to a guild and/or channel? From what I've read, the guildMemberAdd event seems to fire for all users / bots who are already subscribed to the guild. Is there any such event to let your bot know when it's been added to a guild?