Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fruityisgood committed Nov 17, 2021
0 parents commit 326fdfc
Show file tree
Hide file tree
Showing 1,949 changed files with 207,508 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions Guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Guide Coming soon
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Whirl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<h1 align="center">Welcome to SelectRoles 👋</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
<a href="#" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
</a>

</p>

> Get your own menu roles for your discord server<BR>
> written in discord.js v13 by Whirl
## Install (Requires [Node.js v16.6](https://nodejs.org/en/))

```sh
npm i
```

## Usage

```sh
node .
```

## Run tests

```sh
npm run test
```

## Author

👤 **Whirl**

* Website: whirl.codes
* Twitter: [@Whirl\_21](https://twitter.com/Whirl\_21)
* Github: [@Whirl21](https://github.com/Whirl21)

## Show your support

Give a ⭐️ if this project helped you!

***
19 changes: 19 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"token":"", //ur bot token here
"r1":"", //role 1 id
"r2":"", //role2 id
"r3":"", //role3 id
"r4":"", //role4id
"r5":"",//role5id
"r1m":"",//role 1 emoji
"r2m":"",//role 2 emoji
"r3m":"",//role3 emoji
"r4m":"",//role4 emoji
"r5m":""//role5 emoji

}
/*
@{Warning} -
remove all comments from this file

*/
144 changes: 144 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
Copyright 2021 Whirl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/



// require the needed discord.js classes
const { Client, Intents, MessageActionRow, MessageSelectMenu } = require('discord.js');

// create a new Discord client
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

const {token , r1 , r2 ,r3 ,r4,r5 , r1m , r2m , r3m , r4m , r5m} = require('./config.json')
//event triggered when the client is ready/online logs ready {@type string} in the console



client.once('ready', () => {
console.log('Ready!');
});

client.on('interactionCreate', async interaction => {


if (interaction.commandName == 'roles') {
const row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('roles')
.setPlaceholder('Select a reaction role')
.addOptions([
{ //edit the option according to you ⚠leave the emoji fields like they are
label: 'Reaction Role 1',
description: 'Take this role by clicking me ',
value: 'first_option',
emoji: r1m
},
{
label: 'Reaction Role 2',
description: 'Take this role by clicking me ',
value: 'second_option',
emoji: r2m
},
{
label: 'Reaction Role 3',
description: 'Take this role by clicking me ',
value: 'third_option',
emoji: r3m
},
{
label: 'Reaction Role 4',
description: 'Take this role by clicking me ',
value: 'fourth_option',
emoji: r4m
},
{
label: 'Reaction Role 5',
description: 'Take this role by clicking me s',
value: 'fifth_option',
emoji: r5m
},
]),
);

await interaction.reply({ content: "Hello There take your roles", ephemeral: true ,components: [row]})//edit the content here
//this sends it as empheral so that the chat does not get choked with these
}



//if the interaction is select menu then reply
if(interaction.isSelectMenu()){

let choice = interaction.values[0]
const member = interaction.member
if(choice == 'first_option'){
if (member.roles.cache.some(role => role.id == r1)) {
interaction.reply({content: "The role was successfully removed from you" , ephemeral: true})
member.roles.remove('847793663597608990')
}
else{
member.roles.add(r1)
await interaction.reply({ content: "The role was successfully added to you", ephemeral: true })}
}

else if(choice == 'second_option'){
if (member.roles.cache.some(role => role.id == r2)) {
interaction.reply({content: "The role was successfully removed from you", ephemeral: true})
member.roles.remove(r2)
}
else{
member.roles.add(r2)
await interaction.reply({ content: "The role was successfully added to you", ephemeral: true })}
}


else if(choice == 'third_option'){
if (member.roles.cache.some(role => role.id == r3)) {
interaction.reply({content: "The role was successfully removed from you", ephemeral: true})
member.roles.remove(r3)
}
else{
member.roles.add(r3)
await interaction.reply({ content: "The role was successfully added to you", ephemeral: true })}
}



else if(choice == 'fourth_option'){
if (member.roles.cache.some(role => role.id == r4)) {
interaction.reply({content: "The role was successfully removed from you!", ephemeral: true})
member.roles.remove(r4)
}
else{
member.roles.add(r4)
await interaction.reply({ content: "The role was successfully added to you", ephemeral: true })}
}


else if(choice == 'fifth_option'){
if (member.roles.cache.some(role => role.id == r5)) {
interaction.reply({content: "The role was successfully removed from you", ephemeral: true})
member.roles.remove(r5)
}
else{
member.roles.add(r5)
await interaction.reply({ content: "The role was successfully added to you", ephemeral: true })}
}



}
})

client.login(token);//logging into our bot
12 changes: 12 additions & 0 deletions node_modules/.bin/is-ci

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/is-ci.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/is-ci.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions node_modules/.bin/nodemon

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodemon.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/nodemon.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions node_modules/.bin/nodetouch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodetouch.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 326fdfc

Please sign in to comment.