Can't get the lightmap and textures to trigger during a command, and instead are active at all times

Hi! So i was thinking on making a datapack with a custom lunar event and lightmap that are triggered when the command is activated. ex: Normal day/night with no texture or lightmap changes at all. command gets triggered and turns the time to night, introducing the custom textures and lightmaps for the lunar event. And i couldn't figure out how to only set the lightmaps and textures to activate when the command gets triggered, can someone pls help me with the code? and textures if necessary? :( (in this case, the lightmap and textures are active at all times)
Continue to help post