Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kypkyp
Created December 24, 2016 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kypkyp/dbf88520ad1cc9eef2150443e2ecabcb to your computer and use it in GitHub Desktop.
Save kypkyp/dbf88520ad1cc9eef2150443e2ecabcb to your computer and use it in GitHub Desktop.
そびえとしき とうちほう
/* ソビエト式倒置法 */
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