Skip to content

Push fix to embeds for handbook #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 79 commits into from
Nov 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
054128a
migrate from insou api to circles for the handbook commands (#128)
imagine-hussain Feb 22, 2023
ea97f33
prettier formatted
AcdSoftCo Feb 22, 2023
81e5085
chore(deps): update `renovate` config
lhjt Mar 22, 2023
883a0d8
chore(deps): update docker/build-push-action action to v4 (#134)
renovate[bot] Mar 23, 2023
d0656ca
Projects description command feature (#145)
zcDay1 May 16, 2023
9a4c9ec
disable annoying carrotboard pins
abiramen Aug 18, 2023
2f59c71
rolesPermOverride command is a script or one-time use command to atta…
AcdSoftCo Sep 16, 2023
617c373
Revert "rolesPermOverride command is a script or one-time use command…
AcdSoftCo Sep 16, 2023
da9b795
rolesPermOverride command (#152)
zcDay1 Sep 20, 2023
d55e093
Roles perm override (#153)
zcDay1 Sep 24, 2023
b2562be
Project descriptions (#154)
zcDay1 Sep 25, 2023
9f7c78d
Merge branch 'projects-bot' into develop
zcDay1 Sep 26, 2023
65f32ef
Dev/course channel fix 3 (#158)
Bigbugman Oct 21, 2023
7912884
Merge branch 'projects-bot' into develop
zcDay1 Oct 21, 2023
027f8fe
dev/course-channel-fix-5 (#160)
abe123442 Oct 22, 2023
a2cafe4
Merge branch 'projects-bot' into develop
zcDay1 Oct 22, 2023
4bac7ae
Update rolesPermOverride.js
zcDay1 Oct 24, 2023
b9576b5
Course Command Fixing - Collection Null Value Error (#162)
Domin0de Oct 31, 2023
0f34280
Dev/upgrade handbook url (#164)
abe123442 Nov 3, 2023
35f1f3b
Fixed bug for courses that do not yet have an offering term (Default:…
abe123442 Nov 3, 2023
34e2f53
Implementation of the Lunch Buddy feature (#167)
Domin0de Jan 21, 2024
6da7e8e
[DISC-107] Adding csesocLinks to get CSESoc related links (#170)
chlowoee Apr 21, 2024
dc2088f
[DISC-109] Adding bot-status for events and member count (#169)
ericwu2205 May 5, 2024
e4e3aa1
Update dependency nodemailer to v6.9.9 [SECURITY] (#168)
renovate[bot] May 15, 2024
28dad18
Update dependency axios to v0.28.0 [SECURITY] (#166)
renovate[bot] May 15, 2024
e02999a
fix(deps): update dependency yaml to v2.2.2 [security] (#147)
renovate[bot] May 15, 2024
1d16f9d
Update dependency dotenv to v16 (#141)
renovate[bot] May 15, 2024
ed9e422
chore(deps): update actions/checkout action to v4 (#157)
renovate[bot] May 15, 2024
ea0b2f8
fix(deps): update dependency discordjs-button-pagination to v3 (#140)
renovate[bot] May 15, 2024
e9cc79b
Remove unused discord-tictactoe dependency and updated canvas (#173)
Domin0de May 15, 2024
90a3e00
fix(deps): update weekly patch updates (#142)
renovate[bot] May 15, 2024
a1c4112
fix(deps): update dependency @discordjs/builders to v1 (#135)
renovate[bot] May 15, 2024
720e1c6
fix(deps): update dependency discord.js to v14 (#139)
renovate[bot] May 15, 2024
b2c1a88
Update to fix v14 breaking changes (#176)
Domin0de May 15, 2024
05f2dd7
chore(deps): update actions/setup-node action to v4 (#172)
renovate[bot] May 15, 2024
1b1ba66
Nitpick refactor for courses command (#126)
XenocidePC May 25, 2024
14d467c
fix(deps): update dependency mathjs to v12 (#182)
renovate[bot] May 27, 2024
dead83e
fix(deps): update dependency axios to v1 (#181)
renovate[bot] May 27, 2024
31a2eb0
fix(deps): update dependency @discordjs/rest to v2 (#179)
renovate[bot] May 27, 2024
0269b1c
chore(deps): update dependency eslint-config-prettier to v9 (#175)
renovate[bot] May 27, 2024
eeb06f1
fix(deps): update dependency nodemon to v3 (#183)
renovate[bot] May 27, 2024
3848496
chore(deps): update node.js to v20 (#171)
renovate[bot] May 27, 2024
8e1acf4
fix(deps): update dependency mathjs to v13 (#184)
renovate[bot] Jun 5, 2024
0762214
DISC-119-unielectives-review (#188)
h34312575s Jun 16, 2024
a586bb2
[DISC-120] Update eslint dependency and nodejs to v20
renovate[bot] Jun 27, 2024
7bebb5f
[DISC-120] Update to prettier and corresponding eslint plugin
renovate[bot] Jun 27, 2024
ab156e2
chore(deps): lock file maintenance (#186)
renovate[bot] Jun 27, 2024
0478938
chore(deps): update weekly minor updates (#143)
renovate[bot] Jun 27, 2024
84d63f4
[DISC-120] Fix to renovate.json file (#190)
Domin0de Jun 27, 2024
d2ff9ac
[DISC-120] Declare file type for requiring data (#192)
Domin0de Jun 28, 2024
719f36d
[DISC-120] Adjust data type for file (#193)
Domin0de Jun 28, 2024
c7f335f
[DISC-120] Move to using fs for configuration (#194)
Domin0de Jun 28, 2024
56701c8
Move file to config
Domin0de Jun 28, 2024
5fa634f
Fix spelling error
Domin0de Jun 28, 2024
f4b82ae
Append setup command for puppeteer browser
Domin0de Jun 28, 2024
132b068
Downloading dependencies and requirements for puppeteer
Domin0de Jun 29, 2024
da4e542
Modification to installation order
Domin0de Jun 29, 2024
36d43cd
Affirm installation
Domin0de Jun 29, 2024
6e593c8
Revert prior changes and set to use alternate folder for chromium ins…
Domin0de Jul 8, 2024
804c65f
Manually ignore puppeteer config file in eslint
Domin0de Jul 8, 2024
54dc641
Attempt fix to eslint hanging
Domin0de Jul 8, 2024
e65eb61
[DISC-117] Adding travelguides command (#187)
chlowoee Jul 9, 2024
7028f56
Modify location and method for chromium install
Domin0de Jul 9, 2024
ada9f90
Alter setup to use chromium base
Domin0de Jul 9, 2024
d8f9e47
Update to puppeteer version
Domin0de Jul 9, 2024
c651c4c
Replace secondary node image with puppeteer
Domin0de Jul 14, 2024
0c17f44
Fix capitalisation inconsistency and assume permission set
Domin0de Jul 14, 2024
dff8d4b
Reappend entrypoint permission modification
Domin0de Jul 14, 2024
a34fca4
Reset user from image setup
Domin0de Jul 14, 2024
5298768
Attempt return to puppeteer user after setup
Domin0de Jul 17, 2024
eecb1b5
[DISC-110] Adding Course Chats 1-year "Subscription" (#191)
ericwu2205 Jul 17, 2024
8ed55ab
[DISC-121] Implement Logging for User Rejoining (#199)
Domin0de Aug 8, 2024
1f6ff77
Merge branch 'projects-bot' into develop
Domin0de Aug 8, 2024
2f55736
Fix to incorrect conflict resolution commit
Domin0de Aug 8, 2024
fa02763
Minor fixes to Admin Command (#203)
Domin0de Aug 8, 2024
ccb0ff7
Append additional table creation after removing old table
Domin0de Aug 8, 2024
74aa923
Merge branch 'projects-bot' into develop
Domin0de Aug 8, 2024
9ec8cd1
Update dependency axios to v1.7.4 [SECURITY] (#205)
renovate[bot] Oct 30, 2024
1af826e
Fix embed option usage of strings with objects (#207)
Domin0de Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dev/course-channel-fix-5 (#160)
* course-chat-fix-2, make new roles where there arent any in /rolespermoverride and also remove individual permission overwrites, and also updates to /course join to catch when there doesn't exist a role for a course and also /course leave to attempt to remove individual permission overwrites along with removing course role PLEASE TEST THOROUGHLY AND INSPECT CODE THOROUGHLY. I wrote this ASAP and haven't got time to properly review it.

* Modified functions for course channel fixes

* Check for if user only has read perms for overwrite replacing and fix looping over members

* Fix to functionality of iteration and editing roles

* Fix to initial working state

* Fix linting

* Additional fixes to ordering and component operations to remove role and individual permissions correctly

* Appended filter for both view only perms and view + send messages perms

* Appended single channel mode for permissions override

* Appended check command for role permissions

* Resolved merge conflicts in dev/course-channel-fix-4

---------

Co-authored-by: AcdSoftCo <106219586+AcdSoftCo@users.noreply.github.com>
Co-authored-by: Wolfdragon24 <dragonbomber24@gmail.com>
  • Loading branch information
3 people authored Oct 22, 2023
commit 027f8fe8869f3c6c5fcb6c4a1bb1a3b10f65dd93
101 changes: 95 additions & 6 deletions commands/rolesPermOverride.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,68 @@ async function editChannels(interaction, channels) {
}
}

async function isFixed(interaction, channel) {
const is_valid = is_valid_course_name(channel.name);

if (!is_valid || channel.type !== "GUILD_TEXT") return true;

const role = interaction.guild.roles.cache.find(
(r) => r.name.toLowerCase() === channel.name.toLowerCase(),
);

if (!role) return false;

const permissions = channel.permissionOverwrites.cache;

// clear every individual user permission overwrite for the channel
for (const user of channel.members) {
const userId = user[0];
const userObj = user[1];

if (userObj.user.bot) continue;

// Check if the member has access via individual perms
if (in_overwrites(permissions, userId)) return false;
}

if (!in_overwrites(permissions, role.id)) return false;

return true;
}

async function allFixed(interaction, channels) {
const unfixed = [];
for (const data of channels) {
const channel = data[1];
const fixed = await isFixed(interaction, channel);

if (!fixed) unfixed.push(channel.name);
}

return unfixed;
}

module.exports = {
data: new SlashCommandBuilder()
.setName("rolespermoverride")
.setDescription(
"Looks for matches between roles and course chats and attaches permissions.",
)
.addBooleanOption((option) =>
option
.setName("singlechannel")
.setDescription(
"Should this command only be run on the current channel? (Default: False)",
)
.setRequired(false),
)
.addBooleanOption((option) =>
option
.setName("check")
.setDescription(
"Should a check be run on if the channel is fixed? (Default: False)",
)
.setRequired(false),
),
async execute(interaction) {
try {
Expand All @@ -79,16 +136,48 @@ module.exports = {
ephemeral: true,
});
}

await interaction.deferReply();

// for all roles with name == chat name involving 4 letter prefix comp, seng, engg or binf,

// Get all channels and run function
const channels = await interaction.guild.channels.fetch();

await editChannels(interaction, channels);
await interaction.editReply("Successfully ported all user permissions to roles.");
if (!interaction.options.getBoolean("singlechannel")) {
// Get all channels and run specified function
const channels = await interaction.guild.channels.fetch();

if (!interaction.options.getBoolean("check")) {
await editChannels(interaction, channels);
await interaction.editReply(
"Successfully ported all user permissions to roles.",
);
} else {
const unfixed = await allFixed(interaction, channels);

if (unfixed.length == 0) {
await interaction.editReply("All channels in this server appear fixed.");
} else {
await interaction.editReply(
`The following channels appear unfixed: ${unfixed.join(", ")}`,
);
}
}
} else {
const channel = interaction.channel;

if (!interaction.options.getBoolean("check")) {
await editChannels(interaction, [[undefined, channel]]);
await interaction.editReply(
"Successfully ported user permissions to roles in this channel",
);
} else {
const fixed = await isFixed(interaction, channel);

if (fixed) {
await interaction.editReply("This channel appears fixed.");
} else {
await interaction.editReply("This channel appears unfixed.");
}
}
}
} catch (error) {
await interaction.editReply("Error: " + error);
}
Expand Down