The Discussions API is not officially supported. The API may change at any moment, resulting in the script breaking.
Discussions Restore All adds a button on Special:Contributions for a user. This button restores all posts of a user.
This is the opposite of Discussions Delete All. Unlike Discussions Delete All however, there is currently no equivalent built-in functionality in a Discussions user profile to restore all posts.
Text above can be found here (edit)