Skip to content

Commit b85105a

Browse files
zcDay1imagine-hussaintuneinAcdSoftColhjt
authored
bring projects-bot up to date with develop (#155)
* migrate from insou api to circles for the handbook commands (#128) * migrate from insou api to circles for the handbook commands * remove trailing forward slash in handbook.json * handbook: the handbook is fixed * Update handbook.js commented out a console.log --------- Co-authored-by: tunein <z5371683@ad.unsw.edu.au> Co-authored-by: zcDay1 <113964162+zcDay1@users.noreply.github.com> * prettier formatted * chore(deps): update `renovate` config * chore(deps): update docker/build-push-action action to v4 (#134) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Projects description command feature (#145) * projects-descriptions v1 commit * project-descriptions command v2 commit * linting fixes for project-descriptions.js, and for handbook.js --------- Co-authored-by: AcdSoftCo <106219586+AcdSoftCo@users.noreply.github.com> * disable annoying carrotboard pins * rolesPermOverride command is a script or one-time use command to attach every course role with permissions to view and send messages in any text channel with identical name. Please review and test before merging * Revert "rolesPermOverride command is a script or one-time use command to attach every course role with permissions to view and send messages in any text channel with identical name. Please review and test before merging" This reverts commit 2f59c71. * rolesPermOverride command (#152) * rolesPermOverride command is a script or one-time use command to attach every course role with permissions to view and send messages in any text channel with identical name. Please review and test before mergin * BUGGY CODE but still progress over the previous commit, I will come back this evening to fix * rolesPermOverride command: now admin-only command, and I've tested it for various cases regarding if a channel exists, if a role exists for a channel that doesnt exist, if there are two channels with the same name as a role and vice versa, and it works without error --------- Co-authored-by: AcdSoftCo <106219586+AcdSoftCo@users.noreply.github.com> * Roles perm override (#153) * rolesPermOverride command is a script or one-time use command to attach every course role with permissions to view and send messages in any text channel with identical name. Please review and test before mergin * BUGGY CODE but still progress over the previous commit, I will come back this evening to fix * rolesPermOverride command: now admin-only command, and I've tested it for various cases regarding if a channel exists, if a role exists for a channel that doesnt exist, if there are two channels with the same name as a role and vice versa, and it works without error * course.js: removed code to create individual user permission overwrites in each channel --------- Co-authored-by: AcdSoftCo <106219586+AcdSoftCo@users.noreply.github.com> * Project descriptions (#154) * project-descriptions.js: updated course descriptions written by the directors for 2023 levelling up with Projects Fair Day, and the discord bot CTF flag easter egg entry under this command included too for this event. * made messages ephemeral to prevent chat from being spammed by users. And got rid of link embeds in the messages. * lint update --------- Co-authored-by: AcdSoftCo <106219586+AcdSoftCo@users.noreply.github.com> --------- Co-authored-by: imagine-hussain <93496985+imagine-hussain@users.noreply.github.com> Co-authored-by: tunein <z5371683@ad.unsw.edu.au> Co-authored-by: AcdSoftCo <106219586+AcdSoftCo@users.noreply.github.com> Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: abiramen <7523422+abiramen@users.noreply.github.com>
1 parent be30a3e commit b85105a

File tree

4 files changed

+178
-127
lines changed

4 files changed

+178
-127
lines changed

commands/course.js

Lines changed: 4 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -128,52 +128,8 @@ module.exports = {
128128
});
129129
}
130130

