How do I make a Lightning Bow in vanilla Minecraft?

I'm trying to make a setup with command blocks that summons lightning at the location of a shot arrow. The setup should recognize the arrow that is shot or the bow that is used by its name or another property, so that lightning only strikes at that specific arrow.

Also, the lightning should only strike once when the arrow hits the ground. I know this is somehow possible with scoreboard, but I'm no good with that. Does anyone know how to make a Lightning Bow in vanilla Minecraft?


Since Arrows don't contain the data of what bow shot it from, we must mark the arrow as its being shot.

Setup:

/scoreboard objectives add Shot stat.useItem.minecraft.bow
/scoreboard objectives add Holding dummy
/scoreboard objectives add LightingArrow dummy
/scoreboard objectives add InGround dummy

Clock(20tps)

/scoreboard players set @a Holding 0
/scoreboard players set @a Holding 1 {SelectedItem:{tag:{display:{Name:"Lightning Bow"}}}}
/execute @a[score_Shot_min=1,score_Holding_min=1] ~ ~ ~ scoreboard players set @e[type=Arrow,r=2] LightingArrow 1
/scoreboard players set @e[type=Arrow] InGround 1 {inGround:1b}
/execute @e[type=Arrow,score_LightingArrow_min=1,score_InGround_min=1] ~ ~ ~ summon LightningBolt ~ ~ ~
/kill @e[type=Arrow,score_LightingArrow_min=1,score_InGround_min=1]
/scoreboard players set @a Shot 0