Skip to content

Commit

Permalink
[Fix] Update Activity after joining and leaving servers
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Aug 30, 2021
1 parent a484a61 commit 8ce2a24
Show file tree
Hide file tree
Showing 3 changed files with 1,914 additions and 11 deletions.
4 changes: 4 additions & 0 deletions events/guildCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ module.exports = {
name: "guildCreate",
async execute(guild) {
await registerSlashCommands(guild.client.user.id, guild.id);
const guilds = guild.client.guilds.cache.map((guild) => guild.id);
guild.client.user.setActivity(`${guilds.length} Servers!`, {
type: "WATCHING",
});
},
};
4 changes: 4 additions & 0 deletions events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
name: "guildDelete",
async execute(guild) {
const guilds = guild.client.guilds.cache.map((guild) => guild.id);
guild.client.user.setActivity(`${guilds.length} Servers!`, {
type: "WATCHING",
});
try {
await guild.commands.set([]);
} catch (err) {
Expand Down
Loading

0 comments on commit 8ce2a24

Please sign in to comment.