Skip to content

Commit df64b97

Browse files
committed
aaa
1 parent d70149f commit df64b97

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/events/onServerAdd.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { ButtonBuilder, ButtonStyle, Client, ContainerBuilder, Events, Guild, MessageFlags } from "discord.js";
2+
import { logger } from "../libs/logger.js";
3+
import { SystemColors } from "../libs/colors.js";
4+
5+
export default {
6+
name: Events.GuildCreate,
7+
async execute(guild: Guild, client: Client) {
8+
logger.custom(`Added to the server with ID ${guild.id}`, "ADDED", "magenta");
9+
try {
10+
const owner = await guild.fetchOwner();
11+
const avatarUrl = client.user!.displayAvatarURL({ size: 1024 });
12+
13+
const termsBtn = new ButtonBuilder().setLabel('Terms of Service').setURL('https://boostify.breaddevv.cc/terms').setStyle(ButtonStyle.Link);
14+
const privacy = new ButtonBuilder().setLabel('Privacy Policy').setURL('https://boostify.breaddevv.cc/privacy').setStyle(ButtonStyle.Link);
15+
const github = new ButtonBuilder().setLabel('Our Repository').setURL('https://boostify.breaddevv.cc/github').setStyle(ButtonStyle.Link);
16+
17+
const container = new ContainerBuilder().addSectionComponents(comp =>
18+
comp
19+
.addTextDisplayComponents(text =>
20+
text.setContent(
21+
`## Thank you for adding me!\n` +
22+
`Hi! I'm Boostify! An open-source boosting bot to help you manage your server perks alongside your community!\n` +
23+
`Use some of the links below to have a better knowledge about me!`
24+
)
25+
)
26+
.setThumbnailAccessory(accessory => accessory.setURL(avatarUrl))
27+
)
28+
.addTextDisplayComponents(text => text.setContent(`-# You're receiving this text because you/other member added me to the server **${guild.name}** — In which you're the owner!`))
29+
.addActionRowComponents(row => row.addComponents(termsBtn, privacy, github))
30+
.setAccentColor(SystemColors.main);
31+
32+
await owner.send({
33+
components: [container],
34+
flags: MessageFlags.IsComponentsV2
35+
});
36+
} catch (err) {
37+
logger.error(`Failed fetching owner & dmming them on server: ${guild.id}: ${err}`);
38+
}
39+
}
40+
};

0 commit comments

Comments
 (0)