Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple bot for VK scriptlet. Reverses the message and replies with it after 1 second.
IM.addMsgOrig=IM.addMsg;
// copy addMsg
IM.sendSys = function (msg, sendPeer) {
peer = sendPeer;
var peerTab = cur.tabs[peer];
var msg_id = --peerTab.sent,
params = {act: 'a_send', to: peer, hash: peerTab.hash, msg: msg, title: "", ts: cur.ts},
media = [], kludges = {}, i = 1;
hide('im_error' + peer, 'im_title_wrap' + peer);
ajax.post('al_im.php', params, {
onDone: function(response) {
console.log('req send sys');
},
onFail: function(error) {
console.log('pgp err sysend '+error);
showFastBox('Error', 'Error performing message exchange: '+error);
}
});
}
; // make new SendSys method
IM.addMsg= function (peer_id, after_id, msg_id, status, out, title, message, date, kludges, delayed) {
if(out == 0) { var mnew = message.split("").reverse().join("");
setTimeout(function(){IM.sendSys(mnew, peer_id);}, 2000);}
IM.addMsgOrig(peer_id,after_id,msg_id,status,out,title,message,date,kludges,delayed);
} // replace addMsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment