Is there a way to make an item change a gamerule when used?

I want to make artifacts that when used change gamerules like weather, time inventory and so on. But idk if it is possible, I don't mind the item that needs to be used as long as it works.. Any ideas?
Continue to help post