Skip to content

Commit

Permalink
fix crash?
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus-Rost committed Dec 31, 2023
1 parent 639a320 commit 3a71471
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion RcGcDw_buttons
12 changes: 8 additions & 4 deletions dashboard/functions/rcscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,10 @@ function update_rcscript(res, userSettings, guild, type, settings) {
channel: settings.channel
} ).then( response => {
if ( !response ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
if ( userSettings.guilds.isMember.has(guild) ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
}
return res(`/guild/${guild}`, 'savefail');
}
if ( response === 'noMember' || !hasPerm(response.userPermissions, PermissionFlagsBits.ManageGuild) ) {
Expand Down Expand Up @@ -565,8 +567,10 @@ function update_rcscript(res, userSettings, guild, type, settings) {
newchannel: ( newChannel ? settings.channel : undefined )
} ).then( response => {
if ( !response ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
if ( userSettings.guilds.isMember.has(guild) ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
}
return res(`/guild/${guild}`, 'savefail');
}
if ( response === 'noMember' || !hasPerm(response.userPermissions, PermissionFlagsBits.ManageGuild) ) {
Expand Down
6 changes: 4 additions & 2 deletions dashboard/functions/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,10 @@ function update_settings(res, userSettings, guild, type, settings) {
allowCategory: true
} ).then( response => {
if ( !response ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
if ( userSettings.guilds.isMember.has(guild) ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
}
return res(`/guild/${guild}`, 'savefail');
}
if ( response === 'noMember' || !hasPerm(response.userPermissions, PermissionFlagsBits.ManageGuild) ) {
Expand Down
18 changes: 12 additions & 6 deletions dashboard/functions/verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,10 @@ function update_verification(res, userSettings, guild, type, settings) {
guild: guild
} ).then( response => {
if ( !response ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
if ( userSettings.guilds.isMember.has(guild) ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
}
return res(`/guild/${guild}`, 'savefail');
}
if ( response === 'noMember' || !hasPerm(response.userPermissions, PermissionFlagsBits.ManageGuild) ) {
Expand Down Expand Up @@ -1013,8 +1015,10 @@ function update_notices(res, userSettings, guild, type, settings) {
newchannel: settings.channel
} ).then( response => {
if ( !response ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
if ( userSettings.guilds.isMember.has(guild) ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
}
return res(`/guild/${guild}`, 'savefail');
}
if ( response === 'noMember' || !hasPerm(response.userPermissions, PermissionFlagsBits.ManageGuild) ) {
Expand Down Expand Up @@ -1211,8 +1215,10 @@ function send_button(res, userSettings, guild, type, settings) {
allowForum: true
} ).then( response => {
if ( !response ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
if ( userSettings.guilds.isMember.has(guild) ) {
userSettings.guilds.notMember.set(guild, userSettings.guilds.isMember.get(guild));
userSettings.guilds.isMember.delete(guild);
}
return res(`/guild/${guild}`, 'sendfail');
}
if ( response === 'noMember' || !hasPerm(response.userPermissions, PermissionFlagsBits.ManageGuild) ) {
Expand Down
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ if ( process.env.dashboard ) {
} );
}
} )
)
);
},
getMember: (discordClient, evalData) => {
if ( discordClient.guilds.cache.has(evalData.guild) ) {
Expand Down

0 comments on commit 3a71471

Please sign in to comment.