You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SaihuBot.prototype.responses.push({
name: 'wikipedia',
help: 'wikipedia|w|wiki [term] - search wikipedia with [term]',
rule: /(^wikipedia |^w |^wiki )(.*)/i,
action: function(robot, msg) {
let url = 'http://en.wikipedia.org/w/index.php?title=Special:Search&search=' + encodeURIComponent(msg[2]);
let link = renderResponse('Search', msg[2], url, 'Wikipedia');
robot.adapter.sendHTML(link);
openTab(url);
},
});
The rule and actions are all saved in responses[], we can treat this as the shorthand definition, and save rules, name, actions into different place. Ex:
use sort of redux pattern (dispatch->reducer) and host state to reflect any change.
The text was updated successfully, but these errors were encountered: