I have this script for wikipedia with me. It works only when you send the message. If you want, i can edit it again to make it respond to other's messages too.
code:
//Wikipedia Search Script, originally created by Paril, modified by ddunk.
//Edited by Felu(http://www.feluowns.com) for personal use.
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
var query;
var CurrentWindow;
var url;
var title;
var response;
var result;
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
if(sMessage.substr(0,5) == "!wiki")
{
CurrentWindow = pChatWnd;
query = sMessage.substr(6,sMessage.length);
get_wikipedia_result(query);
return "";
}
}
function get_wikipedia_result(query)
{
xmlHttp.open("GET", "http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=" + query + "&fulltext=Search", true);
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.send();
}
function stateChanged()
{
Debug.Trace(xmlHttp.readyState)
if (xmlHttp.readyState==4)
{
Debug.Trace(xmlHttp.status)
if (xmlHttp.status==200)
{
Debug.Trace("test")
url = new RegExp("<li style=\"padding-bottom: 1em;\"><a href=\"(.*?)\"");
title = new RegExp("<li style=\"padding-bottom: 1em;\"><a href=\".*?\" title=\"(.*?)\">");
response = xmlHttp.responseText;
result = response.match(url);
title = response.match(title);
if (result)
{
CurrentWindow.SendMessage("Wikipedia search: " + query + "\n Result: " + title[1] + " - http://en.wikipedia.org" + result[1]);
}
else
CurrentWindow.SendMessage("Wikipedia search for " + query + " returned no results");
}
}
}