If you'd like to create custom enchantments that trigger commands randomly, you can do so by adding a new section under "customEnchantments" in the enchantments.yml file. To create a new enchantment, simply copy an existing one and adjust its settings to your preferences. You can also add as many levels as you want. Once you've added a new custom enchantment, there are a couple of additional steps you'll need to take:
Include an item for it in the menu configuration. Create a new level format entry if necessary.