131-
// Otherwise, find a channel with the same name as the course
132-
const channel = await interaction.guild.channels.cache.find(
133-
(c) => c.name.toLowerCase() === course.toLowerCase(),
134-
);
135-
136-
// Make sure that the channel exists, and is a text channel
137-
if (channel === undefined) {
138-
return await interaction.reply({
139-
content: `❌ | The course chat for \`${course}\` does not exist. If you'd like for it to be created, please raise a ticket in <#${MODERATION_REQUEST_CHANNEL}>.`,
140-
ephemeral: true,
141-
});
142-
} else if (channel.type !== "GUILD_TEXT") {
143-
return await interaction.reply({
144-
content: `❌ | The course chat for \`${course}\` is not a text channel.`,
145-
ephemeral: true,
146-
});
147-
}
148-
149-
const permissions = new Permissions(
150-
channel.permissionsFor(interaction.user.id).bitfield,
151-
);
152-
153-
// Check if the member already has an entry in the channel's permission overwrites, and update
154-
// the entry if they do just to make sure that they have the correct permissions
155-
if (
156-
permissions.has([
157-
Permissions.FLAGS.VIEW_CHANNEL,
158-
Permissions.FLAGS.SEND_MESSAGES,
159-
])
160-
) {
161-
await channel.permissionOverwrites.edit(interaction.member, {
162-
VIEW_CHANNEL: true,
163-
});
164-
return await interaction.reply({
165-
content: `❌ | You are already in the course chat for \`${course_with_alias}\`.`,
166-
ephemeral: true,
167-
});
168-
}
169-
170-
// Add the member to the channel's permission overwrites
171-
await channel.permissionOverwrites.create(interaction.member, {
172-
VIEW_CHANNEL: true,
173-
});
174-
175131
return await interaction.reply({
176-
content: `✅ | Added you to the chat for ${course_with_alias}.`,
132+
content: `✅ | End of command - ${course_with_alias}.`,
177133
ephemeral: true,
178134
});
179135
} else if (interaction.options.getSubcommand() === COMMAND_LEAVE) {
@@ -182,7 +138,7 @@ module.exports = {
182138

183139
if (!is_valid_course(course)) {
184140
return await interaction.reply({
185-
content: `❌ | You are not allowed to leave this channel using this command.`,
141+
content: `❌ | Not a valid course.`,
186142
ephemeral: true,
187143
});
188144
}
@@ -196,63 +152,19 @@ module.exports = {
196152
if (role !== undefined) {
197153
if (!interaction.member.roles.cache.has(role.id)) {
198154
return await interaction.reply({
199-
content: `❌ | You are not in the course chat for \`${course}\`.`,
155+
content: `❌ | You do not have the role for \`${course}\`.`,
200156
ephemeral: true,
201157
});
202158
}
203159

204160
// If they do, let's remove the role from them
205161
await interaction.member.roles.remove(role);
206162
return await interaction.reply({
207-
content: `✅ | Removed you from the chat for \`${course}\`.`,
163+
content: `✅ | Removed you from the role and chat for \`${course}\`.`,
208164
ephemeral: true,
209165
});
210166
}
211-
212-
// Find a channel with the same name as the course
213-
const channel = await interaction.guild.channels.cache.find(
214-
(c) => c.name.toLowerCase() === course.toLowerCase(),
215-
);
216-
217-
// Otherwise, make sure that the channel exists, and is a text channel
218-
if (channel === undefined) {
219-
return await interaction.reply({
220-
content: `❌ | The course chat for \`${course}\` does not exist.`,
221-
ephemeral: true,
222-
});
223-
} else if (channel.type !== "GUILD_TEXT") {
224-
return await interaction.reply({
225-
content: `❌ | The course chat for \`${course}\` is not a text channel.`,
226-
ephemeral: true,
227-
});
228-
}
229-
230-
const permissions = new Permissions(
231-
channel.permissionsFor(interaction.user.id).bitfield,
232-
);
233-
234-
// Check if the member already has an entry in the channel's permission overwrites
235-
if (
236-
!permissions.has([
237-
Permissions.FLAGS.VIEW_CHANNEL,
238-
Permissions.FLAGS.SEND_MESSAGES,
239-
])
240-
) {
241-
return await interaction.reply({
242-
content: `❌ | You are not in the course chat for \`${course}\`.`,
243-
ephemeral: true,
244-
});
245-
}
246-
247-
// Remove the member from the channel's permission overwrites
248-
await channel.permissionOverwrites.delete(interaction.member);
249-
250-
return await interaction.reply({
251-
content: `✅ | Removed you from the course chat for \`${course}\`.`,
252-
ephemeral: true,
253-
});
254167
}
255-
256168
return await interaction.reply("Error: invalid subcommand.");
257169
} catch (error) {
258170
await interaction.reply("Error: " + error);

commands/project-descriptions.js

Lines changed: 79 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ module.exports = {
1212
.addChoices([
1313
["Chaos", "chaos"],
1414
["Circles", "circles"],
15-
["CS Electives", "cselectives"],
15+
["Uni-lectives", "unilectives"],
1616
["Discord Bot", "discordbot"],
1717
["Freerooms", "freerooms"],
1818
["Jobsboard", "jobsboard"],
1919
["Notangles", "notangles"],
2020
["Structs.sh", "structs.sh"],
21+
["Trainee Program", "training-program"],
2122
["UI/UX", "ui/ux"],
23+
["CMS", "cms"],
2224
["Website", "website"],
25+
["???", "projects-fair-easter-egg-ctf"],
2326
]),
2427
),
2528

@@ -28,57 +31,100 @@ module.exports = {
2831
// console.log(`.${parsedOption}.`);
2932
switch (parsedOption) {
3033
case "chaos":
31-
await interaction.reply(
32-
"Chaos is a CSESoc internal recruitment tool written in Rust.",
33-
);
34+
await interaction.reply({
35+
content:
36+
"Chaos is an internal recruitment tool written in Rust. Are you allergic to google sheets and excel? Do you have nightmares from browsing through millions of lines of csv just to pick one applicant to take in? \nIntroducing Chaos, the ultimate lifesaver for clubs and societies! \nSay goodbye to the chaos and hello to simplicity. Chaos streamlines everything, making applications a breeze. \nWith a Rust 🦀 backend, type-safe and secure, no more segfaults and losing data! \nOur minimalistic while aesthetic frontend interface frees your eyes and brains from the repetitive and dull rows and columns of data sheets 📃\n\n<https://chaos.csesoc.app/>",
37+
ephemeral: true,
38+
});
3439
break;
3540
case "circles":
36-
await interaction.reply(
37-
"Circles is a degree planner that helps you choose courses, plan out your terms and check progression.",
38-
);
41+
await interaction.reply({
42+
content:
43+
"Tired of using a poorly laid out spreadsheet to cobble together a course progression plan to follow for the next 3-8 years of your life? Have no fear, Circles is here! \nCircles is a UNSW degree planner where you can explore and validate your degree structure. \nYou can find and use a live build of Circles at <https://circles.csesoc.app/>",
44+
ephemeral: true,
45+
});
3946
break;
40-
case "cselectives":
41-
await interaction.reply(
42-
"Unsure about what a course is like? Worry no more; CSElectives lets you read and write reviews of UNSW CSE courses.",
43-
);
47+
case "unilectives":
48+
await interaction.reply({
49+
content:
50+
"Tired of searching through websites and forum posts to find the perfect course? Only to discover that it's offered once a year? Or perhaps the workload turned out to be completely different from your expectations? \nLook no further, Uni-lectives has got your back. With 1000 unique reviews and counting across a variety of faculties, Uni-lectives is your one stop shop for UNSW courses and electives, where you can access valuable reviews and also contribute your own, empowering others to make informed choices about the courses they enrol in!\n\n<https://unilectives.csesoc.app/>",
51+
ephemeral: true,
52+
});
4453
break;
4554
case "discordbot":
46-
await interaction.reply(
47-
"CSESoc Discord Bot is your friendly helper in all things fun and CSE.",
48-
);
55+
await interaction.reply({
56+
content:
57+
"Discord Bot is your friendly CSE discord companion on the CSESoc discord server, offering various features such as checking what week it is, explaining what all CSESoc/DevSoc Projects do, the 24 minigame and more to come! \nHere's a sneak peek at coming features: \n\nWeekly Lunch buddy - a speed friending feature for organising and meeting up on-campus each week with like-minded friendly people! \nSydney Trains Delay API - conveniently check if the light rail is down from the comfort of your study room before you get hit with a nasty surprise at Anzac Parade or High Street!",
58+
ephemeral: true,
59+
});
4960
break;
5061
case "freerooms":
51-
await interaction.reply(
52-
"Looking for a room to study in? Freerooms lets you see which on-campus rooms are vacant and which ones are booked.",
53-
);
62+
await interaction.reply({
63+
content:
64+
"Freerooms is a tool designed to help UNSW students find empty or unbooked rooms on campus.\n\n🥾Have you ever wandered around campus, searching for an empty study room?🚪 Have you ever wanted to study somewhere other than the weird smelling ASB🏢, the loud corridors of Ainsworth 🏦 or the poorly decorated main library? 📚 \nIf you are a director or exec, have you ever wanted to find a room for your in-person meetings or society event? \nWhether you're in need of a quiet study nook or a large space for your society's next big event, Freerooms has got you covered!\n\n<https://freerooms.staging.csesoc.unsw.edu.au/browse>",
65+
ephemeral: true,
66+
});
5467
break;
5568
case "jobsboard":
56-
await interaction.reply(
57-
"Jobsboard is an app that connects CSE students with companies looking for recruits.",
58-
);
69+
await interaction.reply({
70+
content:
71+
"Are you tired of hearing your friends talk about their exciting summer internship experiences while feeling left out? Fear not, because Jobsboard has got your back so you can wave goodbye to spending your summer working on projects to put on your resume! \nSupported by CSESoc’s strong partnerships with top tech giants in Australia like Atlassian, IMC, Canva and more, you will have immediate access to opportunities from these companies as soon they become available on Jobsboard!\n\n<https://jobsboard.csesoc.unsw.edu.au/>",
72+
ephemeral: true,
73+
});
5974
break;
6075
case "notangles":
61-
await interaction.reply(
62-
"Notangles is a timetable planning app for UNSW students to build their perfect timetable, even before class registration opens.",
63-
);
76+
await interaction.reply({
77+
content:
78+
"Class registrations out and you have no clue how your next term is going to pan out? No idea how to come up with a timetable that balances all your classes and social events that you cannot miss? Do not worry! Notangles got your back. \nNotangles is your interactive timetable application, that can help you and your friends plan out a weekly schedule by showing you available classes for your courses and allow you to also slot in recurring events that can not be missed. It can also generate a timetable for you by taking in your preferences. Let there be no more timetable-tangles with Notangles!\n\n<https://notangles.csesoc.app/>",
79+
ephemeral: true,
80+
});
6481
break;
6582
case "structs.sh":
66-
await interaction.reply("Structs.sh is an interactive algorithm visualiser.");
83+
await interaction.reply({
84+
content:
85+
"Structs.sh is an educational tool for computer science students that visualizes the most fundamental data structures (arrays, linked lists and binary search trees) and algorithms (sorting, searching and traversal). \nThe 2023 team is committed to transforming your educational experience by developing an application never seen before: a visual debugger that lets users type in arbitrary C code for our website to visualize the data structure(s) present in memory.\n\n<https://structs.sh/>",
86+
ephemeral: true,
87+
});
88+
break;
89+
case "training-program":
90+
await interaction.reply({
91+
content:
92+
"The Training Program is a 1 term crash-course built to train up students new to or interested in web-dev! Every term, we teach the basics of React and JS, then put trainees into groups led by our talented training leads to build a personal project of their own! These personal projects can be anything that you think of, ranging from productivity web apps 📆 to dating apps built just for computer science students 😳. The training program is a place for learning new skills and getting you started on building that new tech idea you've always been thinking about!\n\nCome join today!",
93+
ephemeral: true,
94+
});
6795
break;
6896
case "ui/ux":
69-
await interaction.reply(
70-
"The CSESoc Development UI/UX team works with all things related to user interface and experience design!",
71-
);
97+
await interaction.reply({
98+
content:
99+
"The CSESoc Development UI/UX team works with all things related to user interface and experience design!",
100+
ephemeral: true,
101+
});
102+
break;
103+
case "projects-fair-easter-egg-ctf":
104+
await interaction.reply({
105+
content: "Good job! Ollie's easter egg is levelup{discordbot_and_Ollie}",
106+
ephemeral: true,
107+
});
108+
break;
109+
case "cms":
110+
await interaction.reply({
111+
content:
112+
"Each year CSESoc creates and publishes a number of blogs, articles, and guides dedicated to exploring interesting topics and helping students with their studies. The CMS aims to make creating these documents easier and more efficient by unifying the system used across portfolios. \nThis year the team has focused on developing the fundamental building blocks blog writers may need such as having sections of code within documents. The CMS team continues to evolve the application with the objective of having concurrent editing capabilities.",
113+
ephemeral: true,
114+
});
72115
break;
73116
case "website":
74-
await interaction.reply(
75-
"The website team are in charge of writing the software for the CSESoc website.",
76-
);
117+
await interaction.reply({
118+
content:
119+
"Representing the CSE Society, the website showcases the main features of the community and collates all relevant resources in an easily located manner. Decorated with links to portfolios, guides, sponsors, and relevant social media platforms, the website allows all students to quickly navigate to the service they require.\n\n<https://www.csesoc.unsw.edu.au/>",
120+
ephemeral: true,
121+
});
77122
break;
78123
default:
79-
await interaction.reply(
80-
"Error: the switch case has fallen through to the default case.",
81-
);
124+
await interaction.reply({
125+
content: "Error: the switch case has fallen through to the default case.",
126+
ephemeral: true,
127+
});
82128
break;
83129
}
84130
},

0 commit comments

Comments
 (0)