Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- require('discord-buttons')(client);
- const { MessageButton, MessageActionRow } = require("discord-buttons");
- const PREFIX = '-'
- let btn1 = new MessageButton()
- .setStyle("blurple")
- .setEmoji("✌️")
- .setID("1")
- let btn2 = new MessageButton()
- .setStyle("blurple")
- .setEmoji("👊")
- .setID("2")
- let btn3 = new MessageButton()
- .setStyle("blurple")
- .setEmoji("👌")
- .setID("3")
- let row = new MessageActionRow()
- .addComponent(btn1)
- .addComponent(btn2)
- .addComponent(btn3);
- client.on('message', message => {
- if(message.content.startsWith(PREFIX +'add')) {
- message.channel.send(`✨ | **react for free roles!\n 1- youtube role \n 2- anime role \n 3- games role**`, {
- component: row,
- })
- }
- });
- ////////////////////////////////
- client.on('clickButton', async (button) => {
- await button.defer();
- let guild = client.guilds.cache.get("740890983666810920")//ايدي سرفرك
- let roles = button.guild.roles;
- let role1 = button.guild.roles.cache.find(role => role.name == "youtube")// اسم الرتبه واحد
- let role2 = button.guild.roles.cache.find(role => role.name == "anime")//اسم الرتبه الثانيه
- let role3 = button.guild.roles.cache.find(role => role.name == "games")// اسم الرتبه الثالثه
- if(button.id === '1') {
- button.clicker.member.roles.add(role1)
- button.clicker.member.send(`you got the role **youtube**`)
- }
- if(button.id == '2') {
- button.clicker.member.roles.add(role2)
- button.clicker.member.send(`you got the role **anime**`)
- }
- if(button.id == '3') {
- button.clicker.member.roles.add(role3)
- button.clicker.member.send(`you got the role **games**`)
- }
- /////////////////////////
- if(button.id === '1') {
- if(button.clicker.member.roles.cache.has('ايدي الرتبه الاولئ')) {
- button.clicker.member.roles.remove(role1)
- button.clicker.member.send(`you removed the role **youtube**`)
- }
- }
- if(button.id == '2') {
- if(button.clicker.member.roles.cache.has('ايدي الرتبه الثانيه')) {
- button.clicker.member.roles.remove(role2)
- button.clicker.member.send(`you removed the role **anime**`)
- }
- }
- if(button.id == '3') {
- if(button.clicker.member.roles.cache.has('ايدي الرتبه الثالثه')) {
- button.clicker.member.roles.remove(role3)
- button.clicker.member.send(`you removed the role **games**`)
- }
- }
- });
- client.login('توكن البوت');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement