wow, thats a toughy... I wouldn't suggest trying to fix it unless you really know what you're doing... bending it back will likely weaken it more, and if it works now, that may be a bad thing...
If there is a reputable metal shop/ car frame repair shop nearby they might have some answers, or even be able to fix it right for cheap...
Be sure, before riding it, that the motor isn't angled in relation to the frame and drivetrain... eyeshot it from the rear sproket and make sure it doesn't 'wander' to one side or the other... there should be no noticeable 'yaw' to the chain.... if it is out of whack, it will cause wear problems on the drivetrain and added stress to an already stressed frame...
good luck