Skip to content

Commit

Permalink
fixed roles and new button
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLlamamarketer committed Sep 26, 2023
1 parent 972a0a9 commit 79e97a3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
58 changes: 58 additions & 0 deletions button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, GuildMemberRoleManager } = require('discord.js');
const { client, db } = require('./index');
/*
module.exports = {
data: new SlashCommandBuilder()
.setName('buttontest')
.setDescription('never expiring button'),
async execute(interaction: any) { // Correct the typo from 'excecute' to 'execute'
const button = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('expirebutton')
.setLabel('Button Testing')
.setStyle(ButtonStyle.PRIMARY) // Use uppercase 'PRIMARY'
);
await interaction.reply({
content: `Button Testing`, components: [button], ephemeral: true
});
}
}
*/

// Define the channel ID where you want to create the button
const targetChannelId = '1119231778209681450';

// Create the button and action row
const button = new ButtonBuilder()
.setCustomId('expirebutton')
.setLabel('Button Testing')
.setStyle(ButtonStyle.PRIMARY);

const actionRow = {
components: [button],
};

// Send the button to the target channel
const sendButton = async () => {
const channel = await client.channels.fetch(targetChannelId);
if (channel?.isText()) {
await channel.send({ content: 'Button Testing', components: [actionRow] });
console.log('Button sent to the channel.');
} else {
console.error('Invalid channel or unable to send the button.');
}
};

// Call the function to send the button
sendButton();

// Button
client.on('interactionCreate', async (interaction: any) => {
if (interaction.isButton()) {
if (interaction.customId === 'expirebutton') {
await interaction.reply({ content: `Button Working`, ephemeral: true });
}
}
});
8 changes: 5 additions & 3 deletions inviteTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ async function trackInvites() {

async function assignRoles(inviteCount: number, userId: string, guild: Guild) {
const rolesToAssign = [
{ role: '1153789870582550598', minInviteCount: 1, maxInviteCount: 2 },
{ role: '1153796740072349726', minInviteCount: 3, maxInviteCount: 10 },
{ role: '1153992358212423730', minInviteCount: 11, maxInviteCount: Infinity },
{ role: '1151603003279802498', minInviteCount: 1, maxInviteCount: 2 }, // Invite Duke
{ role: '1151555451910115411', minInviteCount: 3, maxInviteCount: 6 }, // Invite Prince
{ role: '1151555734652342372', minInviteCount: 7, maxInviteCount: 19 }, // Invite King
{ role: '1151555885672443906', minInviteCount: 20, maxInviteCount: 49 }, // Invite Emperor
{ role: '1151555968140841012', minInviteCount: 50, maxInviteCount: Infinity }, // Invite God
];
const rolesToRemove: Collection<string, Role> = new Collection();

Expand Down

0 comments on commit 79e97a3

Please sign in to comment.