style: Eslint changes to get rid of errors
parent
dc4098703e
commit
53a5a7f003
|
@ -1,9 +1,13 @@
|
||||||
{
|
{
|
||||||
"extends": ["airbnb-base", "plugin:prettier/recommended"],
|
"env": {
|
||||||
"plugins": ["prettier"],
|
"node": true,
|
||||||
"parserOptions": {
|
"commonjs": true,
|
||||||
"ecmaVersion": 2018
|
"es2021": true
|
||||||
},
|
},
|
||||||
|
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest"
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
"no-unused-vars": "warn",
|
"no-unused-vars": "warn",
|
||||||
|
|
|
@ -1,298 +1,313 @@
|
||||||
const client = require("../index");
|
const client = require('../index');
|
||||||
const discord = require("discord.js")
|
const discord = require('discord.js');
|
||||||
|
|
||||||
client.on("interactionCreate", async (interaction) => {
|
client.on('interactionCreate', async (interaction) => {
|
||||||
// Slash Command Handling
|
// Slash Command Handling
|
||||||
if (interaction.isCommand()) {
|
if (interaction.isCommand()) {
|
||||||
const cmd = client.slashCommands.get(interaction.commandName);
|
const cmd = client.slashCommands.get(interaction.commandName);
|
||||||
if (!cmd)
|
if (!cmd) return interaction.reply({ content: 'An error has occurred' });
|
||||||
return interaction.reply({ content: "An error has occurred" });
|
|
||||||
|
|
||||||
const args = [];
|
const args = [];
|
||||||
|
|
||||||
for (let option of interaction.options.data) {
|
for (let option of interaction.options.data) {
|
||||||
if (option.type === "SUB_COMMAND") {
|
if (option.type === 'SUB_COMMAND') {
|
||||||
if (option.name) args.push(option.name);
|
if (option.name) args.push(option.name);
|
||||||
option.options?.forEach((x) => {
|
option.options?.forEach((x) => {
|
||||||
if (x.value) args.push(x.value);
|
if (x.value) args.push(x.value);
|
||||||
});
|
});
|
||||||
} else if (option.value) args.push(option.value);
|
} else if (option.value) args.push(option.value);
|
||||||
}
|
}
|
||||||
interaction.member = interaction.guild.members.cache.get(interaction.user.id);
|
interaction.member = interaction.guild.members.cache.get(
|
||||||
|
interaction.user.id
|
||||||
|
);
|
||||||
|
|
||||||
cmd.run(client, interaction, args);
|
cmd.run(client, interaction, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Context Menu Handling
|
// Context Menu Handling
|
||||||
if (interaction.isContextMenu()) {
|
if (interaction.isContextMenu()) {
|
||||||
await interaction.deferReply({ ephemeral: false });
|
await interaction.deferReply({ ephemeral: false });
|
||||||
const command = client.slashCommands.get(interaction.commandName);
|
const command = client.slashCommands.get(interaction.commandName);
|
||||||
if (command) command.run(client, interaction);
|
if (command) command.run(client, interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button Handling
|
// Button Handling
|
||||||
if (interaction.isButton()) {
|
if (interaction.isButton()) {
|
||||||
if(interaction.customId == "codeOfConduct"){
|
if (interaction.customId == 'codeOfConduct') {
|
||||||
if(interaction.member.roles.cache.has("973646380771979304"))
|
if (interaction.member.roles.cache.has('973646380771979304')) {
|
||||||
{
|
interaction.reply({
|
||||||
interaction.reply({ content: 'You already have agreed to the code of conduct!', ephemeral: true})
|
content: 'You already have agreed to the code of conduct!',
|
||||||
}
|
ephemeral: true,
|
||||||
else
|
});
|
||||||
{
|
} else {
|
||||||
interaction.member.roles.add("973646380771979304")
|
interaction.member.roles.add('973646380771979304');
|
||||||
await interaction.reply({ content: 'Thank you for agreeing to the code of conduct!\r\nYou can now access the rest of the server!', ephemeral: true});
|
await interaction.reply({
|
||||||
}
|
content:
|
||||||
}
|
'Thank you for agreeing to the code of conduct!\r\nYou can now access the rest of the server!',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interaction.customId == 'paidModal') {
|
||||||
|
if (interaction.member.roles.cache.has(`427878753008353292`)) {
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
interaction.followUp({
|
||||||
|
content: 'You already have the paid member role.',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const modal = new discord.Modal()
|
||||||
|
.setCustomId('modal-paidmember')
|
||||||
|
.setTitle('Paid Member Discord Access');
|
||||||
|
const studentname = new discord.TextInputComponent()
|
||||||
|
.setLabel('Student Name')
|
||||||
|
.setStyle('SHORT')
|
||||||
|
.setCustomId('studentname')
|
||||||
|
.setPlaceholder(`Joe Blogs`);
|
||||||
|
const studentnumber = new discord.TextInputComponent()
|
||||||
|
.setLabel('Student Number')
|
||||||
|
.setStyle('SHORT')
|
||||||
|
.setCustomId('studentnumber')
|
||||||
|
.setPlaceholder(`202001234`);
|
||||||
|
const firstActionRow = new discord.MessageActionRow().addComponents(
|
||||||
|
studentname
|
||||||
|
);
|
||||||
|
const secondActionRow = new discord.MessageActionRow().addComponents(
|
||||||
|
studentnumber
|
||||||
|
);
|
||||||
|
modal.addComponents(firstActionRow, secondActionRow);
|
||||||
|
await interaction.showModal(modal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interaction.customId == 'deletemessage') {
|
||||||
|
await interaction.message.delete();
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Message has been deleted',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interaction.customId == 'CloseThread') {
|
||||||
|
interaction.reply(
|
||||||
|
`This channel has been archived, you can unarchive this thread by sending another message.`
|
||||||
|
);
|
||||||
|
interaction.channel.setArchived(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.customId == "paidModal")
|
// Select Menu Handling
|
||||||
{
|
if (interaction.isSelectMenu()) {
|
||||||
if(interaction.member.roles.cache.has(`427878753008353292`))
|
if (interaction.customId == 'yearSelect') {
|
||||||
{
|
if (interaction.values.includes('0')) {
|
||||||
await interaction.deferReply({ ephemeral: true })
|
interaction.member.roles.add('974754114296741948'); // Add Foundation
|
||||||
interaction.followUp({ content: 'You already have the paid member role.', ephemeral: true })
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('1')) {
|
||||||
|
interaction.member.roles.add('441276956089122836'); // Add First Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('2')) {
|
||||||
|
interaction.member.roles.add('441276979514441741'); // Add Second Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('3')) {
|
||||||
|
interaction.member.roles.add('441277048003100684'); // Add Year In Industry Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('4')) {
|
||||||
|
interaction.member.roles.add('441277001744121856'); // Add Third Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('5')) {
|
||||||
|
interaction.member.roles.add('441277023873138743'); // Add Masters Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('6')) {
|
||||||
|
interaction.member.roles.add('460435898660683778'); // Add PhD Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('441277481488613386'); // Remove Graduate Year
|
||||||
|
} else if (interaction.values.includes('7')) {
|
||||||
|
interaction.member.roles.add('441277481488613386'); // Add Graduate Year
|
||||||
|
interaction.member.roles.remove('974754114296741948'); // Remove Foundation Year
|
||||||
|
interaction.member.roles.remove('441276956089122836'); // Remove First Year
|
||||||
|
interaction.member.roles.remove('441276979514441741'); // Remove Second Year
|
||||||
|
interaction.member.roles.remove('441277048003100684'); // Remove Year In Industry Year
|
||||||
|
interaction.member.roles.remove('441277001744121856'); // Remove Third Year
|
||||||
|
interaction.member.roles.remove('441277023873138743'); // Remove Masters Year
|
||||||
|
interaction.member.roles.remove('460435898660683778'); // Remove PhD Year
|
||||||
|
}
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Roles have been updated',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if (interaction.customId == 'pronounSelect') {
|
||||||
else{
|
if (interaction.values.includes('HeHim')) {
|
||||||
const modal = new discord.Modal()
|
interaction.member.roles.add('851148987271479385');
|
||||||
.setCustomId('modal-paidmember')
|
} else {
|
||||||
.setTitle('Paid Member Discord Access')
|
interaction.member.roles.remove('851148987271479385');
|
||||||
const studentname = new discord.TextInputComponent()
|
}
|
||||||
.setLabel("Student Name")
|
|
||||||
.setStyle("SHORT")
|
|
||||||
.setCustomId("studentname")
|
|
||||||
.setPlaceholder(`Joe Blogs`)
|
|
||||||
const studentnumber = new discord.TextInputComponent()
|
|
||||||
.setLabel("Student Number")
|
|
||||||
.setStyle("SHORT")
|
|
||||||
.setCustomId("studentnumber")
|
|
||||||
.setPlaceholder(`202001234`)
|
|
||||||
const firstActionRow = new discord.MessageActionRow().addComponents(studentname);
|
|
||||||
const secondActionRow = new discord.MessageActionRow().addComponents(studentnumber);
|
|
||||||
modal.addComponents(firstActionRow, secondActionRow);
|
|
||||||
await interaction.showModal(modal);
|
|
||||||
|
|
||||||
}
|
if (interaction.values.includes('HeThey')) {
|
||||||
}
|
interaction.member.roles.add('974762127762010162');
|
||||||
|
} else {
|
||||||
|
interaction.member.roles.remove('974762127762010162');
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.customId == "deletemessage")
|
if (interaction.values.includes('SheHer')) {
|
||||||
{
|
interaction.member.roles.add('851149045241085963');
|
||||||
await interaction.message.delete();
|
} else {
|
||||||
await interaction.reply({ content: 'Message has been deleted', ephemeral: true});
|
interaction.member.roles.remove('851149045241085963');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interaction.values.includes('SheThey')) {
|
||||||
|
interaction.member.roles.add('974762040969273404');
|
||||||
|
} else {
|
||||||
|
interaction.member.roles.remove('974762040969273404');
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.customId == "CloseThread")
|
if (interaction.values.includes('TheyThem')) {
|
||||||
{
|
interaction.member.roles.add('851149362582913074');
|
||||||
interaction.reply(`This channel has been archived, you can unarchive this thread by sending another message.`)
|
} else {
|
||||||
interaction.channel.setArchived(true)
|
interaction.member.roles.remove('851149362582913074');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (interaction.values.includes('Any')) {
|
||||||
|
interaction.member.roles.add('851149407050137631');
|
||||||
|
} else {
|
||||||
|
interaction.member.roles.remove('851149407050137631');
|
||||||
|
}
|
||||||
|
|
||||||
// Select Menu Handling
|
if (interaction.values.includes('Ask')) {
|
||||||
if(interaction.isSelectMenu()) {
|
interaction.member.roles.add('851149443738107934');
|
||||||
if(interaction.customId == "yearSelect")
|
} else {
|
||||||
{
|
interaction.member.roles.remove('851149443738107934');
|
||||||
if(interaction.values.includes("0"))
|
}
|
||||||
{
|
|
||||||
interaction.member.roles.add("974754114296741948") // Add Foundation
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("1"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("441276956089122836") // Add First Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("2"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("441276979514441741") // Add Second Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("3"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("441277048003100684") // Add Year In Industry Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("4"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("441277001744121856") // Add Third Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("5"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("441277023873138743") // Add Masters Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("6"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("460435898660683778") // Add PhD Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("441277481488613386") // Remove Graduate Year
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("7"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("441277481488613386") // Add Graduate Year
|
|
||||||
interaction.member.roles.remove("974754114296741948") // Remove Foundation Year
|
|
||||||
interaction.member.roles.remove("441276956089122836") // Remove First Year
|
|
||||||
interaction.member.roles.remove("441276979514441741") // Remove Second Year
|
|
||||||
interaction.member.roles.remove("441277048003100684") // Remove Year In Industry Year
|
|
||||||
interaction.member.roles.remove("441277001744121856") // Remove Third Year
|
|
||||||
interaction.member.roles.remove("441277023873138743") // Remove Masters Year
|
|
||||||
interaction.member.roles.remove("460435898660683778") // Remove PhD Year
|
|
||||||
}
|
|
||||||
await interaction.reply({ content: 'Roles have been updated', ephemeral: true});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Roles have been updated',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.customId == "pronounSelect")
|
if (interaction.customId == 'bcsSelect') {
|
||||||
{
|
if (interaction.values.includes('bscStudent')) {
|
||||||
if(interaction.values.includes("HeHim"))
|
interaction.member.roles.add('891422426133581895'); // Add BCS Student
|
||||||
{ interaction.member.roles.add("851148987271479385")}
|
interaction.member.roles.remove('891422508555829288'); // Remove Associate
|
||||||
else{interaction.member.roles.remove("851148987271479385")}
|
interaction.member.roles.remove('891422669575184436'); // Remove Prof
|
||||||
|
interaction.member.roles.remove('891422900182204487'); // Remove Fellow
|
||||||
|
} else if (interaction.values.includes('bcsAss')) {
|
||||||
|
interaction.member.roles.add('891422508555829288'); // Add BCS Associate
|
||||||
|
interaction.member.roles.remove('891422426133581895'); // Remove Student
|
||||||
|
interaction.member.roles.remove('891422669575184436'); // Remove Prof
|
||||||
|
interaction.member.roles.remove('891422900182204487'); // Remove Fellow
|
||||||
|
} else if (interaction.values.includes('bcsProf')) {
|
||||||
|
interaction.member.roles.add('891422669575184436'); // Add Prof
|
||||||
|
interaction.member.roles.remove('891422426133581895'); // Remove Student
|
||||||
|
interaction.member.roles.remove('891422508555829288'); // Remove Associate
|
||||||
|
interaction.member.roles.remove('891422900182204487'); // Remove Fellow
|
||||||
|
} else if (interaction.values.includes('bcsFellow')) {
|
||||||
|
interaction.member.roles.add('891422900182204487'); // Add Fellow
|
||||||
|
interaction.member.roles.remove('891422426133581895'); // Remove Student
|
||||||
|
interaction.member.roles.remove('891422508555829288'); // Remove Associate
|
||||||
|
interaction.member.roles.remove('891422669575184436'); // Remove Prof
|
||||||
|
}
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Roles have been updated',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.values.includes("HeThey"))
|
if (interaction.customId == 'miscSelect') {
|
||||||
{ interaction.member.roles.add("974762127762010162")}
|
if (interaction.values.includes('courserep')) {
|
||||||
else{interaction.member.roles.remove("974762127762010162")}
|
interaction.member.roles.add('493738161713709077');
|
||||||
|
} else {
|
||||||
|
interaction.member.roles.remove('493738161713709077');
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.values.includes("SheHer"))
|
if (interaction.values.includes('ACWPing')) {
|
||||||
{ interaction.member.roles.add("851149045241085963")}
|
interaction.member.roles.add('904354161561309184');
|
||||||
else{interaction.member.roles.remove("851149045241085963")}
|
} else {
|
||||||
|
interaction.member.roles.remove('904354161561309184');
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.values.includes("SheThey"))
|
await interaction.reply({
|
||||||
{ interaction.member.roles.add("974762040969273404")}
|
content: 'Roles have been updated',
|
||||||
else{interaction.member.roles.remove("974762040969273404")}
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.values.includes("TheyThem"))
|
// Modal Handling
|
||||||
{ interaction.member.roles.add("851149362582913074")}
|
if (interaction.isModalSubmit) {
|
||||||
else{interaction.member.roles.remove("851149362582913074")}
|
if (interaction.customId === 'modal-paidmember') {
|
||||||
|
const execchannel = client.channels.cache.get('981678376655921153');
|
||||||
|
|
||||||
if(interaction.values.includes("Any"))
|
const embed = new discord.MessageEmbed()
|
||||||
{ interaction.member.roles.add("851149407050137631")}
|
.setTitle('New Paid Member Request')
|
||||||
else{interaction.member.roles.remove("851149407050137631")}
|
.setColor('GREEN')
|
||||||
|
.addField('Discord Tag', `${interaction.user} <- Click to add role.`)
|
||||||
if(interaction.values.includes("Ask"))
|
.addField('Discord Discriminator', `${interaction.user.tag}`)
|
||||||
{ interaction.member.roles.add("851149443738107934")}
|
.addField(
|
||||||
else{interaction.member.roles.remove("851149443738107934")}
|
'Student Name',
|
||||||
|
`${interaction.fields.getTextInputValue('studentname')}`
|
||||||
await interaction.reply({ content: 'Roles have been updated', ephemeral: true});
|
)
|
||||||
}
|
.addField(
|
||||||
|
'Student Number',
|
||||||
|
`${interaction.fields.getTextInputValue('studentnumber')}`
|
||||||
if(interaction.customId == "bcsSelect")
|
)
|
||||||
{
|
.setDescription('https://hulluniunion.com/');
|
||||||
if(interaction.values.includes("bscStudent"))
|
const row = new discord.MessageActionRow().addComponents(
|
||||||
{
|
new discord.MessageButton()
|
||||||
interaction.member.roles.add("891422426133581895") // Add BCS Student
|
.setCustomId('deletemessage')
|
||||||
interaction.member.roles.remove("891422508555829288") // Remove Associate
|
.setEmoji('')
|
||||||
interaction.member.roles.remove("891422669575184436") // Remove Prof
|
.setLabel('Delete Message')
|
||||||
interaction.member.roles.remove("891422900182204487") // Remove Fellow
|
.setStyle('DANGER')
|
||||||
}
|
);
|
||||||
else if(interaction.values.includes("bcsAss"))
|
execchannel.send({ embeds: [embed], components: [row] });
|
||||||
{
|
await interaction.deferReply({ ephemeral: true });
|
||||||
interaction.member.roles.add("891422508555829288") // Add BCS Associate
|
interaction.followUp({
|
||||||
interaction.member.roles.remove("891422426133581895") // Remove Student
|
content: 'Your request has been sent to execs!',
|
||||||
interaction.member.roles.remove("891422669575184436") // Remove Prof
|
ephemeral: true,
|
||||||
interaction.member.roles.remove("891422900182204487") // Remove Fellow
|
});
|
||||||
}
|
}
|
||||||
else if(interaction.values.includes("bcsProf"))
|
}
|
||||||
{
|
|
||||||
interaction.member.roles.add("891422669575184436") // Add Prof
|
|
||||||
interaction.member.roles.remove("891422426133581895") // Remove Student
|
|
||||||
interaction.member.roles.remove("891422508555829288") // Remove Associate
|
|
||||||
interaction.member.roles.remove("891422900182204487") // Remove Fellow
|
|
||||||
}
|
|
||||||
else if(interaction.values.includes("bcsFellow"))
|
|
||||||
{
|
|
||||||
interaction.member.roles.add("891422900182204487") // Add Fellow
|
|
||||||
interaction.member.roles.remove("891422426133581895") // Remove Student
|
|
||||||
interaction.member.roles.remove("891422508555829288") // Remove Associate
|
|
||||||
interaction.member.roles.remove("891422669575184436") // Remove Prof
|
|
||||||
}
|
|
||||||
await interaction.reply({ content: 'Roles have been updated', ephemeral: true});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(interaction.customId == "miscSelect")
|
|
||||||
{
|
|
||||||
if(interaction.values.includes("courserep"))
|
|
||||||
{ interaction.member.roles.add("493738161713709077")}
|
|
||||||
else{interaction.member.roles.remove("493738161713709077")}
|
|
||||||
|
|
||||||
if(interaction.values.includes("ACWPing"))
|
|
||||||
{ interaction.member.roles.add("904354161561309184")}
|
|
||||||
else{interaction.member.roles.remove("904354161561309184")}
|
|
||||||
|
|
||||||
await interaction.reply({ content: 'Roles have been updated', ephemeral: true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modal Handling
|
|
||||||
if(interaction.isModalSubmit) {
|
|
||||||
if(interaction.customId === 'modal-paidmember'){
|
|
||||||
const execchannel = client.channels.cache.get('981678376655921153')
|
|
||||||
|
|
||||||
const embed = new discord.MessageEmbed()
|
|
||||||
.setTitle("New Paid Member Request")
|
|
||||||
.setColor('GREEN')
|
|
||||||
.addField('Discord Tag', `${ interaction.user} <- Click to add role.`)
|
|
||||||
.addField('Discord Discriminator', `${interaction.user.tag}`)
|
|
||||||
.addField('Student Name', `${ interaction.fields.getTextInputValue("studentname")}`)
|
|
||||||
.addField('Student Number',`${ interaction.fields.getTextInputValue("studentnumber")}`)
|
|
||||||
.setDescription('https://hulluniunion.com/')
|
|
||||||
const row = new discord.MessageActionRow()
|
|
||||||
.addComponents(
|
|
||||||
new discord.MessageButton()
|
|
||||||
.setCustomId('deletemessage')
|
|
||||||
.setEmoji('')
|
|
||||||
.setLabel('Delete Message')
|
|
||||||
.setStyle('DANGER')
|
|
||||||
)
|
|
||||||
execchannel.send({embeds: [embed], components: [row] });
|
|
||||||
await interaction.deferReply({ ephemeral: true })
|
|
||||||
interaction.followUp({ content: 'Your request has been sent to execs!', ephemeral: true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
|
@ -1,24 +1,23 @@
|
||||||
const client = require("../index");
|
const client = require('../index');
|
||||||
require("dotenv").config();
|
require('dotenv').config();
|
||||||
const discord = require('discord.js');
|
|
||||||
|
|
||||||
client.on("messageCreate", async (message) => {
|
client.on('messageCreate', async (message) => {
|
||||||
|
if (
|
||||||
|
message.author.bot ||
|
||||||
|
!message.guild ||
|
||||||
|
!message.content.toLowerCase().startsWith(process.env.PREFIX)
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
if (
|
const [cmd, ...args] = message.content
|
||||||
message.author.bot ||
|
.slice(process.env.PREFIX.length)
|
||||||
!message.guild ||
|
.trim()
|
||||||
!message.content.toLowerCase().startsWith(process.env.PREFIX)
|
.split(/ +/g);
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const [cmd, ...args] = message.content
|
const command =
|
||||||
.slice(process.env.PREFIX.length)
|
client.commands.get(cmd.toLowerCase()) ||
|
||||||
.trim()
|
client.commands.find((c) => c.aliases?.includes(cmd.toLowerCase()));
|
||||||
.split(/ +/g);
|
|
||||||
|
|
||||||
const command = client.commands.get(cmd.toLowerCase()) || client.commands.find(c => c.aliases?.includes(cmd.toLowerCase()));
|
|
||||||
|
|
||||||
if (!command) return;
|
|
||||||
await command.run(client, message, args);
|
|
||||||
|
|
||||||
|
if (!command) return;
|
||||||
|
await command.run(client, message, args);
|
||||||
});
|
});
|
|
@ -1,6 +1,5 @@
|
||||||
const { glob } = require("glob");
|
const { glob } = require('glob');
|
||||||
const { promisify } = require("util");
|
const { promisify } = require('util');
|
||||||
const { Client } = require("discord.js");
|
|
||||||
|
|
||||||
const globPromise = promisify(glob);
|
const globPromise = promisify(glob);
|
||||||
|
|
||||||
|
@ -8,43 +7,41 @@ const globPromise = promisify(glob);
|
||||||
* @param {Client} client
|
* @param {Client} client
|
||||||
*/
|
*/
|
||||||
module.exports = async (client) => {
|
module.exports = async (client) => {
|
||||||
// Commands
|
// Commands
|
||||||
const commandFiles = await globPromise(`${process.cwd()}/src/commands/**/*.js`);
|
const commandFiles = await globPromise(
|
||||||
commandFiles.map((value) => {
|
`${process.cwd()}/src/commands/**/*.js`
|
||||||
const file = require(value);
|
);
|
||||||
const splitted = value.split("/");
|
commandFiles.map((value) => {
|
||||||
const directory = splitted[splitted.length - 2];
|
const file = require(value);
|
||||||
|
const splitted = value.split('/');
|
||||||
|
const directory = splitted[splitted.length - 2];
|
||||||
|
|
||||||
if (file.name) {
|
if (file.name) {
|
||||||
const properties = { directory, ...file };
|
const properties = { directory, ...file };
|
||||||
client.commands.set(file.name, properties);
|
client.commands.set(file.name, properties);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
const eventFiles = await globPromise(`${process.cwd()}/src/events/*.js`);
|
const eventFiles = await globPromise(`${process.cwd()}/src/events/*.js`);
|
||||||
eventFiles.map((value) => require(value));
|
eventFiles.map((value) => require(value));
|
||||||
|
|
||||||
// Slash Commands
|
// Slash Commands
|
||||||
const slashCommands = await globPromise(`${process.cwd()}/src/slashCommands/*/*.js`);
|
const slashCommands = await globPromise(
|
||||||
|
`${process.cwd()}/src/slashCommands/*/*.js`
|
||||||
|
);
|
||||||
|
|
||||||
const arrayOfSlashCommands = [];
|
const arrayOfSlashCommands = [];
|
||||||
slashCommands.map((value) => {
|
slashCommands.map((value) => {
|
||||||
const file = require(value);
|
const file = require(value);
|
||||||
if (!file?.name) return;
|
if (!file?.name) return;
|
||||||
client.slashCommands.set(file.name, file);
|
client.slashCommands.set(file.name, file);
|
||||||
|
|
||||||
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
|
if (['MESSAGE', 'USER'].includes(file.type)) delete file.description;
|
||||||
arrayOfSlashCommands.push(file);
|
arrayOfSlashCommands.push(file);
|
||||||
});
|
});
|
||||||
client.on("ready", async () => {
|
client.on('ready', async () => {
|
||||||
const guild1 = client.guilds.cache.get("969944638498680872");
|
// Register for all the guilds the bot is in
|
||||||
guild1.commands.set([]);
|
await client.application.commands.set(arrayOfSlashCommands);
|
||||||
|
});
|
||||||
const guild2 = client.guilds.cache.get("427865794467069962");
|
|
||||||
guild2.commands.set([]);
|
|
||||||
|
|
||||||
// Register for all the guilds the bot is in
|
|
||||||
await client.application.commands.set(arrayOfSlashCommands);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue