Repository navigation
Expand file tree
/
Copy pathheader.js
More file actions
230 lines (205 loc) · 10.4 KB
/
Copy pathheader.js
File metadata and controls
230 lines (205 loc) · 10.4 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/// <reference path="header.d.ts" />
const permissions = {
CREATE_INSTANT_INVITE: 1,
KICK_MEMBERS: 2,
BAN_MEMBERS: 4,
ADMINISTRATOR: 8,
MANAGE_CHANNELS: 16,
MANAGE_GUILD: 32,
ADD_REACTIONS: 64,
VIEW_AUDIT_LOG: 128,
PRIORITY_SPEAKER: 256,
VIEW_CHANNEL: 1024,
READ_MESSAGES: 1024,
SEND_MESSAGES: 2048,
SEND_TTS_MESSAGES: 4096,
MANAGE_MESSAGES: 8192,
EMBED_LINKS: 16384,
ATTACH_FILES: 32768,
READ_MESSAGE_HISTORY: 65536,
MENTION_EVERYONE: 131072,
EXTERNAL_EMOJIS: 262144,
USE_EXTERNAL_EMOJIS: 262144,
CONNECT: 1048576,
SPEAK: 2097152,
MUTE_MEMBERS: 4194304,
DEAFEN_MEMBERS: 8388608,
MOVE_MEMBERS: 16777216,
USE_VAD: 33554432,
CHANGE_NICKNAME: 67108864,
MANAGE_NICKNAMES: 134217728,
MANAGE_ROLES: 268435456,
MANAGE_ROLES_OR_PERMISSIONS: 268435456,
MANAGE_WEBHOOKS: 536870912,
MANAGE_EMOJIS: 1073741824
};
const convertReadable = function (permName, readable = true, debug = false) {
if (!readable) return permName;
if (debug) console.log(permName);
let names = {
CREATE_INSTANT_INVITE: "Créer une invitation instantanée",
KICK_MEMBERS: "Exclure des membres",
BAN_MEMBERS: "Bannir des membres",
ADMINISTRATOR: "Administrateur",
MANAGE_CHANNELS: "Gérer les salons",
MANAGE_GUILD: "Gérer le serveur",
ADD_REACTIONS: "Ajouter des réactions",
VIEW_AUDIT_LOG: "Voir le journal d'audit",
PRIORITY_SPEAKER: "Parler en priorité",
VIEW_CHANNEL: "Voir le salon",
READ_MESSAGES: "Lire les messages",
SEND_MESSAGES: "Envoyer des messages",
SEND_TTS_MESSAGES: "Envoyer des messages TTS",
MANAGE_MESSAGES: "Gérer les messages",
EMBED_LINKS: "Ajouter des liens intégrés",
ATTACH_FILES: "Attacher des fichiers",
READ_MESSAGE_HISTORY: "Voir l'historique des messages",
MENTION_EVERYONE: "Metionner tous le monde",
EXTERNAL_EMOJIS: "Voir des émojis externes",
USE_EXTERNAL_EMOJIS: "Utiliser des émojis externes",
CONNECT: "Se connecter",
SPEAK: "Parler",
MUTE_MEMBERS: "Réduire au silence des membres",
DEAFEN_MEMBERS: "Mettre en sourdine des membres",
MOVE_MEMBERS: "Déplacer des membres",
USE_VAD: "Utiliser l'activité vocale",
CHANGE_NICKNAME: "Changer de pseudonyme",
MANAGE_NICKNAMES: "Gérer les pseudonymes des membres",
MANAGE_ROLES: "Gérer les rôles",
MANAGE_ROLES_OR_PERMISSIONS: "Gérer les rôles",
MANAGE_WEBHOOKS: "Gérer les Webhooks",
MANAGE_EMOJIS: "Gérer les émojis du serveur"
};
if (!names[permName]) throw new RangeError("Invalid permission given!");
return names[permName];
};
const convertPerms = function (permNumber, readableNames = false, debug = false) {
//if readableNames is set to true, use the names at Discord instead of the names of PermissionResolvables at discord.js.
if (isNaN(Number(permNumber))) throw new TypeError(`Expected permissions number, and received ${typeof permNumber} instead.`);
permNumber = Number(permNumber);
let evaluatedPerms = {};
for (let perm in permissions) {
let hasPerm = Boolean(permNumber & permissions[perm]);
evaluatedPerms[convertReadable(perm, readableNames, debug)] = hasPerm;
}
return evaluatedPerms;
};
$(window).on('load', function () {
let f = {};
f[document.cookie.split('=')[0]] = document.cookie.split('=')[1];
if (f['token']) {
fetch("https://discord.com/api/users/@me", {
headers: {
'Authorization': `Bearer ${f['token']}`
}
}).then(function (res) {
return res.json();
})
.then(function (json) {
let { id, username, avatar, discriminator, premium_type, locale } = json;
if (id) {
$('ul.login-dropdown').children().first().html(`<img src="https://cdn.discordapp.com/avatars/${id}/${avatar}.png" width="24"></img>`);
$('ul.login-dropdown').children().get(1).innerHTML = `${username}#${discriminator} - ${premium_type == 0 ? "Sans Discord Nitro 🛒" : premium_type == 2 ? "Avec Discord Nitro ✨" : "Avec Discord Nitro Classique 🎈"} - Langue : ${locale}`;
$('ul.login-dropdown').children().get(1).classList.replace('css', 'no-css');
$('ul.login-dropdown').children().get(1).setAttribute('title', '');
$('ul.login-dropdown').children().get(2).setAttribute('title', '(Ctrl+C)');
$('ul.login-dropdown').children().get(2).innerHTML = `<a href="https://julmanbot.github.io/?logout=true" style="color: red;">Se déconnecter</a>`;
$('ul.login-dropdown').children().get(2).classList.replace('no-css', 'css');
$('ul.login-dropdown').children().get(3).innerHTML = `<div class="content"><div class="wait-animated" style="width:50px;height:50px;background:black;"></div></div><style>@keyframes wait-anim{from{top:0;left:0;}25%{top:0;left:50px;}50%{top:50px;left:50px;}75%{top:50px;left:0;}to{top:0;left:0;}}div.wait-animated{position:relative;animation:wait-anim infinite .7s;}div.content{width:100px;height:100px;}</style><p>Chargement des serveurs...</p>`;
fetch("https://discord.com/api/users/@me/guilds", {
headers: {
'Authorization': `Bearer ${f['token']}`
}
}).then(async function (res) {
/**
* @type {{id:string,name:number|string,icon:string,owner:true|false,permissions:number,features:["INVITE_SPLASH"?,"VIP_REGIONS"?,"VANITY_URL"?,"VERIFIED"?,"PARTNERED"?,"COMMUNITY"?,"COMMERCE"?,"NEWS"?,"DISCOVERABLE"?,"FEATURABLE"?,"ANIMATED_ICON"?,"BANNER"?,"WELCOME_SCREEN_ENABLED"?],permissions_new:number|string}[]}
*/
let j = await res.json();
if (res.ok) {
$('ul.login-dropdown').children().get(3).innerHTML = ``;
j.sort(function (a, b) {
return (a.name.toLowerCase() < b.name.toLowerCase() ? -1 : a.name.toLowerCase() > b.name.toLowerCase() ? 1 : 0);
});
console.log(`[SERVEURS] Vos serveurs (${j.length}) : `, j);
j.forEach(async function (server) {
let res = await fetch(`https://cdn.discordapp.com/icons/${server.id}/${server.icon}.${server.features.includes("ANIMATED_ICON") ? "gif" : "png"}`);
let url;
if (res.ok) {
url = `https://cdn.discordapp.com/icons/${server.id}/${server.icon}.${server.features.includes("ANIMATED_ICON") ? "gif" : "png"}`;
} else {
url = `https://cdn.discordapp.com/icons/${server.id}/${server.icon}.png`;
}
$('ul.login-dropdown').children().get(3).innerHTML += `<span arial-title="${server.name}${server.owner ? " (propriétaire)" : ""}" class="tooltip" arial-part="${server.features.includes('PARTNERED')}"><img src="${url}" width="48" style="border-radius: 100%; margin:5px" class="tooltip"></span>`;
});
} else {
$('ul.login-dropdown').children().get(3).innerHTML = `<strong>Impossible de charger vos serveurs ! <img src="https://cdn.discordapp.com/emojis/765674085786714163.gif" style="width:1.375em;vertical-align:bottom;"></strong>`;
}
});
}
});
}
adl('click', function (e) {
$('ul.login-dropdown').fadeToggle('fast')
}, document.querySelector('button.login-btn'));
document.querySelector('li#log').setAttribute('title', '(Ctrl+C)');
adl('keyup', async function (e) {
if (e.key == 'c' && e.altKey) {
e.preventDefault();
document.querySelector("button.login-btn").click();
return;
}
if (e.key == 'c' && e.ctrlKey) {
e.preventDefault();
if (f['token']) {
await fetch('https://discord.com/api/users/@me', {
headers: {
"Authorization": `Bearer ${f['token']}`
}
}).ok;
let log = document.body.appendChild(document.createElement('a'));
log.href = 'https://julmanbot.github.io/?logout=true';
log.click();
} else {
let log = document.body.appendChild(document.createElement('a'));
log.href = 'https://julmanbot.github.io/login?client_id=774580210481627147&target=https://julmanbot.github.io/';
log.click();
}
return;
}
}, document);
adl('keypress', function (e) {
e.preventDefault();
}, document);
document.querySelector("button.login-btn").setAttribute('title', "Ouvre le menu du compte (Alt+C)");
let style = document.createElement('style');
style.textContent = `.tooltip[arial-part="false"]::before {
content: attr(arial-title);
opacity: 0;
transition: .2s opacity;
position: absolute;
white-space: nowrap;
margin-top: 60px;
margin-right: 20%;
color: white;
padding: 5px;
background-color: black;
border-radius: 5px;
}
.tooltip[arial-part="true"]::before {
content: attr(arial-title) " (Discord Partner)";
opacity: 0;
transition: .2s opacity;
position: absolute;
white-space: nowrap;
margin-top: 60px;
color: white;
padding: 5px;
background-color: #7289da;
border-radius: 5px;
}
.tooltip:hover::before{
opacity: 1;
}`;
document.head.appendChild(style);
!function () { ["%c _ _ __ __ ____ ___ _____ \n | | _ _ | || \\/ | __ _ _ __ | __ ) / _ \\|_ _|\n _ | || | | || || |\\/| | / _` || '_ \\ | _ \\ | | | | | | \n | |_| || |_| || || | | || (_| || | | || |_) || |_| | | | \n \\___/ \\__,_||_||_| |_| \\__,_||_| |_||____/ \\___/ |_| \n\nJulManBOT \n\n\n%cEuh... Tu sais ce que tu fait ? Si oui, rejoint nous ! 😁"].forEach((v) => console.log(v, "color:#32c5f2;font-size:1.2rem;", "color:#000;font-size:1.2rem;font-familly:\"Whitney\"")) }();
});