<?php

class Help extends Script {

	
	private $user = "";
	public function onPrivateMessage($from, $to, $message) {
		if($message == "!help") {
			$this->message("#operhelp", "".$from." is in need of assistance. Use !assist to assist.");
			$this->notice($sNickname, "Please get your question ready, we will help you as soon as possible.");
			$this->user = $from;
		}
	}
	public function onChannelMessage($sChannel, $sNickname, $sMessage) {
		if($sChannel == "#operhelp" && $sMessage == "!assist") {
			if($sChannel->isUserop($sNickname)) {
			$this->raw("MODE ".$sChannel."  +v ".$this->user."");
			$this->message($sChannel, "".$this->user.": Please ask your question.");
			}
		}		
	}
	public function onChannelJoin($sChannel, $sNickname) {
		if($sChannel == "#operhelp") {
			
			$this->notice($sNickname, "Welcome to #operhelp. This channel is for issues that can only be resolved by an IRC Operator. For general network related questions, please join #help and part this channel. Type /msg Helper !help to get assistance.");
		}
	}
	
	public function onChannelPart($sChannel, $sNickname) {
		if($sNickname == $user) {
		$this->notice($sNickname, "".$this->user. ", your help session is suspended.");
		$user = "";
		}
	}

}