forked from notunderctrl/discordjs-v14-series
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2a98e3
commit f83279a
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
require('dotenv').config(); | ||
const { | ||
Client, | ||
IntentsBitField, | ||
ActionRowBuilder, | ||
ButtonBuilder, | ||
ButtonStyle, | ||
} = require('discord.js'); | ||
|
||
const client = new Client({ | ||
intents: [ | ||
IntentsBitField.Flags.Guilds, | ||
IntentsBitField.Flags.GuildMembers, | ||
IntentsBitField.Flags.GuildMessages, | ||
IntentsBitField.Flags.MessageContent, | ||
], | ||
}); | ||
|
||
const roles = [ | ||
{ | ||
id: '1058030952707784714', | ||
label: 'Red', | ||
}, | ||
{ | ||
id: '1058031008655609856', | ||
label: 'Green', | ||
}, | ||
{ | ||
id: '1058031040461013093', | ||
label: 'Blue', | ||
}, | ||
]; | ||
|
||
client.on('ready', async (c) => { | ||
try { | ||
const channel = await client.channels.cache.get('1049345076188422226'); | ||
if (!channel) return; | ||
|
||
const row = new ActionRowBuilder(); | ||
roles.forEach((role) => { | ||
row.components.push( | ||
new ButtonBuilder() | ||
.setCustomId(role.id) | ||
.setLabel(role.label) | ||
.setStyle(ButtonStyle.Primary) | ||
); | ||
}); | ||
|
||
await channel.send({ | ||
content: 'Claim or remove a role below.', | ||
components: [row], | ||
}); | ||
|
||
process.exit(); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}); | ||
|
||
client.login(process.env.TOKEN); |