-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient.js
95 lines (78 loc) · 2.35 KB
/
client.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
const { Client, GatewayIntentBits, Partials } = require('discord.js')
const idioma = require('./core/data/language')
const translate = require('./core/formatters/translate')
const { client_data } = require('./setup')
/* --------------------------------------------------------------- */
const cli = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildVoiceStates
],
partials: [
Partials.Message,
Partials.GuildMember
],
disableEveryone: false
})
class CeiraClient {
constructor() {
this.discord = cli
this.tls = translate
this.idioma = idioma
this.x = client_data
this.cached = {
last_interaction: 0,
presence: null,
ranking_value: 0,
regex: /[A-Za-z0-9--]+\.[A-Za-z0-9]{2,10}(?:\/[^\s/]+)*\/?\s/gi,
game_stores: /epicgames.com|store.steam|gog.com|humblebundle.com|ubisoft.com|store.ubi.com|xbox.com|play.google|beta.bandainamcoent|microsoft.com/,
fixed_badges: {},
warns: new Map(),
join_guilds: new Map(),
forca: new Map(),
forca_sessao: new Map(),
iddleGuilds: new Map(),
ranked_guilds: new Map(),
rank: {
bank: []
}
}
}
avatar() {
return this.discord.user.avatarURL({ dynamic: true })
}
channels(type) {
if (type) return this.discord.channels.cache.filter((c) => c.type === type)
return this.discord.channels.cache
}
guilds(id_guild) {
let guilds_cache = this.discord.guilds.cache
let guilds
if (id_guild)
guilds_cache.forEach(guild => {
if (guild.id === id_guild)
guilds = guild
})
else
guilds = guilds_cache
return guilds
}
id() {
return this.discord.user.id
}
login(token) {
return this.discord.login(token)
}
user() {
return this.discord.user
}
username() {
return this.discord.user.username
}
}
module.exports.CeiraClient = CeiraClient