Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "RoleMenu for BDFD
- - Code by Rajat#1004
- Code 1
- --------------------------------------------------------------------------------
- Trigger : $onInteraction
- Language : BDScript 2
- Code :
- "
- $nomention
- $if[.$isSlash.$customID.==.true..]
- $onlyAdmin[Only admin can create rolemenu!]
- $c[Create Embed]
- $try
- $var[msgid;$sendEmbedMessage[$channelID;;$message[title];;$message[description];$replaceText[$replaceText[$isValidHex[$message[color]];true;$message[color]];false;ff8888];;;$message[footer];;$message[thumbnail];$message[image];no;yes]]
- $catch
- $var[msgid;$sendEmbedMessage[$channelID;;Get some roles from the menu below.;;$message[description];$replaceText[$replaceText[$isValidHex[$message[color]];true;$message[color]];false;ff8888];;;$message[footer];;$message[thumbnail];$message[image];no;yes]]
- $endtry
- $addButton[no;rolemenu•add•$authorID;Add Options;primary;no;🏷️;$var[msgid]]
- $addButton[no;rolemenu•conf•$authorID;Confirm;success;no;📑;$var[msgid]]
- $ephemeral
- ✏️ **RoleMenu created.** Use button to add options.
- ` -Code by Rajat#1004 `
- $else
- $onlyIf[$checkContains[$customID;rolemenu;roleisgay]==true;]
- $textSplit[$customID;•]
- $c[Add options to the menu]
- $if[$splitText[2]•$splitText[3]==add•$authorID]
- $newModal[rolemenu•newrole•$messageID;Add Role Options]
- $addTextInput[name;short;Option Name;;;yes;;Get This Role]
- $addTextInput[role;short;Role ID/Name;;;yes;;ID/Name of the role.]
- $addTextInput[emo;short;Add Emoji;;;no;;🙂 or <:emoji:1234567890>]
- $addTextInput[req;short;Require Role;;;no;;ID/Name of the requirement role.]
- $addTextInput[bl;short;Blacklisted Role;;;no;;ID/Name of the blacklisted role.]
- $endif
- $if[$splitText[2]==newrole]
- $onlyIf[$roleExists[$findRole[$input[role]]]==true;❗ Role with Name/ID ` $input[role] ` doesn't exist!]
- $ephemeral
- $removeButtons
- $removeComponent[roleisgay]
- $if[$rolePosition[$highestRole[$botID]]<$rolePosition[$findRole[$input[role]]]]
- $if[$input[req]!=]
- $onlyIf[$roleExists[$findRole[$input[req]]]==true;❗ Requirement Role with Name/ID ` $input[req] ` doesn't exist!]
- $endif
- $if[$input[bl]!=]
- $onlyIf[$roleExists[$findRole[$input[bl]]]==true;❗ Blacklisted Role with Name/ID ` $input[bl] ` doesn't exist!]
- $endif
- $try
- $addSelectMenuOption[roleisgay;$input[name];$findRole[$input[role]].$findRole[$input[req]].$findRole[$input[bl]];@$roleName[$findRole[$input[role]]]$if[$input[req]!=] (ℹ️ @$roleName[$findRole[$input[req]]])$endif$if[$input[bl]!=] (❌ @$roleName[$findRole[$input[bl]]])$endif;no;$input[emo];$splitText[3]]
- $catch
- $newSelectMenu[roleisgay;1;1;Get Roles;$splitText[3]]
- $addSelectMenuOption[roleisgay;Click to Add/Remove roles;mytrashcan;ℹ️ : Required Role, ❌ : Blacklisted Role;no;;$splitText[3]]
- $addSelectMenuOption[roleisgay;$input[name];$findRole[$input[role]].$findRole[$input[req]].$findRole[$input[bl]];@$roleName[$findRole[$input[role]]]$if[$input[req]!=] (ℹ️ @$roleName[$findRole[$input[req]]])$endif$if[$input[bl]!=] (❌ @$roleName[$findRole[$input[bl]]])$endif;no;$input[emo];$splitText[3]]
- $endtry
- ✅ Role <@&$findRole[$input[role]]> added to the options.
- $else
- ❗ **Discord's Military Hierarchy returned an error!** The role <@&$findRole[$input[role]]> should be below Bot's highest role <@&$highestRole[$botID]> for the bot to be able to assign this role!
- $endif
- $endif
- $c[Buttons are gay]
- $if[$splitText[2]•$splitText[3]==conf•$authorID]
- $async[butt]
- $removeButtons[$messageID]
- $endasync
- $removeButtons
- $removeComponent[roleisgay]
- $ephemeral
- 🎆 The rolemenu is created successfully.
- $endif
- $c[Get/Remove Role]
- $if[$customID==roleisgay]
- $onlyIf[$message!=mytrashcan;]
- $textSplit[$message;.]
- $color[$getRoleColor[$splitText[1]]]
- $removeComponent[$customID]
- $removeButtons
- $ephemeral
- $if[$hasRole[$authorID;$splitText[1]]==false]
- $if[$splitText[3]!=]
- $if[$hasRole[$authorID;$splitText[3]]==true]
- $description[**⚠️ Access Denied!** You have a role <@&$splitText[3]> which can not access <@&$splitText[1]>!]
- $stop
- $endif
- $endif
- $try
- $if[$splitText[2]!=]
- $if[$hasRole[$authorID;$splitText[2]]==false]
- $description[**❓ Requirement Role Missing** : You need to have <@&$splitText[2]> to access <@&$splitText[1]>!]
- $stop
- $endif
- $endif
- $endtry
- $giveRole[$authorID;$splitText[1]]
- $description[**✅ Role <@&$splitText[1]> added successfully.**]
- $image[https://singlecolorimage.com/get/$getRoleColor[$splitText[1]]/1000x8]
- $else
- $takeRole[$authorID;$splitText[1]]
- $description[**❌ Role <@&$splitText[1]> removed successfully.**]
- $endif
- $endif
- $endif
Add Comment
Please, Sign In to add comment