If you clicked on this topic you probably expect a different kind of answer but auto dueling in PvP isn't possible the same way as in PvE duels since Konami's auto duel engine is only available for offline duels.
Instead of trying to use/make a crappy auto duel AI for PvP, you should reconsider and run the casual duels/ranked duels farming bot with either "Duel Skipper" (currently recommended since it causes quick losses) or the "Disconnect PvP Duels" option enabled (currently not recommended since it's much slower but it's also safer in regards to bans).
Note
Losing (casual) PvP duels is totally fine since you still get rewards. You do not have to win. Using the bot as explained above is perfectly fine for farming. This may sound unreasonable to some people but after following my advice and seeing the results of it, you will start to understand also.
Instead of trying to use/make a crappy auto duel AI for PvP, you should reconsider and run the casual duels/ranked duels farming bot with either "Duel Skipper" (currently recommended since it causes quick losses) or the "Disconnect PvP Duels" option enabled (currently not recommended since it's much slower but it's also safer in regards to bans).
Note
Losing (casual) PvP duels is totally fine since you still get rewards. You do not have to win. Using the bot as explained above is perfectly fine for farming. This may sound unreasonable to some people but after following my advice and seeing the results of it, you will start to understand also.