Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshu05 authored Feb 17, 2023
1 parent fed5694 commit 69bf887
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
32 changes: 32 additions & 0 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,36 @@ for(const file of eventFiles){
client.on(event.name, (...args) => event.execute(...args, commands))
}
}
client.on('guildCreate' , guild => {
const guild_embed = new MessageEmbed()
.setColor('00FFFF')
.setTitle('New Guild!')
.setDescription(`Elpha has joined the server ${guild.name}`)
.addFields(
{name: 'Members:', value: `${guild.memberCount}`},
{name: 'Guild ID:', value: `${guild.id}`},
{name: 'Guild owner:', value: `> <@${guild.ownerId}> \`[${guild.ownerId}]\``},
{name: 'Total servers:', value: `${await client.guilds.cache.size}`},
)
.setThumbnail(guild.iconURL())
.setTimestamp()
client.channels.cache.get('919799899929841694').send({embeds: [guild_embed]})
})
client.on('guildDelete' , guild => {
if(guild.available){
const embed = new MessageEmbed()
.setColor('00FFFF')
.setTitle('Guild Left')
.setDescription(`Elpha has left the server ${guild.name}`)
.addFields(
{name: 'Members:', value: `${guild.memberCount}`},
{name: 'Guild ID:', value: `${guild.id}`},
{name: 'Guild owner:', value: `> <@${guild.ownerId}> \`[${guild.ownerId}]\``},
{name: 'Total servers:', value: `${await client.guilds.cache.size}`},
)
.setThumbnail(guild.iconURL())
.setTimestamp()
client.channels.cache.get('919799899929841694').send({embeds: [embed]})
}
})
client.login(process.env.token)
13 changes: 0 additions & 13 deletions events/guildCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ module.exports = {
)
.setTimestamp()
channel.send({ embeds: [embed], components: [repo, ser, web] }).catch((err) => console.log(err))
const guild_embed = new MessageEmbed()
.setColor('00FFFF')
.setTitle('New Guild!')
.setDescription(`Elpha has joined the server ${guild.name}`)
.addFields(
{name: 'Members:', value: `${guild.memberCount}`},
{name: 'Guild ID:', value: `${guild.id}`},
{name: 'Guild owner:', value: `> <@${guild.ownerId}> \`[${guild.ownerId}]\``},
{name: 'Total servers:', value: `${await client.guilds.cache.size}`},
)
.setThumbnail(guild.iconURL())
.setTimestamp()
client.channels.cache.get('919799899929841694').send({embeds: [guild_embed]})
console.log(`Server joined: ${guild.name}`)
}
}
14 changes: 0 additions & 14 deletions events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js')
module.exports = {
name: 'guildDelete',
async execute(guild, client) {
if(guild.available){
console.log(`Server left: ${guild.name}`)
const embed = new MessageEmbed()
.setColor('00FFFF')
.setTitle('Guild Left')
.setDescription(`Elpha has left the server ${guild.name}`)
.addFields(
{name: 'Members:', value: `${guild.memberCount}`},
{name: 'Guild ID:', value: `${guild.id}`},
{name: 'Guild owner:', value: `> <@${guild.ownerId}> \`[${guild.ownerId}]\``},
{name: 'Total servers:', value: `${await client.guilds.cache.size}`},
)
.setThumbnail(guild.iconURL())
.setTimestamp()
client.channels.cache.get('919799899929841694').send({embeds: [embed]})
}
}
}

0 comments on commit 69bf887

Please sign in to comment.