-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
70 lines (58 loc) · 3.45 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const Discord = require('discord.js');
const client = new Discord.Client({
intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildMessages, Discord.GatewayIntentBits.MessageContent, Discord.GatewayIntentBits.GuildMembers, Discord.GatewayIntentBits.GuildPresences, Discord.GatewayIntentBits.GuildVoiceStates, Discord.GatewayIntentBits.DirectMessages, Discord.GatewayIntentBits.GuildMessageReactions, Discord.GatewayIntentBits.GuildEmojisAndStickers, Discord.GatewayIntentBits.GuildInvites],
partials: [Discord.Partials.Channel, Discord.Partials.Message, Discord.Partials.User, Discord.Partials.GuildMember, Discord.Partials.Reaction, Discord.Partials.ThreadMember, Discord.Partials.GuildScheduledEvent]
});
const config = require('./config.json');
client.login(config.token);
client.on('ready', async () => {
console.log(`[!] — Logged in as ${client.user.tag} (${client.user.id})`);
setInterval(async () => {
config.pfp.map(async (id) => {
const channel = client.channels.cache.get(id);
if (!channel) return;
try {
const members = await channel.guild.members.fetch();
const randomMember = members.filter(m => !m.user.bot).random().user;
const embed = new Discord.EmbedBuilder()
.setTitle('`🦅` ▸ Random Pfp')
.setAuthor({ name: randomMember.username, iconURL: randomMember.displayAvatarURL({ dynamic: true }) })
.setImage(randomMember.displayAvatarURL({ dynamic: true, size: 4096 }))
.setFooter({ text: channel.guild.name, iconURL: channel.guild.iconURL() })
.setColor(config.color)
.setTimestamp();
const button = new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Link)
.setLabel(' ▸ Link')
.setURL(randomMember.displayAvatarURL({ dynamic: true, size: 4096 }));
const row = new Discord.ActionRowBuilder().addComponents(button);
return channel.send({ embeds: [embed], components: [row] });
} catch {}
});
}, parseInt(config.time))
setInterval(async () => {
config.banner.map(async (id) => {
const channel = client.channels.cache.get(id);
if (!channel) return;
try {
const members = await channel.guild.members.fetch();
const randomMember = members.filter(m => !m.user.bot).random().user;
await randomMember.fetch();
if (!randomMember.bannerURL()) return;
const embed = new Discord.EmbedBuilder()
.setTitle('`🦅` ▸ Random Banner')
.setAuthor({ name: randomMember.username, iconURL: randomMember.displayAvatarURL({ dynamic: true }) })
.setImage(randomMember.bannerURL({ dynamic: true, size: 4096 }))
.setFooter({ text: channel.guild.name, iconURL: channel.guild.iconURL() })
.setColor(config.color)
.setTimestamp();
const button = new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Link)
.setLabel(' ▸ Link')
.setURL(randomMember.bannerURL({ dynamic: true, size: 4096 }));
const row = new Discord.ActionRowBuilder().addComponents(button);
return channel.send({ embeds: [embed], components: [row] });
} catch {}
});
}, parseInt(config.time2))
});