-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
128 lines (103 loc) Β· 6.4 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const express = require('express')
const app = express();
const port = 3000
app.get('/', ( req, res ) => res.send("Hey Bud!"))
app.listen(port, () =>
console.log(`Your app is lisening at https://localhost:${port}`)
);
const Discord = require('discord.js');
const client = new Discord.Client();
const { MessageEmbed } = require('discord.js')
const prefix = '%'
const { remg, cnros, wdybdc, cnros2, wdybdc2 } = require('./Embeds.json')
client.on('ready', () => console.log("Ready to role away"))
client.on('message', async message => {
const args = message.content.substring(prefix.length).split(" ")
if (message.author.bot) return;
if (!message.content.startsWith(`${prefix}`)) return;
if (message.content.startsWith(`${prefix}getrole`)) {
const msg = await message.author.send(remg)
await msg.react('π')
await msg.react('π€')
await msg.react('π')
const filter = (reaction) => {
return (reaction.emoji.name === 'π' || reaction.emoji.name === 'π€' || reaction.emoji.name === 'π')
}
msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(async reaction => {
if (reaction.first().emoji.name === 'π') {
const role = message.guild.roles.cache.find(role => role.name === 'New programer')
message.member.roles.add(role)
}
if (reaction.first().emoji.name === 'π€') {
const msg2 = await message.author.send(cnros)
const filter = (user) => {
return user.author.id === message.author.id
}
msg2.channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] })
.then(async collected => {
const link = collected.first().content
const msg3 = await message.channel.send(wdybdc)
const filter = (user) => {
return user.author.id === message.author.id
}
msg3.channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] })
.then(async collected => {
const description = collected.first().content
const logc = message.guild.channels.cache.find(channel => channel.name === 'role-log')
logc.send(new MessageEmbed()
.setColor("ORANGE")
.setTitle('**NOVICE PROGRAMMER APPLYED**')
.setDescription(`${message.author.username} has applyed for the Novice programmer role. Bot link: ${link}. What the bot does: ${description}`)
.setAuthor({ name: "Roler", iconURL: "", url: "" })
.setFooter({ text: "Brought to you by Minecrafty999", iconURL: "https://cdn.discordapp.com/avatars/660862491102019604/5b28dadf6cf852c943e1df0a82dad850.webp" })
)
})
})
}
if (reaction.first().emoji.name === 'π') {
const msg2 = await message.author.send(cnros2)
const filter = (user) => {
return user.author.id === message.author.id
}
msg2.channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] })
.then(async collected => {
const links = collected.first().content
const msg3 = await message.channel.send(wdybdc2)
const filter = (user) => {
return user.author.id === message.author.id
}
msg3.channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] })
.then(async collected => {
const descriptions = collected.first().content
const logc = message.guild.channels.cache.find(channel => channel.name === 'role-log')
logc.send(new MessageEmbed()
.setColor("ORANGE")
.setTitle('**NOVICE PROGRAMMER APPLYED**')
.setDescription(`${message.author.username} has applyed for the Advanced programmer programmer role. Bot links: ${links}. What the bots do: ${descriptions}`)
.setAuthor({ name: "Roler", iconURL: "", url: "" })
.setFooter({ text: "Brought to you by Minecrafty999", iconURL: "https://cdn.discordapp.com/avatars/660862491102019604/5b28dadf6cf852c943e1df0a82dad850.webp" })
)
})
})
}
})
}
const logc = message.guild.channels.cache.find(channel => channel.name === 'role-log')
if (message.content.startsWith(`${prefix}accept`)) {
if (message.member.roles.cache.find(role => role.name === 'Role picker') && message.channel.id === logc.id) {
if (!args[1]) return message.channel.send();
if (!args[2]) return message.channel.send();
const botcreater = `<@${args[1]}>`
const role = `<@${args[2]}>`
const botcreater2 = message.guild.members.cache.find(member => member.user.username === botcreater)
botcreater2.send(new MessageEmbed()
.setColor("GREEN")
.setTitle('**ACCEPTED**')
.setDescription(`π±Your request to get the role ${args[2]} on the discord.js coding support server has been accepted`)
)
message.guild.members.cache.find(member => member.user.username === botcreater).roles.add(role)
}
}
})
client.login(process.env.TOKEN)