Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
そびえとしき とうちほう
/* ソビエト式倒置法 */
controller.hears(['(.*)を(.*)(う|く|ぐ|す|ず|つ|づ|ぬ|ふ|ぶ|む|る|ゆ)'], 'direct_message,direct_mention,mention,ambient', function(bot, message) {
if(message.channel === "C2Z3UJWAW"){
var splittext = message.text.match(/(\S+)を(\S+)/);
var outstr;
if(splittext[1].indexOf("") != -1){
var subtext = splittext[1].split("");
outstr = "ソビエトロシアでは、" + subtext[1] + "" + subtext[0] + "" + splittext[2] + "!";
}else if(splittext[1].indexOf("") != -1){
var subtext = splittext[1].split("");
outstr = "ソビエトロシアでは、" + subtext[1] + "" + subtext[0] + "" + splittext[2] + "!";
}else{
var subject = splittext[1].match(/(\S+)(が|は)(\S+)/);
var outstr = "ソビエトロシアでは、" + splittext[1] + "があなたを" + splittext[2] + "";
}
bot.say({
channel:"C2Z3UJWAW",
text:outstr,
username:"BOT",
icon_url:"https://i.gyazo.com/153c3c3e29e7e78d9864ccc4e28ca537.png"
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment