feat: Transition paidmember over to embed

imgbot
KieranRobson 2023-08-21 13:50:16 +01:00
parent 2683677032
commit 6ec81c3d07
10 changed files with 127 additions and 41 deletions

View File

@ -1,9 +1,9 @@
const client = require('../index'); const client = require('../index');
const { ActivityType } = require('discord.js') const { ActivityType } = require('discord.js');
client.on('ready', () => { client.on('ready', () => {
console.log('HullCSS is online'); console.log('HullCSS is online');
client.user.setActivity('HullCSS.org', { type: ActivityType.Custom }) client.user.setActivity('HullCSS.org', { type: ActivityType.Custom });
setInterval(() => { setInterval(() => {
const { memberCount } = client.guilds.cache.get('427865794467069962'); const { memberCount } = client.guilds.cache.get('427865794467069962');

View File

@ -16,7 +16,9 @@ module.exports = {
*/ */
run: async (client, interaction) => { run: async (client, interaction) => {
interaction.channel.permissionOverwrites.edit(interaction.guild.everyone, { SendMessages: false }); interaction.channel.permissionOverwrites.edit(interaction.guild.everyone, {
SendMessages: false,
});
interaction.reply('Channel has been locked.'); interaction.reply('Channel has been locked.');
}, },
}; };

View File

@ -1,6 +1,8 @@
const { Permissions } = require('discord.js'); const {
const { SlashCommandBuilder } = require('@discordjs/builders'); Permissions,
const { PermissionFlagsBits } = require('discord-api-types/v10'); SlashCommandBuilder,
PermissionFlagsBits,
} = require('discord.js');
module.exports = { module.exports = {
...new SlashCommandBuilder() ...new SlashCommandBuilder()
@ -18,33 +20,36 @@ module.exports = {
*/ */
run: async (client, interaction) => { run: async (client, interaction) => {
await interaction.deferReply({ await interaction.deferReply({
ephemeral: true, ephemeral: true,
}); });
try { try {
const role = interaction.guild.roles.cache.find(r => r.name === 'Paid Member') const role = interaction.guild.roles.cache.find(
(r) => r.name === 'Paid Member'
interaction.guild.roles.create({ );
name: role.name,
color: role.color,
hoist: role.hoist,
position: role.position,
permissions: role.permissions,
mentionable: role.mentionable,
})
role.delete(role.id, 'The Nuke Paid Command Was Run. '); interaction.guild.roles.create({
name: role.name,
color: role.color,
hoist: role.hoist,
position: role.position,
permissions: role.permissions,
mentionable: role.mentionable,
});
role.delete(role.id, 'The Nuke Paid Command Was Run. ');
const channel = client.channels.cache.get('1143157359917682711'); const channel = client.channels.cache.get('1143157359917682711');
channel.setName(`Paid Members: 0`); channel.setName(`Paid Members: 0`);
const newRole = interaction.guild.roles.cache.find(r => r.name === 'Paid Member') const newRole = interaction.guild.roles.cache.find(
interaction.editReply(`Role has been replaced. The paid members counter has been reset to 0.\n\n The new role ID is: ${newRole.id}. Please pass this to Kieran.`, true); (r) => r.name === 'Paid Member'
);
interaction.editReply(
`Role has been replaced. The paid members counter has been reset to 0.\n\n The new role ID is: ${newRole.id}. Please pass this to Kieran.`,
true
);
} catch (error) { } catch (error) {
interaction.editReply({ interaction.editReply({
content: error, content: error,

View File

@ -1,4 +1,8 @@
const { SlashCommandBuilder, PermissionFlagsBits, ThreadAutoArchiveDuration } = require('discord.js'); const {
SlashCommandBuilder,
PermissionFlagsBits,
ThreadAutoArchiveDuration,
} = require('discord.js');
module.exports = { module.exports = {
...new SlashCommandBuilder() ...new SlashCommandBuilder()
@ -16,7 +20,9 @@ module.exports = {
*/ */
run: async (client, interaction) => { run: async (client, interaction) => {
interaction.channel.permissionOverwrites.edit(interaction.guild.everyone, { SendMessages: true }); interaction.channel.permissionOverwrites.edit(interaction.guild.everyone, {
SendMessages: true,
});
interaction.reply('Channel has been unlocked.'); interaction.reply('Channel has been unlocked.');
}, },
}; };

View File

@ -0,0 +1,69 @@
const {
SlashCommandBuilder,
PermissionFlagsBits,
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
} = require('discord.js');
module.exports = {
...new SlashCommandBuilder()
.setName('paidmemberembed')
.setDescription('Create the paid member embed')
.setDefaultMemberPermissions(
PermissionFlagsBits.KickMembers || PermissionFlagsBits.BanMembers
),
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction) => {
const embed = new EmbedBuilder()
.setColor(0x3fb618)
.setFooter({ text: `Called By: ${interaction.user.tag}` })
.setTimestamp()
.setTitle('Paid Member!')
.setDescription(
`Press the button below to get access to the paid member role.`
)
.addFields(
{
name: 'Benefits?',
value:
'Come to every event\r\n Vote in AGMs and EGMs\r\n Access a special area, just for paid members\r\n Access our archive of previous events and guest talks\r\nAnd support the society you are apart of!',
},
{
name: 'Disclaimer!',
value:
'This is a manual process, executive members need to verify that you have paid your membership and then manually give you the role. **There is no notification of you receiving the role!**',
},
{
name: 'Pay for a membership',
value: 'Press the green button below!',
}
)
.setThumbnail('https://i.imgur.com/ww6wKwJ.png')
.setImage(`https://i.imgur.com/ro0U7LG.png?2048`);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setURL('https://hulluniunion.com/shop?aid=304')
.setLabel('Pay for a membership!')
.setStyle('Link')
)
.addComponents(
new ButtonBuilder()
.setCustomId('paidModal')
.setLabel('Paid Member Request')
.setStyle('Primary')
);
interaction.channel.send({ embeds: [embed], components: [row] });
interaction.reply({ content: 'Embed sent.', ephemeral: true });
},
};

View File

@ -13,11 +13,12 @@ module.exports = {
run: async (client, interaction) => { run: async (client, interaction) => {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle('Thanks for considering to become a paid member!') .setTitle('Thanks for considering to become a paid member!')
.setColor(0x3FB618) .setColor(0x3fb618)
.setFooter({ text: `Called By: ${interaction.user.tag}` }) .setFooter({ text: `Called By: ${interaction.user.tag}` })
.addFields( .addFields({
{name: 'You can purchase from below!', value: 'https://hulluniunion.com/shop?aid=304'} name: 'You can purchase from below!',
); value: 'https://hulluniunion.com/shop?aid=304',
});
interaction.reply({ embeds: [embed] }); interaction.reply({ embeds: [embed] });
}, },
}; };

View File

@ -18,9 +18,10 @@ module.exports = {
.setDescription( .setDescription(
'Freeside is the student run and maintained linux cluster within the University Of Hull Computer Science Department providing Linux administration experience, mentoring and technical advice alongside other peer-led support. It is completely free to all students to join, irrespective of degree pathway.' 'Freeside is the student run and maintained linux cluster within the University Of Hull Computer Science Department providing Linux administration experience, mentoring and technical advice alongside other peer-led support. It is completely free to all students to join, irrespective of degree pathway.'
) )
.addFields( .addFields({
{ name: 'You can join them from below!', value: 'https://discord.freeside.co.uk' } name: 'You can join them from below!',
); value: 'https://discord.freeside.co.uk',
});
interaction.reply({ embeds: [embed] }); interaction.reply({ embeds: [embed] });
}, },
}; };

View File

@ -13,9 +13,9 @@ module.exports = {
run: async (client, interaction) => { run: async (client, interaction) => {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle('Links!') .setTitle('Links!')
.setColor(0x3FB618) .setColor(0x3fb618)
.setFooter({ text: `Called By: ${interaction.user.tag}` }) .setFooter({ text: `Called By: ${interaction.user.tag}` })
.addFields({name: 'Find us here:', value: 'https://hullcss.org'}); .addFields({ name: 'Find us here:', value: 'https://hullcss.org' });
interaction.reply({ embeds: [embed] }); interaction.reply({ embeds: [embed] });
}, },
}; };

View File

@ -17,14 +17,16 @@ module.exports = {
const seconds = Math.floor(client.uptime / 1000) % 60; const seconds = Math.floor(client.uptime / 1000) % 60;
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(0x3FB618) .setColor(0x3fb618)
.setFooter({ text: `Called By: ${interaction.user.tag}` }) .setFooter({ text: `Called By: ${interaction.user.tag}` })
.setTimestamp() .setTimestamp()
.setTitle('Pong!') .setTitle('Pong!')
.setDescription(`${client.ws.ping} ping to host`) .setDescription(`${client.ws.ping} ping to host`)
.addFields( .addFields({
{ name: 'Uptime', value: `${days}days ${hours}hrs ${minutes}min ${seconds}sec`, inline: true } name: 'Uptime',
); value: `${days}days ${hours}hrs ${minutes}min ${seconds}sec`,
inline: true,
});
interaction.reply({ embeds: [embed] }); interaction.reply({ embeds: [embed] });
}, },
}; };

View File

@ -20,7 +20,7 @@ module.exports = {
) )
.addFields({ .addFields({
name: 'You can join them from below!', name: 'You can join them from below!',
value: 'https://discord.gg/cMP5CavnK4' value: 'https://discord.gg/cMP5CavnK4',
}); });
interaction.reply({ embeds: [embed] }); interaction.reply({ embeds: [embed] });
}, },