This repository has been archived by the owner on Aug 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pruebas.txt
80 lines (62 loc) · 3.52 KB
/
Pruebas.txt
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
////// Este archivo se puede borrar. Solo se utiliza para pruebas
const config = require('./config.json')
const completemsg = `Gracias por aceptar las reglas del servidor. En breves segundos te daremos los permisos necesarios en el servidor.`
const shortcode = (n) => {
const possible = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz0123456789'
let text = ''
for (var i = 0; i < n + 1; i++) text += possible.charAt(Math.floor(Math.random() * possible.length))
return text;
}
client.on('guildMemberAdd', (member) => {
if (member.user.bot || member.guild.id !== config.guild) return
const token = shortcode(8)
const welcomemsg = `Bienvenido al servidor! Si haceptas las reglas del servidor (En el canal de #reglas) escribeme aqui (en el privado) el siguiente mesaje: **Acepto las reglas del servidor y mi token aqui es: {token}.**`
console.log(`${member.user.username}#${member.user.discriminator} joined! CODE: "${token}"`)
member.send(welcomemsg)
member.user.token = token
})
//VERIFICACION
const verifymsg = 'Acepto las reglas del servidor y mi token aqui es: {token}.'
if (message.author.bot || !message.author.token || message.channel.type !== `dm`) return
if (message.content !== (verifymsg.replace('{token}', message.author.token))) return
message.channel.send({
embed: {
color: Math.floor(Math.random() * (0xFFFFFF + 1)),
description: completemsg,
timestamp: new Date(),
footer: {
text: `Verification Success`
}
}
})
client.guilds.get(config.guild).member(message.author).roles.add(config.role) // ensure this is a string in the config ("")
.then(console.log(`TOKEN: ${message.author.token} :: Role ${config.role} added to member ${message.author.id}`))
.catch(console.error)
//FIN_VERIFICACION
//////
//VERIFICACION
client.on('guildMemberAdd', (member) => {
if (member.user.bot || member.guild.id !== config.guild) return
const token = shortcode(8)
const welcomemsg = `Welcome to the guild! We hope you find a home here! Check out the \`#general\` channel to make sure that we jive, and as long as our goals are similar, then there’s a place at the table waiting for you. \n\n If you accept the code of conduct, please verify your agreement by replying to **this DM** with the verification phrase: \n\n\`I agree to abide by all rules. My token is ${token}.\`\n\n **This message is case-sensitive, and please include the period at the end! ** \n\nQuestions? Get at a staff member in the server or via DM.`
console.log(`${member.user.username}#${member.user.discriminator} joined! CODE: "${token}"`)
member.send(welcomemsg)
member.user.token = token
})
const verifymsg = 'I agree to abide by all rules. My token is {token}.'
if (message.author.bot || !message.author.token || message.channel.type !== `dm`) return
if (message.content !== (verifymsg.replace('{token}', message.author.token))) return
message.channel.send({
embed: {
color: Math.floor(Math.random() * (0xFFFFFF + 1)),
description: completemsg,
timestamp: new Date(),
footer: {
text: `Verification Success`
}
}
})
client.guilds.get(config.guild).member(message.author).roles.add(config.role) // ensure this is a string in the config ("")
.then(console.log(`TOKEN: ${message.author.token} :: Role ${config.role} added to member ${message.author.id}`))
.catch(console.error)
//FIN_VERIFICACION