├── LICENSE ├── README.md ├── config.json ├── main.js └── package.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 keixyz 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 | # Hatasız Kullanım İçin 2 | 3 | - Gerekli modülleri yüklediğiniz taktir de hatasız olarak discord menü sistemini kullanabilirsiniz. 4 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "Bot": { 3 | "Token": "", 4 | "Owner": "", 5 | "Durum": "", 6 | "Status": "" 7 | }, 8 | 9 | "Server": { 10 | "GuildID": "" 11 | }, 12 | 13 | "Channels": { 14 | "VoiceChannelID": "" 15 | }, 16 | 17 | "Roles": { 18 | "Lovers": "", 19 | "Alone": "", 20 | "Lgbt": "" 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("discord.js"); 2 | const cfg = require("./config.json"); 3 | const { MessageMenuOption, MessageMenu, MessageActionRow } = require('discord-buttons'); 4 | const client = new Client({ disableMentions: "everyone", ignoreDirect: true, ignoreRoles: true, fetchAllMembers: true, _tokenType: "Bot" }); 5 | require('discord-buttons')(client) 6 | 7 | 8 | client.on("message", async(msg) => { 9 | if (msg.author.id === cfg.Bot.Owner) { 10 | if (msg.content === "!menü-add") { 11 | const seçenek1 = new MessageMenuOption().setLabel('Lovers').setEmoji('💍').setValue('Lovers').setDescription('Lovers rolünü üstüne al.') 12 | const seçenek2 = new MessageMenuOption().setLabel('Alone').setEmoji('💔').setValue('Alone').setDescription('Alone rolünü üstüne al.') 13 | const seçenek3 = new MessageMenuOption().setLabel('LGBT').setEmoji('🌈').setValue('LGBT').setDescription('LGBT rolünü üstüne al.') 14 | const select = new MessageMenu() 15 | .setID('select1') 16 | .setPlaceholder('Bir rol seç') 17 | .addOption(seçenek1) 18 | .addOption(seçenek2) 19 | .addOption(seçenek3) 20 | .setMaxValues(1) 21 | .setMinValues(1) 22 | const Row1 = new MessageActionRow() 23 | .addComponent(select) 24 | 25 | await msg.channel.send('**Menü: Sunucu Rolleri**', { components: [Row1] }); 26 | } else if (msg.content === "!menü-remove") { 27 | const seçenek1 = new MessageMenuOption().setLabel('Lovers').setEmoji('💍').setValue('Lovers').setDescription('Lovers rolünü üstünden çıkar.') 28 | const seçenek2 = new MessageMenuOption().setLabel('Alone').setEmoji('💔').setValue('Alone').setDescription('Alone rolünü üstünden çıkar.') 29 | const seçenek3 = new MessageMenuOption().setLabel('LGBT').setEmoji('🌈').setValue('LGBT').setDescription('LGBT rolünü üstünden çıkar.') 30 | const select = new MessageMenu() 31 | .setID('select1') 32 | .setPlaceholder('Bir rol seç') 33 | .setMaxValues(1) 34 | .setMinValues(1) 35 | .addOption(seçenek1) 36 | .addOption(seçenek2) 37 | .addOption(seçenek3) 38 | 39 | const Row1 = new MessageActionRow() 40 | .addComponent(select) 41 | 42 | await msg.channel.send('**Menü: Sunucu Rolleri**', { components: [Row1] }); 43 | } 44 | } 45 | }) 46 | 47 | client.on('clickMenu', async menu => { 48 | const Member = menu.clicker.member 49 | if (menu.values[0] == 'Lovers') { 50 | if (!Member.roles.cache.has(cfg.Roles.Lovers)) { 51 | await Member.roles.add(cfg.Roles.Lovers) 52 | return menu.reply.send('Aşağıdaki roller başarıyla üstünüze eklendi:\n\n• '+menu.values[0]+'', true) 53 | } else if(Member.roles.cache.has(cfg.Roles.Lovers)) { 54 | await Member.roles.remove(cfg.Roles.Lovers) 55 | return menu.reply.send("Aşağıdaki roller başarıyla üstünüzden alındı:\n\n• "+menu.values[0]+"", true) 56 | } 57 | } 58 | 59 | if (menu.values[0] == 'Alone') { 60 | if (!Member.roles.cache.has(cfg.Roles.Alone)) { 61 | await Member.roles.add(cfg.Roles.Alone) 62 | return menu.reply.send('Aşağıdaki roller başarıyla üstünüze eklendi:\n\n• '+menu.values[0]+'', true) 63 | } else if(Member.roles.cache.has(cfg.Roles.Alone)) { 64 | await Member.roles.remove(cfg.Roles.Alone) 65 | return menu.reply.send("Aşağıdaki roller başarıyla üstünüzden alındı:\n\n• "+menu.values[0]+"", true) 66 | } 67 | } 68 | 69 | if (menu.values[0] == 'LGBT') { 70 | if (!Member.roles.cache.has(cfg.Roles.Lgbt)) { 71 | await Member.roles.add(cfg.Roles.Lgbt) 72 | return menu.reply.send('Aşağıdaki roller başarıyla üstünüze eklendi:\n\n• '+menu.values[0]+'', true) 73 | } else if(Member.roles.cache.has(cfg.Roles.Lgbt)) { 74 | await Member.roles.remove(cfg.Roles.Lgbt) 75 | return menu.reply.send("Aşağıdaki roller başarıyla üstünüzden alındı:\n\n• "+menu.values[0]+"", true) 76 | }}}) 77 | 78 | client.on('ready', async () => { 79 | 80 | client.user.setPresence({ activity: { name: cfg.Bot.Durum }, status: cfg.Bot.Status }) 81 | let VoiceChannelID = client.channels.cache.get(cfg.Channels.VoiceChannelID) 82 | if (VoiceChannelID) VoiceChannelID.join().catch(() => { }) 83 | console.log(`(${client.user.username}) adlı hesapta [${client.guilds.cache.get(cfg.Server.GuildID).name}] adlı sunucuda giriş yapıldı. ✔`) 84 | 85 | }); 86 | 87 | client.login(cfg.Bot.Token).catch(() => console.error("Bota giriş yapılırken başarısız olundu!")); 88 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "discord-menu-system", 3 | "version": "1.0.0", 4 | "description": "coded by kei", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "main.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "keixyz" 12 | }, 13 | "keywords": [ 14 | "kei" 15 | ], 16 | "author": "kei", 17 | "license": "ISC" 18 | } 19 | --------------------------------------------------------------------------------