├── evil.jpg ├── .travis.yml ├── LICENSE ├── README.md ├── CONTRIBUTING.md └── index.php /evil.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvilInsultGenerator/facebook-bot/HEAD/evil.jpg -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.3 5 | - 5.4 6 | - 5.5 7 | - 5.6 8 | - hhvm 9 | - nightly 10 | 11 | script: 12 | - vendor/bin/phpunit --coverage-clover=coverage.xml 13 | 14 | after_success: 15 | - bash <(curl -s https://codecov.io/bash) 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Evil Insult Generator Facebook Bot 2 | 3 | Evil Insult Generator's goal is to offer the most evil insults. Please help us to reach this honorable purpose by submitting insults via mail. 4 | 5 | ![Evil Insult Generator Icon](https://cloud.githubusercontent.com/assets/22981912/19600664/5521d010-97a6-11e6-9f67-fec931b199d7.png) 6 | 7 | ### Installation 8 | 9 | See [official page](https://developers.facebook.com/docs/messenger-platform) 10 | 11 | Try it out: 12 | 13 | ![EvilInsultGeneratorMessengerCode](https://cloud.githubusercontent.com/assets/23016876/19629058/11b1640e-996c-11e6-81e6-893fd48c576d.png) 14 | 15 | ### Contact 16 | 17 | We love to get in touch with you. Feel welcome to email your questions and feedback to [marvin@evilinsult.com](mailto:marvin@evilinsult.com). 18 | 19 | ### License 20 | > This is free and unencumbered software released into the public domain. 21 | > 22 | > Anyone is free to copy, modify, publish, use, compile, sell, or 23 | > distribute this software, either in source code form or as a compiled 24 | > binary, for any purpose, commercial or non-commercial, and by any 25 | > means. 26 | > 27 | > In jurisdictions that recognize copyright laws, the author or authors 28 | > of this software dedicate any and all copyright interest in the 29 | > software to the public domain. We make this dedication for the benefit 30 | > of the public at large and to the detriment of our heirs and 31 | > successors. We intend this dedication to be an overt act of 32 | > relinquishment in perpetuity of all present and future rights to this 33 | > software under copyright law. 34 | > 35 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 36 | > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 37 | > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 38 | > IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 39 | > OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 40 | > ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 41 | > OTHER DEALINGS IN THE SOFTWARE. 42 | > 43 | > For more information, please refer to 44 | 45 | ### Screenshots 46 | 47 | _TBD_ 48 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing To Evil Insult Generator 2 | 3 | 👍🎉 First off, thanks for taking the time to contribute! 🎉👍 4 | 5 | The following is a set of guidelines for contributing to [Evil Insult Generator](https://evilinsult.com/), which are hosted on [GitHub](https://github.com/EvilInsultGenerator/). 6 | These are just guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. 7 | 8 | ## What should I know before I get started? 9 | 10 | ### Code of Conduct 11 | 12 | This project adheres to the [Contributor Covenant code of conduct](https://contributor-covenant.org/version/1/4/). 13 | By participating, you are expected to uphold this code. Please report unacceptable behavior to [marvin@evilinsult.com](mailto:marvin@evilinsult.com). 14 | 15 | ### Contact 16 | 17 | If you have any questions or are unsure about something just drop a line to [marvin@evilinsult.com](mailto:marvin@evilinsult.com). 18 | 19 | ### Design Decisions 20 | 21 | If you plan to make a significant decision in how to maintain the project and what it can or cannot support please send an email beforehand. 22 | 23 | ## How Can I Contribute? 24 | 25 | ### Reporting Bugs 26 | 27 | This section guides you through submitting a bug report for [Evil Insult Generator](https://evilinsult.com/) software. Following these guidelines helps maintainers and the community understand your report 📝, reproduce the behavior 📱💻🎮, and find related reports 🔎. 28 | 29 | Before creating bug reports, please check this list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible. 30 | 31 | ### Suggesting Enhancements 32 | 33 | This section guides you through submitting an enhancement suggestion for [Evil Insult Generator](https://evilinsult.com/), including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion 📝 and find related suggestions 🔎. 34 | 35 | Before creating enhancement suggestions, please check this list as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please include as many details as possible. 36 | 37 | ### Pull Requests 38 | 39 | + Include screenshots and animated GIFs in your pull request whenever possible. 40 | + Create a [branch](https://guides.github.com/introduction/flow/) for your edit 41 | 42 | ### Git Commit Messages 43 | 44 | + Use the present tense ("Add feature" not "Added feature") 45 | + Use the imperative mood ("Move cursor to..." not "Moves cursor to...") 46 | + Limit the first line to 72 characters or less 47 | + Reference issues and pull requests liberally 48 | + When only changing documentation, include [ci skip] in the commit description 49 | + Consider starting the commit message with an applicable emoji: 50 | 51 | 🎨 :art: when improving the format/structure of the code 52 | 🐎 :racehorse: when improving performance 53 | 🚱 :non-potable_water: when plugging memory leaks 54 | 📝 :memo: when writing docs 55 | 🐧 :penguin: when fixing something on Linux 56 | 🍎 :apple: when fixing something on macOS 57 | 🏁 :checkered_flag: when fixing something on Windows 58 | 🐛 :bug: when fixing a bug 59 | 🔥 :fire: when removing code or files 60 | 💚 :green_heart: when fixing the CI build 61 | ✅ :white_check_mark: when adding tests 62 | 🔒 :lock: when dealing with security 63 | ⬆️ :arrow_up: when upgrading dependencies 64 | ⬇️ :arrow_down: when downgrading dependencies 65 | 👕 :shirt: when removing linter warnings 66 | 67 | 68 | __Thank you so much! 😘__ 69 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 10 | window.fbAsyncInit = function() { 11 | FB.init({ 12 | appId : '240506093016544', 13 | xfbml : true, 14 | version : 'v2.7' 15 | }); 16 | }; 17 | 18 | (function(d, s, id){ 19 | var js, fjs = d.getElementsByTagName(s)[0]; 20 | if (d.getElementById(id)) {return;} 21 | js = d.createElement(s); js.id = id; 22 | js.src = "//connect.facebook.net/en_US/sdk.js"; 23 | fjs.parentNode.insertBefore(js, fjs); 24 | }(document, 'script', 'facebook-jssdk')); 25 | 26 | 27 | file_put_contents("fb.txt",file_get_contents("php://input")); 28 | 29 | $fb = file_get_contents("fb.txt"); 30 | $fb = json_decode($fb); 31 | 32 | $id = $fb->entry[0]->messaging[0]->sender->id; 33 | $reid = $fb->entry[0]->messaging[0]->recipient->id; 34 | $message = $fb->entry[0]->messaging[0]->message->text; 35 | 36 | $token = "EAADavTA9leABAFRXDbfjT9IwkhJPJLrXDGFjGdrm1CHZBba5YaZARrZCmZCA9kydyrUyyZAjFWZCKUbOpaSxTtpvVLuZB4KICg4YKAMf28wvNTjEolbZA4a4md5daK88wocZBdRc0D7PDVZB467xQFjlZCC2EZAm9BZCjXbBPwMGXTnyrZBQZDZD"; 37 | 38 | $fp = json_decode(file_get_contents('user.json'), true); 39 | 40 | $site =json_encode(array( 41 | "type" => "web_url", 42 | "url" => " https://evilinsult.com ", 43 | "title" => "Evil Insult Generator Homepage" 44 | )); 45 | 46 | $element = array( 47 | "title" => "Evil Insult Generator Homepage", 48 | "image_url" => "https://evilinsult.com/bots/facebook/evil.jpg", 49 | "subtitle" => "Click", 50 | "buttons" => [$site] 51 | ); 52 | 53 | $URL= array( 54 | "type" => "template", 55 | "payload" => array( 56 | "template_type" => "generic", 57 | "elements" => [$element] 58 | ) 59 | ); 60 | 61 | $buttonGenerate = array( 62 | "content_type" => "text", 63 | "title" => "Generate", 64 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_buttonGenerate" 65 | ); 66 | 67 | $buttonLanguage = array( 68 | "content_type" => "text", 69 | "title" => "Language", 70 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_buttonLanguage" 71 | ); 72 | 73 | $buttonHomepage = array( 74 | "content_type" => "text", 75 | "title" => "Homepage", 76 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_buttonHomepage" 77 | ); 78 | 79 | $keyboardSet =[$buttonGenerate,$buttonLanguage,$buttonHomepage]; 80 | 81 | $buttonEN= array( 82 | "content_type" => "text", 83 | "title" => "en", 84 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_EN" 85 | ); 86 | 87 | $buttonDE = array( 88 | "content_type" => "text", 89 | "title" => "de", 90 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_DE" 91 | ); 92 | $buttonES= array( 93 | "content_type" => "text", 94 | "title" => "es", 95 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_EN" 96 | ); 97 | 98 | $buttonPT = array( 99 | "content_type" => "text", 100 | "title" => "pt", 101 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_DE" 102 | ); 103 | $buttonRU= array( 104 | "content_type" => "text", 105 | "title" => "ru", 106 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_EN" 107 | ); 108 | 109 | $buttonFR = array( 110 | "content_type" => "text", 111 | "title" => "fr", 112 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_DE" 113 | ); 114 | $buttonCN= array( 115 | "content_type" => "text", 116 | "title" => "cn", 117 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_EN" 118 | ); 119 | 120 | $buttonSW = array( 121 | "content_type" => "text", 122 | "title" => "sw", 123 | "payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_DE" 124 | ); 125 | //Create new button for keyboardLanguage, for example: 126 | //$buttonRU = array( 127 | // "content_type" => "text", 128 | //"title" => "ru", 129 | //"payload" => "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_RU" 130 | // ); 131 | $keyboardLanguage = [$buttonZH,$buttonES,$buttonEN,$buttonHI,$buttonAR,$buttonPT,$buttonBN,$buttonRU,$buttonJA,$buttonJV,$buttonSW,$buttonDE,$buttonKO,$buttonFR,$buttonTE,$buttonMR,$buttonTR,$buttonTA,$buttonVI,$buttonUR,$buttonEL/*add button here, for example: $buttonRU */]; 132 | 133 | 134 | if(($message=='zh')||($message=='es')||($message=='en')||($message=='hi')||($message=='ar')||($message=='pt')||($message=='bn')||($message=='ru')($message=='ja')||($message=='jv')||($message=='sw')||($message=='de')||($message=='ko')||($message=='fr')||($message=='te')||($message=='mr')($message=='tr')||($message=='ta')||($message=='vi')||($message=='ur')||($message=='el')){ 135 | $is = false; 136 | foreach ( $fp as $key=> $value) { 137 | if($key==$chat_id){ 138 | $is = true; 139 | } 140 | } 141 | if ($is!= false) { 142 | foreach ( $fp as $key=> $value) { 143 | if($key==$chat_id){ 144 | $fp[$key] = $message; 145 | } 146 | } 147 | $arr3 = json_encode($fp); 148 | file_put_contents('user.json', $arr3); 149 | $fuck = "Language successfully changed to: ".$message; 150 | $data = array( 151 | 'recipient' => array('id' => "$id" ), 152 | 'message' => array("text" => "$fuck", 153 | "quick_replies" => json_encode($keyboardSet) 154 | ) 155 | ); 156 | } 157 | else{ 158 | $fp[$id] = $message; 159 | $arr3 = json_encode($fp); 160 | file_put_contents('user.json', $arr3); 161 | $fuck = "Language successfully changed to: ".$message; 162 | $data = array( 163 | 'recipient' => array('id' => "$id" ), 164 | 'message' => array("text" => "$fuck", 165 | "quick_replies" => json_encode($keyboardSet) 166 | ) 167 | ); 168 | } 169 | $message = "none"; 170 | } 171 | 172 | switch ($message) { 173 | case 'Generate': 174 | $lang = 'en'; 175 | foreach ( $fp as $key=> $value) { 176 | if($key==$id){ 177 | $lang = $value; 178 | } 179 | } 180 | $fuck = file_get_contents('https://evilinsult.com/generate_insult.php?lang='.$lang); 181 | //You should add a new operator "if" for comparing with language which was added (for example if($lang =='ru')) 182 | // After that you should add a new expression for the variable "fuck" (for example $fuck = file_get_contents('https://evilinsult.com/generate_insult.php?lang=ru') Внимание сюда | 183 | // ^ 184 | // look here | 185 | $data = array( 186 | 'recipient' => array('id' => "$id" ), 187 | 'message' => array("text" => "$fuck", 188 | "quick_replies" => json_encode($keyboardSet) 189 | ) 190 | ); 191 | break; 192 | case 'Language': 193 | $lang = 'en'; 194 | $data = array( 195 | 'recipient' => array('id' => "$id" ), 196 | 'message' => array("text" => "Choose language", 197 | "quick_replies" => json_encode($keyboardLanguage) 198 | ) 199 | ); 200 | break; 201 | case 'Homepage': 202 | $data = array( 203 | 'recipient' => array('id' => "$id" ), 204 | 'message' => array("text" => " ", 205 | "quick_replies" => json_encode($keyboardSet) 206 | ) 207 | ); 208 | $date = array( 209 | 'recipient' => array('id' => "$id" ), 210 | 'message' => array( 211 | "attachment" =>$URL 212 | ) 213 | ); 214 | break; 215 | 216 | case 'none': 217 | break; 218 | //You should add a new "case" with description abbreviation needed language (for example ru, fr, pt) 219 | // after you should copy some case which was created before and you should change something therre 220 | // the expression assigned to a variable "fuck", depending on the desired language 221 | // (for example $fuck = file_get_contents('https://evilinsult.com/generate_insult.php?lang=ru') 222 | // ^ 223 | // Look here | 224 | default: 225 | $lang = 'en'; 226 | foreach ( $mass as $key=> $value) { 227 | if($key==$chat_id){ 228 | $lang = $value; 229 | } 230 | } 231 | $fuck = file_get_contents('https://evilinsult.com/generate_insult.php?lang='.$lang); 232 | // You shouldd add a new operator "if" for comparing with language which was added (for example if($lang =='ru')) 233 | // after you sholud add a new expression for a variabe "fuck": $fuck = file_get_contents('https://evilinsult.com/generate_insult.php?lang=ru); 234 | // ^ 235 | // Look here | 236 | $data = array( 237 | 'recipient' => array('id' => "$id" ), 238 | 'message' => array("text" => "$fuck", 239 | "quick_replies" => json_encode($keyboardSet) 240 | ) 241 | ); 242 | } 243 | 244 | function checkUser($mass,$chat_id){ 245 | $is = false; 246 | foreach ( $mass as $key=> $value) { 247 | if($key==$chat_id){ 248 | $is = true; 249 | } 250 | } 251 | return $is; 252 | } 253 | function AddUser($chat_id,$mass,$message){ 254 | $mass[$chat_id] = $message; 255 | $arr3 = json_encode($mass); 256 | file_put_contents('user.json', $arr3); 257 | } 258 | $options = array( 259 | 'http' => array( 260 | 'method' => 'POST', 261 | 'content' => json_encode($data), 262 | 'header' => "Content-Type: application/json" 263 | ) 264 | ); 265 | $option = array( 266 | 'http' => array( 267 | 'method' => 'POST', 268 | 'content' => json_encode($date), 269 | 'header' => "Content-Type: application/json" 270 | ) 271 | ); 272 | 273 | 274 | $context = stream_context_create($options); 275 | $contexts = stream_context_create($option); 276 | file_get_contents("https://graph.facebook.com/v2.7/me/messages?access_token=$token",false, $contexts); 277 | file_get_contents("https://graph.facebook.com/v2.7/me/messages?access_token=$token",false, $context); 278 | --------------------------------------------------------------------------------