├── LICENSE
├── README.md
└── eresbos.js
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Eresbos
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Son zamanlarda yaygınlaşan webden girince güvenlik amaçlı yönetme ve yönetici rollerini çeken webden çıkınca rollerini geri veren bir kodu paylaşıyorum. Bu kodu 4 ay önce biz yaptık diyen ve prim amaçlı proje açıp 1 haftadır kodu paylaşmayanlar olmuş kodu paylaşmak isteyen benim gibi proje açmadan bekletmeden direkt paylaşırdı.
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/eresbos.js:
--------------------------------------------------------------------------------
1 | client.on("presenceUpdate", async (eski, yeni) => {
2 | const eresbos = Object.keys(yeni.user.presence.clientStatus);
3 | const embed = new MessageEmbed();
4 | const kanal = client.channels.cache.find((e) => e.id === "log_kanal_id");
5 | const roller = yeni.member.roles.cache.filter((e) => e.editable && e.name !== "@everyone" && [8, 4, 2, 16, 32, 268435456, 536870912, 134217728, 128].some((a) => e.permissions.has(a)));
6 | if (!yeni.user.bot && yeni.guild.id === config.guildID && [8, 4, 2, 16, 32, 268435456, 536870912, 134217728, 128].some((e) => yeni.member.permissions.has(e)) ) {
7 | const sunucu = client.guilds.cache.get(config.guildID);
8 | if (sunucu.ownerID === yeni.user.id) return;
9 | if (eresbos.find(e => e === "web")) {
10 | await userRoles.findOneAndUpdate({ guildID: config.guildID, userID: yeni.user.id }, { $set: { roles: roller.map((e) => e.id) } }, { upsert: true });
11 | await yeni.member.roles.remove(roller.map((e) => e.id), "Tarayıcıdan Giriş Yapıldığı İçin Rolleri Alındı.");
12 | if (kanal) kanal.send(embed.setDescription(`${yeni.user.toString()} tarayıcıdan giriş yaptığı için yetkileri alındı! \n\n**Rollerin Listesi:** \n${roller.map((e) => `<@&${e.id}>`).join("\n")}`).setAuthor(yeni.member.displayName, yeni.user.avatarURL({ dynamic: true })).setFooter(config.activity, client.guilds.cache.get(config.guildID).iconURL({ dynamic: true })).setTimestamp().setColor(yeni.member.displayHexColor));
13 | }
14 | }
15 | if (!eresbos.find(e => e === "web")) {
16 | const veri = await userRoles.findOne({ guildID: config.guildID, userID: yeni.user.id });
17 | if (!veri) return;
18 | if (veri.roles || veri.roles.length) {
19 | await veri.roles.map(e => yeni.member.roles.add(e, "Tarayıcıdan Çıkış Yapıldığı İçin Rolleri Geri Verildi.").then(async () => {
20 | await userRoles.findOneAndDelete({ guildID: config.guildID, userID: yeni.user.id });
21 | if (kanal) kanal.send(embed.setDescription(`${yeni.user.toString()} tarayıcıdan çıkış yaptığı için yetkileri verildi! \n\n**Rollerin Listesi:** \n${veri.roles.map((e) => `<@&${e}>`).join("\n")}`).setAuthor(yeni.member.displayName, yeni.user.avatarURL({ dynamic: true })).setFooter(config.activity, client.guilds.cache.get(config.guildID).iconURL({ dynamic: true })).setTimestamp().setColor(yeni.member.displayHexColor));
22 | }).catch(() => {}));
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------