Without knowing which server your on, all I can do is give you a general code. Some chanserv's have different functions activated, so while this will work on the server I'm on, I can't guarantee it'll work on yours.
Code:
on *:text:!opbot:#:{ .cs op $chan $me }