Skip to content

Commit

Permalink
Fix removing guild from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanMGit committed Feb 7, 2023
1 parent 42a7cbe commit 13f09a3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ client.login(process.env.TOKEN);
//ooggagaga

client.on(Events.GuildCreate, async (guild) => {
console.log("Joined a new guild: " + guild.name);
console.log("Joined a new guild: " + guild.name + " - " + guild.id + " - " + guild.ownerId);
// add guild to database
saveGuild(guild.id, guild.name);
});

client.on(Events.GuildDelete, async (guild) => {
console.log("Left a guild: " + guild.name);
console.log("Left a guild: " + guild.name + " - " + guild.id + " - " + guild.ownerId);
// remove guild from database
removeGuild(guild);
removeGuild(guild.id);
});

client.on(Events.ClientReady, () => {
Expand All @@ -69,3 +69,10 @@ client.on(Events.ClientReady, () => {
});
})

client.on(Events.ClientReady, () => {
// list all guilds the bot is in
client.guilds.cache.forEach((guild) => {
console.log(guild.name + " - " + guild.id);
}
);
});

0 comments on commit 13f09a3

Please sign in to comment.