├── LICENSE ├── README.md ├── README.md.tmp.html └── kuakuabot.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Sunbelife 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kuakua_bot 2 | 3 |  4 | 5 | 戳这里看:[介绍文章](https://mp.weixin.qq.com/s/e1KDqrzCLp1r5q828e6Z0A) 6 | 7 | 功能:夸夸机器人,实现在微信群聊里一被 @ 就放出彩虹屁 🌈 攻击。 8 | 9 | 夸到人起鸡皮疙瘩。 10 | 11 | *API 来源:彩虹屁生成器:https://chp.shadiao.app* 12 | 13 | *Python 库:wxpy* 14 | -------------------------------------------------------------------------------- /README.md.tmp.html: -------------------------------------------------------------------------------- 1 |
介绍文章:https://mp.weixin.qq.com/s/e1KDqrzCLp1r5q828e6Z0A
6 | 7 |夸夸机器人,实现在微信群聊里一被 @ 就放出彩虹屁 🌈 攻击。
8 | 9 |夸到人起鸡皮疙瘩。
10 | 11 |API 来源:彩虹屁生成器:https://chp.shadiao.app
12 | 13 |Python 库:wxpy
14 | -------------------------------------------------------------------------------- /kuakuabot.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from wxpy import * 3 | 4 | bot = Bot() 5 | 6 | # API 申请白名单是免费的,直接去 nmsl.shadiao.app 申请即可。 7 | kuakua_url = "https://chp.shadiao.app/api.php?from=sunbelife" 8 | maren_url = "https://nmsl.shadiao.app/api.php?level=min&lang=zh_cn&from=sunbelife" 9 | 10 | # 只有名单里的夸 11 | def is_kua(name): 12 | 13 | kuas = ['胖鱼', "苦逼"] 14 | 15 | for i in kuas: 16 | if i in name: 17 | return True 18 | # 如果你想让名单生效,就把这里改成 False 19 | return True 20 | 21 | # 打印所有*群聊*对象中的*文本*消息 22 | @bot.register(Group, TEXT) 23 | def print_group_msg(msg): 24 | # 如果是群聊,但没有被 @,则不回复 25 | if isinstance(msg.chat, Group) and not msg.is_at: 26 | return 27 | else: 28 | kuakua = requests.get(kuakua_url) 29 | mama = requests.get(maren_url) 30 | 31 | print(msg.raw) 32 | 33 | if is_kua(msg.raw['ActualNickName']): 34 | text = kuakua.text 35 | else: 36 | text = mama.text 37 | 38 | return '@{} {}'.format(msg.raw['ActualNickName'], text) 39 | 40 | # 堵塞线程,并进入 Python 命令行 41 | embed() --------------------------------------------------------------------------------