<?php
$Bot->RegisterCommand('news', 'bot_news', 'o', 'Setzt die News eines Channels');

$Bot->RegisterCronjob('bot_newsout', 60);

function bot_news($Bot, $Params, $Sender, $Channel) {
	$Bot->Vars['news'][$Channel] = true;
	$Bot->Vars['news'][$Channel]['title'] = $Params[0];
	$Bot->Vars['news'][$Channel]['content'] = $Params[1];
	$Bot->Vars['news'][$Channel]['date'] = date('d.m.Y H:i');
	$Bot->Vars['news'][$Channel]['sender'] = $Sender->GetNick();
	$Bot->Say($Channel, "" . $Bot->Style('bold') . $Bot->Style('underlined') . "$Bot->Vars['news'][$Channel]['title']" . $Bot->Style('normal') . " - $Bot->Vars['news'][$Channel]['content'] - " . $Bot->Style('bold') . "$Bot->Vars['news'][$Channel]['date'] von $Bot->Vars['news'][$Channel]['sender']" . $Bot->Style('normal') . "");
}

function bot_newsout($Bot) {
	foreach ($Config['Other']['Channels'] as $Channel) {
        if($Bot->Vars['news'][$Channel] === true) {
			$Bot->Say($Channel, "" . $Bot->Style('bold') . $Bot->Style('underlined') . "$Bot->Vars['news'][$Channel]['title']" . $Bot->Style('normal') . " - $Bot->Vars['news'][$Channel]['content'] - " . $Bot->Style('bold') . "$Bot->Vars['news'][$Channel]['date'] von $Bot->Vars['news'][$Channel]['sender']" . $Bot->Style('normal') . "");
		}
	}
}
?>