[READ-ONLY] Mirror of https://github.com/maybeanerd/MagiBot. MagiBot - the community building discord bot that adds joinsounds to your voice channels! discord.gg/2Evcf4T
bot bots community discord gaming hacktoberfest sound
1

Configure Feed

Select the types of activity you want to include in your feed.

hotfix: deactivate deletion of guild settings (#344)

authored by

Sebastian Di Luzio and committed by
GitHub
(May 25, 2022, 9:46 PM +0200) 7e4a65d7 b8778e24

+18 -9
+18 -9
src/cronjobs.ts
··· 17 17 throw new Error('Missing DB connection URL'); 18 18 } 19 19 20 + const allowDeletions = false; 21 + 20 22 // automatic deletion of reports: 21 23 async function hourlyCleanup(bot: Client, isFirst: boolean) { 22 24 const now = new Date(); ··· 117 119 // eslint-disable-next-line no-underscore-dangle 118 120 const guildID = guild._id; 119 121 try { 120 - await sendJoinEvent( 121 - `:wastebasket: Deleting all information from guild with ID ${guildID} because they removed me more than seven days ago.`, 122 - bot.shard?.ids[0], 123 - ); 124 - // ignore salt and saltrank, as they are removed after 7 days anyways 125 - await StillMutedModel.deleteMany({ guildid: guildID }); 126 - await UserModel.deleteMany({ guildID }); 127 - await VoteModel.deleteMany({ guildid: guildID }); 128 - await SettingsModel.deleteOne({ _id: guildID }); 122 + if (allowDeletions) { 123 + await sendJoinEvent( 124 + `:wastebasket: Deleting all information from guild with ID ${guildID} because they removed me more than seven days ago.`, 125 + bot.shard?.ids[0], 126 + ); 127 + // ignore salt and saltrank, as they are removed after 7 days anyways 128 + await StillMutedModel.deleteMany({ guildid: guildID }); 129 + await UserModel.deleteMany({ guildID }); 130 + await VoteModel.deleteMany({ guildid: guildID }); 131 + await SettingsModel.deleteOne({ _id: guildID }); 132 + } else { 133 + await sendJoinEvent( 134 + `:wastebasket: Attempting to delete all information from guild with ID ${guildID} because they removed me more than seven days ago. Deletion is deactivated for now, though.`, 135 + bot.shard?.ids[0], 136 + ); 137 + } 129 138 } catch (error) { 130 139 sendException( 131 140 `Failed deleting all information releated to guild with ID ${guildID} : ${error}`,