async def InsightOptionRequired_trackpods(self, message_object: discord.Message): """Display POD(capsule) kills/losses - Set the feed to either ignore or display POD mails.""" def set_mode(track_pods): db: Session = self.cfeed.service.get_session() try: if not track_pods: for i in self.pod_group_ids: __row: tb_Filter_groups = tb_Filter_groups.get_row( self.cfeed.channel_id, i, self.cfeed.service) db.merge(__row) db.commit() else: for i in self.pod_group_ids: tb_Filter_groups.get_remove(self.cfeed.channel_id, i, self.cfeed.service) db.commit() except Exception as ex: print(ex) raise InsightExc.Db.DatabaseError finally: db.close() __options = dOpt.mapper_return_yes_no(self.cfeed.discord_client, message_object) __options.set_main_header( "Do you want to track pod (capsule) kills/losses in this feed?") resp = await __options() await self.cfeed.discord_client.loop.run_in_executor( None, partial(set_mode, resp)) await self.reload(message_object)
async def InsightOption_unlockfeed(self, message_object: discord.Message): """Unlock feed - Unlock a previously locked feed service to allow any Discord channel user to modify settings.""" self.cfeed.check_permission(message_object.author, required_level=1, ignore_channel_setting=True) if not self.cfeed.cached_feed_table.modification_lock: raise InsightExc.DiscordError.NonFatalExit( "This channel feed is already unlocked. You can lock this" " feed from unauthorized modifications with " "the '!lock' command.") options = dOpt.mapper_return_yes_no(self.cfeed.discord_client, message_object) options.set_main_header( "Unlock this channel feed? Unlocking a channel feed allows anyone in the channel to " "modify feed behavior and settings.") resp = await options() if resp: row = await self.get_cached_copy() row.modification_lock = False await self.save_row(row) await self.reload(message_object)
async def InsightOption_lockfeed(self, message_object: discord.Message): """Lock feed - Lock a feed service from being modified by users without certain Discord channel roles.""" self.cfeed.check_permission(message_object.author, required_level=1, ignore_channel_setting=True) if self.cfeed.cached_feed_table.modification_lock: raise InsightExc.DiscordError.NonFatalExit( 'This channel feed is already locked from unauthorized modifications.' ) options = dOpt.mapper_return_yes_no(self.cfeed.discord_client, message_object) options.set_main_header( "Lock this feed from unauthorized access? Locking a feed prevents users lacking Discord channel " "permissions from accessing or modifying feed settings. A locked feed can only be unlocked, modified, " "or removed by a Discord channel user with at least one of the following " "permissions:\n\nAdministrator\nManage Roles\nManage Messages\nManage Guild\n" "Manage Channel\nManage webhooks\n\n") resp = await options() if resp: row = await self.get_cached_copy() row.modification_lock = True await self.save_row(row) await self.reload(message_object)