├── docs ├── git快速入门.md └── 环境基本配置.md ├── modules ├── check_alive │ ├── config.json │ ├── readme.md │ └── __init__.py ├── explicit_detector │ ├── exp_list.json │ ├── warning_words_list.json │ ├── config.json │ ├── readme.md │ └── __init__.py ├── bullshit_generator │ ├── config.json │ ├── readme.md │ ├── __init__.py │ └── data.json ├── guess │ ├── config.json │ ├── README.md │ └── __init__.py ├── translation │ ├── config.json │ ├── README.md │ └── __init__.py ├── c++compiler │ ├── config.json │ ├── README.md │ └── __init__.py ├── recall_detector │ ├── config.json │ ├── readme.md │ └── __init__.py ├── self_mute │ ├── config.json │ ├── readme.md │ └── __init__.py └── check_name_format │ ├── config.json │ ├── readme.md │ └── __init__.py ├── examples └── bot.py ├── main.py ├── .gitignore ├── README.md └── LICENSE /docs/git快速入门.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lllbbbyyy/GCbot/HEAD/docs/git快速入门.md -------------------------------------------------------------------------------- /modules/check_alive/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ask": "还活着", 3 | "ans": "死了" 4 | } -------------------------------------------------------------------------------- /modules/explicit_detector/exp_list.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | "脏话1", 4 | "脏话2" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /modules/explicit_detector/warning_words_list.json: -------------------------------------------------------------------------------- 1 | [ 2 | "别讲脏话哦..", 3 | "不许说脏话..", 4 | "文明一点点..", 5 | "你不可爱了.." 6 | ] -------------------------------------------------------------------------------- /modules/bullshit_generator/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_use": true, 3 | "key_word":"bullshit", 4 | "text_length":200, 5 | "content_start_pos":8, 6 | "black_list":[939474354,761222195] 7 | } -------------------------------------------------------------------------------- /modules/explicit_detector/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "should_use_local_exp_list": false, 3 | "local_exp_list_dir": "/exp_list.json", 4 | "cloud_api": { 5 | "api": "https://www.gardilily.com/alpBot/api/exp_detector.php", 6 | "str_key": "str" 7 | } 8 | } -------------------------------------------------------------------------------- /modules/guess/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_use": true, 3 | "cloud_api": { 4 | "api": "https://lab.magiconch.com/api/nbnhhsh/guess", 5 | "str_key": "text" 6 | }, 7 | "black_list": [642362943], 8 | "key_word": "guess ", 9 | "substr_start_pos": 6 10 | } -------------------------------------------------------------------------------- /modules/check_alive/readme.md: -------------------------------------------------------------------------------- 1 | # check_alive 2 | 3 | 用于检测机器人进行存活 4 | 5 | 参考配置文件config.json中的配置内容: 6 | 7 | ```json 8 | { 9 | "ask": "还活着", 10 | "ans": "死了" 11 | } 12 | ``` 13 | 14 | 第一个字符串`ask`表示检测的询问语句,第二个字符串`ans`表示存活的回复语句 15 | 16 | 当在**群聊**中出现`ask`语句时,机器人将会回复`ans`语句来表示自己当前处于在线状态 -------------------------------------------------------------------------------- /modules/translation/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_use": true, 3 | "url": "translate.google.cn", 4 | "black_list": [642362943], 5 | "key_word": ["trans to ","trans help"], 6 | "choice": { 7 | "ch":"中文", 8 | "en":"英语", 9 | "ja":"日语", 10 | "ko":"韩语", 11 | "fr":"法语", 12 | "de":"德语", 13 | "ru":"俄语", 14 | "es":"西班牙语", 15 | "pt":"葡萄牙语", 16 | "it":"意大利语", 17 | "vi":"越南语", 18 | "id":"印尼语", 19 | "ar":"阿拉伯语", 20 | "nl":"荷兰语" 21 | }, 22 | "choice_len": 2 23 | } -------------------------------------------------------------------------------- /modules/bullshit_generator/readme.md: -------------------------------------------------------------------------------- 1 | # bullshit_generator 2 | 3 | 用于产生一篇以用户输入文本为主题的狗屁不通的文章 4 | 5 | 参考配置文件config.json中的配置内容: 6 | 7 | ```json 8 | { 9 | "allow_use": true, 10 | "key_word":"bullshit", 11 | "text_length":200, 12 | "content_start_pos":8, 13 | "black_list":[939474354,761222195] 14 | } 15 | ``` 16 | 17 | 对于策略的说明: 18 | 19 | 字符串`allow_use`表示是否启用狗屁不通文章生成器 20 | 21 | 字符串`key_word`表示触发该插件的关键词 22 | 23 | 数字`text_length`表示生成文章的大概长度,程序在达到200字之后会自动停止生成 24 | 25 | 数字`content_start_pos`表示开始截取文章标题的位置,该数字随着`key_word`的改变而改变 26 | 27 | 列表`black_list`表示不使用的群,防止在重要的群当中掩埋掉重要消息 28 | 29 | 该插件可以使用help语句来显示用法,语句为`bullshit -help` -------------------------------------------------------------------------------- /modules/c++compiler/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_use": true, 3 | "url" : "https://wandbox.org/api/compile.json", 4 | "black_list": [], 5 | "key_word": ["c++","c++ help","c++ eg"], 6 | "help_tip":"\n用g++12标准进行编译并显示输出结果\n---------\n使用格式:\nc++\nxxxx(待编译程序)\n// StdInput xxxx\n---------\n(如有输入,在程序中间或尾部加上注释,在StdInput后给出\n关键词:StdInput)\n发送c++ eg查看例子", 7 | "c++_eg":"\nc++\n#include\nusing namespace std;\n int main(){\n int yxx=0;\n for(int i=0;i<2;i++){\n cin>>yxx;\n cout< yyds可能是 34 | > 35 | > 永远滴神 36 | > 37 | > 音乐大师 38 | > 39 | > 以一当十 40 | > 41 | > 阴阳大师 42 | > 43 | > 永远单身 44 | > 45 | > 游刃有余(日语) 46 | > 47 | > 硬硬的说 48 | > 49 | > 永远都是 50 | 51 | 的形式呈现结果,若搜索结果无效,则提示`找不到噢,试试别的叭!` 52 | -------------------------------------------------------------------------------- /examples/bot.py: -------------------------------------------------------------------------------- 1 | from graia.broadcast import Broadcast 2 | from graia.application import GraiaMiraiApplication, Session 3 | from graia.application.message.chain import MessageChain 4 | import asyncio 5 | from graia.application.message.elements.internal import Plain, At 6 | from graia.application.entry import Friend, Group, Member, BotOnlineEvent 7 | 8 | loop = asyncio.get_event_loop() 9 | bcc = Broadcast(loop=loop) 10 | app = GraiaMiraiApplication( 11 | broadcast=bcc, 12 | connect_info=Session( 13 | host="http://localhost:8080", # 填入 httpapi 服务运行的地址 14 | authKey="INITKEYDYHZYISn", # 填入 authKey 15 | account=1234567, # 你的机器人的 qq 号 16 | websocket=True # Graia 已经可以根据所配置的消息接收的方式来保证消息接收部分的正常运作. 17 | )) 18 | 19 | 20 | @bcc.receiver("GroupMessage") 21 | async def friend_message_listener(app: GraiaMiraiApplication, group: Group, 22 | message: MessageChain, member: Member): 23 | if message.asDisplay() == '还活着': 24 | 25 | await app.sendGroupMessage(group, MessageChain.create([Plain("死了")])) 26 | 27 | 28 | app.launch_blocking() 29 | -------------------------------------------------------------------------------- /modules/self_mute/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "default-strategy" : 3 | { 4 | "ask" : "我要禁言", 5 | "success-message" : "已禁言", 6 | "bot-no-permission-message" : "我没有禁言权限。", 7 | "target-not-member-message" : "你无法被我禁言。", 8 | "over-range-message" : "禁言时间过长,已禁言30天。" 9 | }, 10 | "groups-enabled" : 11 | { 12 | "642362943" : 13 | { 14 | "use-default-strategy" : true 15 | }, 16 | "748798035" : 17 | { 18 | "use-default-strategy" : false, 19 | "strategy" : 20 | { 21 | "ask" : "我要自裁", 22 | "success-message" : "满足你!", 23 | "bot-no-permission-message" : "等我有了管理再来治你!", 24 | "target-not-member-message" : "呜呜呜,我帮不了你。", 25 | "over-range-message" : "这么久我怕世界把你忘了,满足你30天吧!" 26 | } 27 | }, 28 | "1080209889" : 29 | { 30 | "use-default-strategy" : true 31 | }, 32 | "761222195" : 33 | { 34 | "use-default-strategy" : true 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /modules/explicit_detector/readme.md: -------------------------------------------------------------------------------- 1 | # explicit_detector 2 | 用于检测文本中是否存在敏感词,在检测到敏感词后@该用户,并做出提醒。 3 | 4 | ### 在 config.json 中设置脏话词库信息: 5 | 6 | { 7 | "should_use_local_exp_list": false, 8 | "local_exp_list_dir": "/exp_list.json", 9 | "cloud_api": { 10 | "api": "https://www.yourserver.com/yourloc/api/yourapi.php", 11 | "str_key": "str" 12 | } 13 | } 14 | 15 | 其中: 16 | 17 | `should_use_local_exp_list` 表示是否使用本地脏话词库。 18 | 19 | `local_exp_list_dir` 表示如果使用本地词库,词库的文件地址位置。(假设为 **/exp_list.json**) 20 | 21 | `cloud_api` 负责存储云接口信息。 22 | 23 | 其中,`api` 表示接口地址,`str_key` 表示传入参数键。使用 **Get** 请求完成查询。返回值以 **1** 和 **0** 表示是否检测到脏话。 24 | 25 | ## 模块依赖于两个json文件,存储相关信息。 26 | 27 | ### exp_list.json 负责存储敏感词列表: 28 | 29 | { 30 | "data": [ 31 | "脏话1", 32 | "脏话2", 33 | ... 34 | ] 35 | } 36 | 37 | ### warning_words_list.json 负责存储检测到敏感词后,提醒用户的语句: 38 | 39 | [ 40 | "不许说脏话", 41 | "说脏话不好", 42 | ... 43 | ] 44 | 45 | 当检测到某条**群消息**中存在 `exp_list.json` 中的内容时,会发送一条提示消息。该消息先@该成员,然后从 `warning_words_list.json` 中随机抽取一条发送。 -------------------------------------------------------------------------------- /modules/translation/README.md: -------------------------------------------------------------------------------- 1 | # translation模块 2 | 用于词句的翻译,支持多种语言,调用了第三方库**googletrans(注意:版本为4.0.0rc1,如果用默认版本3.0.0会出错)** 3 | ,需要挂VPN 4 | 5 | ### 在 config.json 中设置接口信息、权限设置,及所支持的语言: 6 | 7 | { 8 | "allow_use": true, 9 | "url": "translate.google.cn", 10 | "black_list": [642362943], 11 | "key_word": ["trans to ","trans help"], 12 | "choice": { 13 | "ch":"中文", 14 | "en":"英语", 15 | "ja":"日语", 16 | "ko":"韩语", 17 | "fr":"法语", 18 | "de":"德语", 19 | "ru":"俄语", 20 | "es":"西班牙语", 21 | "pt":"葡萄牙语", 22 | "it":"意大利语", 23 | "vi":"越南语", 24 | "id":"印尼语", 25 | "ar":"阿拉伯语", 26 | "nl":"荷兰语" 27 | }, 28 | "choice_len": 2 29 | } 30 | 31 | 其中: 32 | 33 | `allow_use` 表示是否允许使用该功能。 34 | 35 | `url` 负责存储云接口信息。 36 | 37 | `black_list` 表示禁用该功能的群。 38 | 39 | `key_word` 表示触发关键词, 40 | 41 | 其中,`trans to `是触发翻译功能的前缀,`trans help`用于提示触发规则 42 | 43 | `choice`中是所支持翻译成的所有语言种类。 44 | 45 | `choice_len`指所有`choice`的长度都是2 46 | 47 | ## 触发格式应该类似于 48 | >trans to en 你好 49 | 50 | 若所trans to 功能有效触发,则以类似 51 | 52 | > 翻译结果为: 53 | > 54 | > Hello 55 | 56 | 的形式呈现结果,若格式错误或所要求的语言不支持,则提示`不支持这种语言噢,换一种试试叭!` 57 | -------------------------------------------------------------------------------- /modules/check_alive/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | from graia.saya import Saya, Channel 5 | from graia.saya.builtins.broadcast.schema import ListenerSchema 6 | 7 | from graia.application.entry import Group, GroupMessage, Plain, MessageChain, GraiaMiraiApplication 8 | 9 | # 插件信息 10 | __name__ = "check_alive" 11 | __description__ = "检查机器人是否存活" 12 | __author__ = "llbbyy" 13 | __usage__ = "在群内发送配置文件中给定的口令" 14 | 15 | saya = Saya.current() 16 | channel = Channel.current() 17 | 18 | channel.name(__name__) 19 | channel.description(f"{__description__}\n使用方法:{__usage__}") 20 | channel.author(__author__) 21 | 22 | config_info = {} 23 | # 打开配置文件 24 | # 配置文件格式为: 25 | # { 26 | # "ask":str, 27 | # "ans":str 28 | # } 29 | current_path = os.path.dirname(__file__) 30 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 31 | config_info = json.load(f) 32 | 33 | 34 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 35 | async def check_alive(app: GraiaMiraiApplication, message: MessageChain, 36 | group: Group): 37 | 38 | if message.asDisplay() == config_info['ask']: 39 | await app.sendGroupMessage( 40 | group, MessageChain.create([Plain(config_info['ans'])])) 41 | -------------------------------------------------------------------------------- /modules/check_name_format/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "default-strategy" : 3 | { 4 | "ask" : "检查群名片", 5 | "top-prompt" : "请修改群名片:", 6 | "bottom-prompt" : "", 7 | "white-list" : [278787983], 8 | "stu-years" : "(17|18|19|20|21)", 9 | "class-num" : 21, 10 | "major-list" : ["计拔", "计科", "软工", "信安", "大数据", "通信", "微电子", "测绘"], 11 | "special-ch" : ["·"], 12 | "permission" : "Owner-Admin", 13 | "should-at" : true 14 | }, 15 | 16 | "groups-enabled" : 17 | { 18 | "642362943" : 19 | { 20 | "use-default-strategy" : true 21 | }, 22 | "123456789" : 23 | { 24 | "use-default-strategy" : false, 25 | "strategy" : 26 | { 27 | "ask" : "test", 28 | "top-prompt" : "测试用,不@人", 29 | "bottom-prompt" : "", 30 | "white-list" : [278787983], 31 | "stu-years" : "(17|18|19|20|21)", 32 | "class-num" : 21, 33 | "major-list" : ["计拔", "计科", "软工", "信安", "大数据", "通信", "微电子", "测绘"], 34 | "special-ch" : ["·"], 35 | "permission" : "All", 36 | "should-at" : false 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /modules/self_mute/readme.md: -------------------------------------------------------------------------------- 1 | # self_mute模块 2 | 3 | 用于群成员自主进行禁言。 4 | 5 | ### 参考配置文件config.json中的配置内容: 6 | 7 | { 8 | "default-strategy" : 9 | { 10 | "ask" : "我要禁言", 11 | "success-message" : "已禁言", 12 | "bot-no-permission-message" : "我没有禁言权限。", 13 | "target-not-member-message" : "你无法被我禁言。", 14 | "over-range-message" : "禁言时间过长,已禁言30天。" 15 | }, 16 | "groups-enabled" : 17 | { 18 | "642362943" : 19 | { 20 | "use-default-strategy" : true 21 | }, 22 | "748798035" : 23 | { 24 | "use-default-strategy" : false, 25 | "strategy" : 26 | { 27 | "ask" : "我要自裁", 28 | "success-message" : "满足你!", 29 | "bot-no-permission-message" : "等我有了管理再来治你!", 30 | "target-not-member-message" : "呜呜呜,我帮不了你。", 31 | "over-range-message" : "这么久我怕世界把你忘了,满足你30天吧!" 32 | } 33 | } 34 | } 35 | } 36 | 37 | ### 关于策略的说明: 38 | 39 | `default-strategy`记录默认处理策略 40 | 41 | `group-enabled`记录启用该模块的群号 42 | 43 | 字符串`use-default-strategy`表示是否启用默认处理策略 44 | 45 | 字符串`ask`表示触发此模块的关键词 46 | 47 | 字符串`success-message`表示禁言成功时的提示消息 48 | 49 | 字符串`bot-no-permission-message`表示机器人无禁言权限时的提示消息 50 | 51 | 字符串`target-not-member-message`表示希望被禁言者为管理员或群主时的提示消息 52 | 53 | 字符串`over-range-message`表示禁言时间过长的提示消息 54 | 55 | ### 群内触发格式 56 | 57 | > 字符串`ask` + `禁言时间` -------------------------------------------------------------------------------- /modules/c++compiler/README.md: -------------------------------------------------------------------------------- 1 | # c++ Compiler 模块 2 | 用于在线编译c++代码,支持有标准输入输出及错误提示,使用在线编api:**https://wandbox.org/api/compile.json** 3 | 4 | ### 在 config.json 中设置接口信息、权限设置、在线编译器选项、输入 c++ help时、c++ eg的提示语、群号黑名单、关键词信息 5 | 6 | { 7 | "allow_use": true, 8 | "url" : "https://wandbox.org/api/compile.json", 9 | "black_list": [], 10 | "key_word": ["c++","c++ help","c++ eg"], 11 | "help_tip":"\n用g++12标准进行编译并显示输出结果\n---------\n使用格式:\nc++\nxxxx(待编译程序)\n// StdInput xxxx\n---------\n(如有输入,在程序中间或尾部加上注释,在StdInput后给出\n关键词:StdInput)\n发送c++ eg查看例子", 12 | "c++_eg":"\nc++\n#include\nusing namespace std;\n int main(){\n int yxx=0;\n for(int i=0;i<2;i++){\n cin>>yxx;\n cout<c++ 38 | > 39 | >xxxxxx 40 | > 41 | >// StdInput xx xx 42 | 43 | 若所c++ 功能有效触发,则以类似 44 | 45 | >@xxx 46 | > 47 | >编译成功,输出为 48 | > 49 | >xxxxx 50 | 51 | 如果编译错误,则输出为: 52 | 53 | >@xxx 54 | > 55 | >编译错啦,仔细检查哦 56 | > 57 | >xxxxx(错误信息) 58 | 59 | 如果发送消息行数较多,采取截取20行,避免刷屏;如果行数过多或死循环导致在线编译错误,无任何输出 -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import os 3 | import json 4 | 5 | from graia.saya import Saya 6 | from graia.saya.builtins.broadcast import BroadcastBehaviour 7 | 8 | from graia.broadcast import Broadcast 9 | 10 | from graia.application.entry import GraiaMiraiApplication, Session 11 | 12 | loop = asyncio.get_event_loop() 13 | bcc = Broadcast(loop=loop) 14 | saya = Saya(bcc) 15 | saya.install_behaviours(BroadcastBehaviour(bcc)) 16 | 17 | configs = {} 18 | # 配置文件名一定是config.json 19 | # 配置文件格式为: 20 | # { 21 | # "host":str形式的主机,例:"http://localhost:8080", 22 | # "auth-key":str形式的认证串, 23 | # "bot-qq":num形式的qq号 24 | # } 25 | current_path = os.path.dirname(__file__) 26 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 27 | configs = json.load(f) 28 | 29 | app = GraiaMiraiApplication(broadcast=bcc, 30 | connect_info=Session(host=configs["host"], 31 | authKey=configs["auth-key"], 32 | account=configs["bot-qq"], 33 | websocket=True)) 34 | 35 | ignore = ["__init__.py", "__pycache__"] 36 | 37 | with saya.module_context(): 38 | for module in os.listdir("modules"): 39 | if module in ignore: 40 | continue 41 | try: 42 | if os.path.isdir(module): 43 | saya.require(f"modules.{module}") 44 | else: 45 | saya.require(f"modules.{module.split('.')[0]}") 46 | except ModuleNotFoundError: 47 | print(f"ERROR: {module}模块出现异常") 48 | pass 49 | 50 | app.launch_blocking() 51 | 52 | try: 53 | loop.run_forever() 54 | except KeyboardInterrupt: 55 | exit() 56 | -------------------------------------------------------------------------------- /modules/recall_detector/readme.md: -------------------------------------------------------------------------------- 1 | # recall_detector 2 | 撤回检测,并适当进行提示或禁言。 3 | 4 | 配置文件 config.json 中存储该模块所需的规则等信息: 5 | 6 | { 7 | "default_strategy": { 8 | "ignore_members": [ 9 | 2000 10 | ], 11 | "should_warn": true, 12 | "should_mute": true, 13 | "warning_words": [ 14 | "不要撤回啊..", 15 | "don't recall your message.." 16 | ], 17 | "should_count": true, 18 | "should_warn_with_count": true, 19 | "mute_time_sec": 360 20 | }, 21 | 22 | "group_enabled": { 23 | "100000": { 24 | "should_use_default_strategy": false, 25 | 26 | "strategy": { 27 | "ignore_members": [ 28 | 29 | ], 30 | "should_warn": true, 31 | "should_mute": true, 32 | "warning_words": [ 33 | "不要在这个群里撤回啊..", 34 | ], 35 | "should_count": true, 36 | "should_warn_with_count": true, 37 | "mute_time_sec": 5 38 | } 39 | }, 40 | 41 | "762572821": { 42 | "should_use_default_strategy": true 43 | } 44 | } 45 | } 46 | 47 | `default_strategy` 存储默认处理方式。 48 | 49 | 应将需要启用本插件的群号作为键值添加到 `group_enabled` 中,内容为一个 **json_object** ,记录策略等信息。如果 `should_use_default_strategy` 内容为 true,则当该群出现撤回情况时,加载默认策略。 50 | 51 | user_record.json 负责记录用户复读次数。可以不创建。 52 | 53 | { 54 | "2000": { 55 | "100000": 1, 56 | "100001": 2, 57 | ... 58 | }, 59 | "2001": { 60 | ... 61 | } 62 | } 63 | 64 | 其中,`2000` 为用户的**QQ号**,`100000` 为**群号**。 -------------------------------------------------------------------------------- /modules/check_name_format/readme.md: -------------------------------------------------------------------------------- 1 | # check_name_format 2 | 3 | 用于检测高程群群名片 4 | 5 | 参考配置文件config.json中的配置内容: 6 | 7 | ```json 8 | { 9 | "default-strategy" : 10 | { 11 | "ask" : "检查群名片", 12 | "top-prompt" : "请修改群名片:", 13 | "bottom-prompt" : "", 14 | "white-list" : [278787983], 15 | "stu-years" : "(17|18|19|20|21)", 16 | "class-num" : 21, 17 | "major-list" : ["计拔", "计科", "软工", "信安", "大数据", "通信", "微电子", "测绘"], 18 | "special-ch" : ["·"], 19 | "permission" : "Owner-Admin", 20 | "should-at" : true 21 | }, 22 | 23 | "groups-enabled" : 24 | { 25 | "642362943" : 26 | { 27 | "use-default-strategy" : true 28 | }, 29 | "123456789" : 30 | { 31 | "use-default-strategy" : false, 32 | "strategy" : 33 | { 34 | "ask" : "test", 35 | "top-prompt" : "测试用,不@人", 36 | "bottom-prompt" : "", 37 | "white-list" : [278787983], 38 | "stu-years" : "(17|18|19|20|21)", 39 | "class-num" : 21, 40 | "major-list" : ["计拔", "计科", "软工", "信安", "大数据", "通信", "微电子", "测绘"], 41 | "special-ch" : ["·"], 42 | "permission" : "All", 43 | "should-at" : false 44 | } 45 | } 46 | } 47 | } 48 | ``` 49 | 50 | `default-strategy`记录默认处理方式 51 | 52 | 应将需要启用本插件的群号作为键值添加到`group-enabled`中,内容为一个 json_object ,记录策略等信息。如果 `use-default-strategy`内容为 true,则在该群加载默认策略。 53 | 54 | 对于策略的说明: 55 | 56 | 字符串`ask`表示检测的询问语句 57 | 字符串`top-prompt`表示机器人发出的消息的头部提示信息 58 | 字符串`bottom-prompt`表示机器人发出的消息的底部提示信息 59 | 列表`white-list`表示白名单人员的qq号,机器人不对其进行检查 60 | 字符串`stu-years`表示群内合法学号的开头两位,格式为"(xx|..|xx)",方便偷懒 61 | 数`class-num`表示本届信息类班级个数 62 | 字符串`major-list`表示转专业补课同学都来自哪些专业 63 | 列表`special-ch`表示学生姓名中可能包含的特殊符号 64 | 字符串`permission`表示触发该插件功能所需要的权限,有三种:`Owner`, `Owner-Admin`, `All` 65 | `should-at`表示发出信息时是否@群名片不正确的成员 66 | 67 | 当在**群聊**中出现`ask`语句时,机器人回复信息格式如下: 68 | 69 | top-prompt 70 | 71 | @stu1 72 | 73 | @stu2 74 | 75 | ... 76 | 77 | bot-prompt -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 配置文件信息 2 | /config.json 3 | 4 | nohup.out 5 | 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | .Python 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | wheels/ 28 | pip-wheel-metadata/ 29 | share/python-wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | MANIFEST 34 | 35 | # PyInstaller 36 | # Usually these files are written by a python script from a template 37 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 38 | *.manifest 39 | *.spec 40 | 41 | # Installer logs 42 | pip-log.txt 43 | pip-delete-this-directory.txt 44 | 45 | # Unit test / coverage reports 46 | htmlcov/ 47 | .tox/ 48 | .nox/ 49 | .coverage 50 | .coverage.* 51 | .cache 52 | nosetests.xml 53 | coverage.xml 54 | *.cover 55 | *.py,cover 56 | .hypothesis/ 57 | .pytest_cache/ 58 | 59 | # Translations 60 | *.mo 61 | *.pot 62 | 63 | # Django stuff: 64 | *.log 65 | local_settings.py 66 | db.sqlite3 67 | db.sqlite3-journal 68 | 69 | # Flask stuff: 70 | instance/ 71 | .webassets-cache 72 | 73 | # Scrapy stuff: 74 | .scrapy 75 | 76 | # Sphinx documentation 77 | docs/_build/ 78 | 79 | # PyBuilder 80 | target/ 81 | 82 | # Jupyter Notebook 83 | .ipynb_checkpoints 84 | 85 | # IPython 86 | profile_default/ 87 | ipython_config.py 88 | 89 | # pyenv 90 | .python-version 91 | 92 | # pipenv 93 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 94 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 95 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 96 | # install all needed dependencies. 97 | #Pipfile.lock 98 | 99 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 100 | __pypackages__/ 101 | 102 | # Celery stuff 103 | celerybeat-schedule 104 | celerybeat.pid 105 | 106 | # SageMath parsed files 107 | *.sage.py 108 | 109 | # Environments 110 | .env 111 | .venv 112 | env/ 113 | venv/ 114 | ENV/ 115 | env.bak/ 116 | venv.bak/ 117 | 118 | # Spyder project settings 119 | .spyderproject 120 | .spyproject 121 | 122 | # Rope project settings 123 | .ropeproject 124 | 125 | # mkdocs documentation 126 | /site 127 | 128 | # mypy 129 | .mypy_cache/ 130 | .dmypy.json 131 | dmypy.json 132 | 133 | # Pyre type checker 134 | .pyre/ 135 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GCbot 2 | 高级语言程序设计课程用机器人 3 | 4 | ## 说明 5 | 6 | 该项目主要负责构建QQ机器人,从而帮忙完成同济大学高级语言程序设计课程群的管理工作,仅供学习用途。 7 | 8 | 该项目基于QQ机器人库[`mirai`](https://github.com/mamoe/mirai)以及配套的python sdk库[`graia`](https://github.com/GraiaProject/Application)开发。 9 | 10 | 11 | 12 | ## 涉及到的相关项目 13 | 14 | - [`mirai`](https://github.com/mamoe/mirai):一个在全平台下运行,提供 QQ Android 协议支持的高效率机器人库 15 | - [`mirai-console`](https://github.com/mamoe/mirai-console):一个基于mirai开发的插件式可扩展开发平台 16 | - [`mirai-api-http`]():提供与mirai交互方式的mirai-console插件 17 | - [`graia-application`](https://github.com/GraiaProject/Application):提供python sdk以便进行机器人开发 18 | - [`mirai-console-loader`](https://github.com/iTXTech/mirai-console-loader):模块化、轻量级且支持完全自定义的mirai加载器 19 | - [`saya_plugins_collection`](https://github.com/SAGIRI-kawaii/saya_plugins_collection):一个Graia-Saya的插件仓库 20 | 21 | 22 | 23 | ## 安装与配置 24 | 25 | 环境的配置请参考`docs/环境基本配置.md` 26 | 27 | 28 | 29 | ## 开发说明 30 | 31 | 本项目基于[`graia-application`](https://github.com/GraiaProject/Application)进行开发,相关的版本要求见`examples`目录下的环境配置文档 32 | 33 | 下面是`graia`提供的一些相关开发文档与api文档: 34 | 35 | - https://graia-document.vercel.app/docs/intro 36 | - https://graiaproject.github.io/Application/graia/application/index.html 37 | 38 | 另外`graia`的开发样例以及插件的开发样例可以参考[`saya_plugins_collection`](https://github.com/SAGIRI-kawaii/saya_plugins_collection)该项目中的实现 39 | 40 | 41 | 42 | ## 贡献说明 43 | 44 | **注意你的所有文件都应该使用UTF-8编码** 45 | 46 | 请注意你的命名方式应该优先使用**蛇形命名法**,以匹配我们的整个编码风格 47 | 48 | 提交Pr时应该提交到**dev分支** 49 | 50 | 注意如果你安装了第三方库,**请一定要在插件的readme文档中注明库名以及相应的版本,否则我们无法运行** 51 | 52 | 本项目使用Saya插件化的方法进行组织,即将自己完成的功能封装为一个插件,供main函数调用使用,插件将会统一存放在`modules`文件夹下,以供`main.py`调用 53 | 54 | 插件可以是单独的文件形式,亦可是包的形式(多文件情况下) 55 | 56 | 整个项目的结构与相关插件的实现方法可以参考[`saya_plugins_collection`](https://github.com/SAGIRI-kawaii/saya_plugins_collection) 57 | 58 | 目前插件库中给出了一个check_alive插件的实现过程,以供参考 59 | 60 | 注意给出的插件最好应当给予相应的`readme.md`文件,以说明插件的功能与用法,因此基本上推荐以文件夹(包)的形式给出 61 | 62 | 注意你的插件不应该对其他插件造成影响,并且应该注意**python模块被调用时的相对路径文件** 63 | 64 | 如果你觉得某些功能很有泛用性,可以提炼出相应的模块放置在`utils`文件夹下 65 | 66 | 请通过提交Pr的形式进行贡献 67 | 68 | 新开发者可以首先阅读[git快速入门](docs/git快速入门.md) 69 | 70 | 在提交的文档中如需插入图片,建议使用[llbbyy的图床](http://1.15.150.183:2333/) 71 | 72 | ## 其他说明 73 | 74 | ### config.json文件说明 75 | 76 | 注意根目录下的`config.json`文件是被添加在`.gitignore`文件中,不会被上传的,因此下载本项目后应该首先自行新建该文件,并且进行相关配置后才可运行 77 | 78 | `config.json`文件需与`main.py`文件同级 79 | 80 | `config.json`文件的结构与配置说明如下: 81 | 82 | ```json 83 | { 84 | "host":str形式的主机,例:"http://localhost:8080", 85 | "auth-key":str形式的认证串, 86 | "bot-qq":num形式的qq号 87 | } 88 | ``` 89 | 90 | 91 | 92 | ## 开源许可证 93 | 94 | 我们使用 [`GNU GPLv3`](https://choosealicense.com/licenses/gpl-3.0/) 作为本项目的开源许可证 95 | 96 | -------------------------------------------------------------------------------- /modules/guess/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | from graia.saya import Saya, Channel 5 | from graia.saya.builtins.broadcast.schema import ListenerSchema 6 | 7 | from graia.application import GraiaMiraiApplication 8 | from graia.application.message.chain import MessageChain 9 | 10 | from graia.application.message.elements.internal import Plain 11 | from graia.application.entry import Friend, Group, Member, FriendMessage, GroupMessage, At 12 | # 插件信息 13 | __name__ = "guess" 14 | __description__ = "猜测首字母缩写的含义" 15 | __author__ = "da-qing-wa" 16 | __usage__ = "在群内发送guess xxx" 17 | 18 | saya = Saya.current() 19 | channel = Channel.current() 20 | 21 | channel.name(__name__) 22 | channel.description(f"{__description__}\n使用方法:{__usage__}") 23 | channel.author(__author__) 24 | 25 | config_info = {} 26 | current_path = os.path.dirname(__file__) 27 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 28 | config_info = json.load(f) 29 | 30 | import requests 31 | 32 | 33 | data = {} 34 | 35 | 36 | # guess 37 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 38 | async def guess(app: GraiaMiraiApplication, message: MessageChain, group: Group): 39 | if message.asDisplay().startswith(config_info['key_word']) and group.id not in config_info['black_list'] and config_info['allow_use']: 40 | data[config_info['cloud_api']['str_key']] = message.asDisplay()[config_info['substr_start_pos']:] 41 | resp = requests.post(url=config_info['cloud_api']['api'], data=data) 42 | json = resp.json() 43 | str = "" 44 | if not json: 45 | str += "找不到噢,试试别的叭!" 46 | elif "trans" not in json[0]: 47 | if not json[0]["inputting"]: 48 | str += "找不到噢,试试别的叭!" 49 | else: 50 | str += message.asDisplay()[config_info['substr_start_pos']:] + "可能是" + "\n" + json[0]["inputting"][0] 51 | else: 52 | str += message.asDisplay()[config_info['substr_start_pos']:] + "可能是" 53 | for i in json[0]["trans"]: 54 | str += '\n' + i 55 | await app.sendGroupMessage(group, MessageChain.create([Plain(str)])) 56 | 57 | 58 | # @channel.use(ListenerSchema(listening_events=[GroupMessage])) 59 | # async def chat(app: GraiaMiraiApplication, message: MessageChain, group: Group): 60 | # url = "http://api.qingyunke.com/api.php?key=free&appid=0&msg=" 61 | # if message.asDisplay().startswith("chat"): 62 | # url += message.asDisplay()[5:] 63 | # res = requests.get(url) 64 | # resp = res.json()["content"] 65 | # await app.sendGroupMessage(group, MessageChain.create([Plain(resp)])) 66 | 67 | -------------------------------------------------------------------------------- /modules/bullshit_generator/__init__.py: -------------------------------------------------------------------------------- 1 | import random 2 | import json 3 | import os 4 | from graia.saya import Saya, Channel 5 | from graia.saya.builtins.broadcast.schema import ListenerSchema 6 | 7 | from graia.application.entry import Group, GroupMessage, Member, At, Plain, MessageChain, GraiaMiraiApplication 8 | from graia.application.group import MemberPerm 9 | 10 | # 插件信息 11 | __name__ = "bullshit_generator" 12 | __description__ = "狗屁不通文章生成器" 13 | __author__ = "SZY" 14 | __usage__ = "在群内根据用户输入的标题,生成对应的狗屁不通的文章" 15 | 16 | saya = Saya.current() 17 | channel = Channel.current() 18 | 19 | channel.name(__name__) 20 | channel.description(f"{__description__}\n使用方法:{__usage__}") 21 | channel.author(__author__) 22 | 23 | Have_data=True 24 | 25 | config_info = {} 26 | 27 | current_path = os.path.dirname(__file__) 28 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 29 | config_info = json.load(f) 30 | 31 | try: 32 | with open(current_path + '/data.json', 'r', encoding='utf-8') as test: 33 | data = json.load(test) 34 | except FileNotFoundError: 35 | print('未找到词库文件,请检查词库文件之后重新运行插件') 36 | Have_data=False 37 | 38 | 39 | def generator(title, length=800): 40 | """ 41 | :param title: 文章标题 42 | :param length: 生成正文的长度 43 | :return: 返回正文内容 44 | """ 45 | body = "" 46 | while len(body) < length: 47 | num = random.randint(0, 100) 48 | if num < 10: 49 | body += "\r\n" 50 | elif num < 20: 51 | body += random.choice(data["famous"]) \ 52 | .replace('a', random.choice(data["before"])) \ 53 | .replace('b', random.choice(data['after'])) 54 | else: 55 | body += random.choice(data["bosh"]) 56 | body = body.replace("x", title) 57 | return body 58 | 59 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 60 | async def text_generator(app: GraiaMiraiApplication, group: Group, 61 | message: MessageChain, member: Member): 62 | 63 | if message.asDisplay()=="bullshit -help": 64 | help="格式:\nbullshit+文章标题\neg:bullshit 红红火火恍恍惚惚" 65 | await app.sendGroupMessage(group,MessageChain.create([Plain(help)])) 66 | 67 | elif message.asDisplay().startswith(config_info['key_word']) and group not in config_info['black_list'] and config_info['allow_use']: 68 | if Have_data: 69 | msg="" 70 | title=message.asDisplay()[config_info['content_start_pos']:] 71 | if config_info['text_length']: 72 | msg=generator(title,config_info['text_length']) 73 | else: 74 | msg=generator(title) 75 | await app.sendGroupMessage(group, MessageChain.create([Plain(msg)])) 76 | else: 77 | print('bullshit_generator:无词库文件,请检查词库文件之后重试') 78 | -------------------------------------------------------------------------------- /modules/explicit_detector/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sayu::Modules::ExplicitDetector 3 | 复读检查模块 4 | By GTY 5 | """ 6 | 7 | import json 8 | import os 9 | import random 10 | 11 | import requests 12 | 13 | from graia.application import Member 14 | from graia.application.message.elements.internal import At 15 | from graia.saya import Saya, Channel 16 | from graia.saya.builtins.broadcast.schema import ListenerSchema 17 | 18 | from graia.application.entry import Group, GroupMessage, Plain, MessageChain, GraiaMiraiApplication 19 | 20 | # 插件信息 21 | __name__ = "explicit_detector" 22 | __description__ = "脏话检测" 23 | __author__ = "GTY" 24 | __usage__ = "群内产生消息时,主动处理。" 25 | 26 | saya = Saya.current() 27 | channel = Channel.current() 28 | 29 | channel.name(__name__) 30 | channel.description(f"{__description__}\n使用方法:{__usage__}") 31 | channel.author(__author__) 32 | 33 | current_path = os.path.dirname(__file__) 34 | 35 | 36 | with open(current_path + '/warning_words_list.json', 'r', encoding='utf-8') as f: 37 | warning_words_list = json.load(f) 38 | 39 | 40 | def warn_dont_speak_explicitly(): 41 | return random.choice(warning_words_list) 42 | 43 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 44 | config = json.load(f) 45 | 46 | if config['should_use_local_exp_list']: 47 | 48 | exp_list = list() # 脏话列表 49 | 50 | ''' 51 | 请将脏话词库以json格式存储于同路径 exp_list.json 文件中 52 | json格式: 53 | { 54 | "data": [ 55 | "脏话1", 56 | "脏话2", 57 | ... 58 | ] 59 | } 60 | ''' 61 | 62 | with open(current_path + config['local_exp_list_dir'], 'r', encoding='utf-8') as f: 63 | exp_list = json.load(f)['data'] 64 | 65 | 66 | def is_exp_detected(ori: str): 67 | if config['should_use_local_exp_list']: # 使用本地列表 68 | for w in exp_list: 69 | if w in ori: 70 | return True 71 | return False 72 | else: # 使用云检测 73 | print(f'Sayu::Module::ExplicitDetector: Cloud Detect') 74 | url = config['cloud_api']['api'] # api 地址 75 | 76 | # 完整链接。包含字符串参数。 77 | full_url = f'{url}?{config["cloud_api"]["str_key"]}="{ori}"' 78 | 79 | response = requests.get(url=full_url) 80 | return str(response.text) == '1' 81 | 82 | 83 | 84 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 85 | async def exp_detector(app: GraiaMiraiApplication, group: Group, 86 | message: MessageChain, member: Member): 87 | 88 | if is_exp_detected(message.asDisplay()): 89 | msg_list = [ 90 | At(member.id), 91 | Plain(' '), 92 | Plain(warn_dont_speak_explicitly()) 93 | ] 94 | await app.sendGroupMessage(group, MessageChain.create(msg_list)) 95 | -------------------------------------------------------------------------------- /docs/环境基本配置.md: -------------------------------------------------------------------------------- 1 | # bot环境的基本配置 2 | 3 | **该教程叙述的是windows环境下的配置方法**,macos及linux下同理。 4 | 5 | ## 配置mirai相关环境 6 | 7 | ### 下载MCL一键安装包 8 | 9 | 首先下载[一键安装包](https://github.com/iTXTech/mcl-installer/releases),根据自己想要运行在的操作系统下载即可。windows操作系统下载对应的EXE文件即可(其他操作系统类同),在一个干净的目录下在**命令行**下运行,然后**一路回车即可**。 10 | 11 | ![image-20210902231404949.png](http://1.15.150.183:2333/images/2021/09/04/UsmmwHwIo1pgmvYO.png) 12 | 13 | enter退出 14 | 15 | ![image-20210902231404949.png](http://1.15.150.183:2333/images/2021/09/04/hCuE7kNrqxvXJfpu.png) 16 | 17 | ### 配置mirai插件 18 | 19 | 输入命令: 20 | 21 | ```bash 22 | .\mcl --update-package net.mamoe:mirai-console --channel stable --version 2.5.0 23 | ``` 24 | 25 | 由于最新版本的mirai-console存在兼容性问题,因此我们指定该版本的mirai-console 26 | 27 | ![image-20210902231832133.png](http://1.15.150.183:2333/images/2021/09/04/3pMao82jYm3NKkHk.png) 28 | 29 | 接着输入命令,使用最新版的mah: 30 | 31 | ```bash 32 | .\mcl --update-package net.mamoe:mirai-api-http --channel stable --type plugin 33 | ``` 34 | 35 | ![image-20210902231946565.png](http://1.15.150.183:2333/images/2021/09/04/qGFf5xF7r1Kqqg6D.png) 36 | 37 | 接着输入命令: 38 | 39 | ```bash 40 | .\mcl 41 | ``` 42 | 43 | 会加载一系列东西,等待即可,到此界面后输入exit退出 44 | 45 | ```bash 46 | exit 47 | ``` 48 | 49 | ![image-20210902232127480.png](http://1.15.150.183:2333/images/2021/09/04/QkV6rCOkaivT4ydB.png) 50 | 51 | ![image-20210902232156375.png](http://1.15.150.183:2333/images/2021/09/04/mrfgVc3SmIo96OSr.png) 52 | 53 | ### 修改配置文件实现自动登录 54 | 55 | 找到该文件: 56 | 57 | ![image-20210902232415786.png](http://1.15.150.183:2333/images/2021/09/04/qwD79QOYD92SdEEX.png) 58 | 59 | ![image-20210902232607131.png](http://1.15.150.183:2333/images/2021/09/04/1WxYkRFi4xE6lFdF.png) 60 | 61 | ![image-20210902232620315.png](http://1.15.150.183:2333/images/2021/09/04/9Do65iqYR7vFRUJg.png) 62 | 63 | 修改为自己要登陆的qq号的账号密码: 64 | 65 | ![image-20210902232701165.png](http://1.15.150.183:2333/images/2021/09/04/R1WGyx7pwJjmMDPR.png) 66 | 67 | 保存该文件后再次通过 68 | 69 | ```bash 70 | .\mcl 71 | ``` 72 | 73 | 运行,该过程中会要求验证等操作: 74 | 75 | ![image-20210902232836610.png](http://1.15.150.183:2333/images/2021/09/04/Ckxuw9x0SZoYsjH0.png) 76 | 77 | 验证失败参考如下解决方案: 78 | 79 | ![QQ图片20210904141229.png](http://1.15.150.183:2333/images/2021/09/04/eYpQGn80z0DUlC24.png) 80 | 81 | 验证完成后即可登录成功,可以看到该号收到的消息,需要注意**该控制台不能关闭** 82 | 83 | ![image-20210902233235793.png](http://1.15.150.183:2333/images/2021/09/04/mdNFETfu60J7eePY.png) 84 | 85 | ## 配置python graia环境 86 | 87 | 安装python(版本尽量高一些) 88 | 89 | 通过pip安装: 90 | 91 | ```bash 92 | pip install graia-application-mirai==0.19.0 93 | pip install graia-saya==0.0.8 94 | ``` 95 | 96 | 修改`examples/bot.py`文件中两处分别为 97 | 98 | ![image-20210902233912998.png](http://1.15.150.183:2333/images/2021/09/04/6twK5XBNrx3HxesL.png) 99 | 100 | ![image-20210902234003975.png](http://1.15.150.183:2333/images/2021/09/04/vQJf5DnxECVbZwgw.png) 101 | 102 | 和自己要登录的QQ号 103 | 104 | 成功运行后将会出现聊天记录: 105 | 106 | ![image-20210902234127958.png](http://1.15.150.183:2333/images/2021/09/04/M7Azo6Wgr88slScS.png) 107 | 108 | 此时在bot所在的某个群聊中可以正确触发"还活着"功能,表示配置成功 109 | 110 | ![image-20210902234231718.png](http://1.15.150.183:2333/images/2021/09/04/rRjSUO6IL59t3xgT.png) 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /modules/check_name_format/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | from graia.saya import Saya, Channel 5 | from graia.saya.builtins.broadcast.schema import ListenerSchema 6 | 7 | from graia.application.entry import Group, GroupMessage, Member, At, Plain, MessageChain, GraiaMiraiApplication 8 | from graia.application.group import MemberPerm 9 | 10 | import re 11 | 12 | # 插件信息 13 | __name__ = "check_name_format" 14 | __description__ = "检查群名片" 15 | __author__ = "mqj" 16 | __usage__ = "在群内接收配置文件中的口令后@出群名片格式不对的成员" 17 | 18 | saya = Saya.current() 19 | channel = Channel.current() 20 | 21 | channel.name(__name__) 22 | channel.description(f"{__description__}\n使用方法:{__usage__}") 23 | channel.author(__author__) 24 | 25 | config_info = {} 26 | 27 | current_path = os.path.dirname(__file__) 28 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 29 | config_info = json.load(f) 30 | 31 | 32 | def check_name_format_inner_get_reg_ex(strategy): 33 | # 判断是否匹配的正则表达式 34 | reg_ex = '^' + strategy['stu-years'] + '5[0-9]{4}\-(信(01' 35 | # 班号(感觉有点笨) 36 | for num in range(2, strategy['class-num'] + 1): 37 | reg_ex = reg_ex + '|' 38 | if num < 10: 39 | reg_ex = reg_ex + '0' 40 | reg_ex = reg_ex + str(num) 41 | # 专业 42 | reg_ex = reg_ex + ')' 43 | for major in strategy['major-list']: 44 | reg_ex = reg_ex + '|' + major 45 | # 姓名 46 | reg_ex = reg_ex + ")\-[\u4E00-\u9FFF" 47 | for ch in strategy['special-ch']: # 姓名中可能包含的特殊字符 48 | reg_ex = reg_ex + ch 49 | reg_ex = reg_ex + "]+$" 50 | return reg_ex 51 | 52 | 53 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 54 | async def check_name_format(app: GraiaMiraiApplication, message: MessageChain, 55 | group: Group, member: Member): 56 | if str(group.id) in config_info['groups-enabled'].keys(): 57 | # 判断群组权限 58 | strategy = config_info['default-strategy'] 59 | if not config_info['groups-enabled'][str(group.id)]['use-default-strategy']: 60 | strategy = config_info['groups-enabled'][str(group.id)]['strategy'] 61 | if message.asDisplay() == strategy['ask']: 62 | # 判断群员权限 63 | if strategy['permission'] == 'All' or\ 64 | (strategy['permission'] == 'Owner-Admin' and member.permission != MemberPerm.Member) or\ 65 | (strategy['permission'] == 'Owner' and member.permission == MemberPerm.Owner): 66 | reg_ex = check_name_format_inner_get_reg_ex(strategy) 67 | msg = [Plain(strategy['top-prompt'])] 68 | msg.append(Plain("\n")) 69 | memlist = await app.memberList(group) 70 | for mem in memlist: 71 | # 白名单检查 72 | if mem.id in strategy['white-list']: 73 | continue 74 | if not re.match(reg_ex, mem.name): 75 | if strategy['should-at']: 76 | msg.append(At(mem.id)) 77 | else: 78 | msg.append(Plain(mem.name)) 79 | msg.append(Plain("\n")) 80 | msg.append(Plain(strategy['bottom-prompt'])) 81 | await app.sendGroupMessage(group, MessageChain.create(msg)) 82 | -------------------------------------------------------------------------------- /modules/translation/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | from graia.saya import Saya, Channel 5 | from graia.saya.builtins.broadcast.schema import ListenerSchema 6 | 7 | from graia.application import GraiaMiraiApplication 8 | from graia.application.message.chain import MessageChain 9 | 10 | from graia.application.message.elements.internal import Plain 11 | from graia.application.entry import Friend, Group, Member, FriendMessage, GroupMessage, At 12 | 13 | 14 | from googletrans import Translator 15 | 16 | # 插件信息 17 | __name__ = "translation" 18 | __description__ = "翻译" 19 | __author__ = "da-qing-wa" 20 | __usage__ = "在群内发送trans to xx xxxxx" 21 | 22 | saya = Saya.current() 23 | channel = Channel.current() 24 | 25 | channel.name(__name__) 26 | channel.description(f"{__description__}\n使用方法:{__usage__}") 27 | channel.author(__author__) 28 | 29 | config_info = {} 30 | current_path = os.path.dirname(__file__) 31 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 32 | config_info = json.load(f) 33 | 34 | 35 | translator = Translator(service_urls=[config_info['url']]) 36 | # str_min_len是“trans to xx ”的长度,小于该长度时不触发。 37 | str_min_len = len(config_info['key_word'][0]) + config_info['choice_len'] + 1 38 | 39 | 40 | translator = Translator(service_urls=[config_info['url']]) 41 | 42 | 43 | 44 | # trans help 45 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 46 | async def trans_help(app: GraiaMiraiApplication, message: MessageChain, group: Group): 47 | if message.asDisplay() == config_info['key_word'][1] \ 48 | and group.id not in config_info['black_list'] \ 49 | and config_info['allow_use']: 50 | str = "trans功能支持翻译成以下语言:" 51 | for choice in config_info['choice']: 52 | str += "\n" + choice + " - " + config_info['choice'][choice] 53 | str += "\n格式为 trans to xx hello" 54 | await app.sendGroupMessage(group, MessageChain.create([Plain(str)])) 55 | 56 | 57 | # translation 58 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 59 | async def trans(app: GraiaMiraiApplication, message: MessageChain, group: Group): 60 | if message.asDisplay().startswith(config_info['key_word'][0]) \ 61 | and len(message.asDisplay()) > str_min_len \ 62 | and group.id not in config_info['black_list'] \ 63 | and config_info['allow_use']: 64 | choice = message.asDisplay()[len(config_info['key_word'][0]):len(config_info['key_word'][0]) + config_info['choice_len']] 65 | str = "" 66 | # 翻成中文 67 | if choice == 'ch': 68 | str += "翻译结果为:\n" 69 | # +1是因为还要跳过一个空格 70 | str += translator.translate(message.asDisplay()[len(config_info['key_word'][0]) + config_info['choice_len'] + 1:], dest='zh-CN').text 71 | # 翻成其他语言 72 | elif choice in config_info['choice'] \ 73 | and message.asDisplay()[len(config_info['key_word'][0]) + config_info['choice_len']] == ' ': 74 | str += "翻译结果为:\n" 75 | # +1是因为还要跳过一个空格 76 | str += translator.translate(message.asDisplay()[len(config_info['key_word'][0]) + config_info['choice_len'] + 1:], dest=choice).text 77 | else: 78 | str += "不支持这种语言噢,换一种试试叭!" 79 | await app.sendGroupMessage(group, MessageChain.create([Plain(str)])) 80 | -------------------------------------------------------------------------------- /modules/self_mute/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | from graia.application.message.elements.internal import At 5 | from graia.saya import Saya, Channel 6 | from graia.saya.builtins.broadcast.schema import ListenerSchema 7 | 8 | from graia.application.entry import Group, Member, GroupMessage, Plain, MessageChain, GraiaMiraiApplication 9 | from graia.application.group import MemberPerm 10 | 11 | import re 12 | 13 | # 插件信息 14 | __name__ = "self_mute" 15 | __description__ = "自助禁言" 16 | __author__ = "MoonKuun" 17 | __usage__ = "在群内发送配置文件中的触发指令和禁言时间" 18 | 19 | saya = Saya.current() 20 | channel = Channel.current() 21 | 22 | channel.name(__name__) 23 | channel.description(f"{__description__}\n使用方法:{__usage__}") 24 | channel.author(__author__) 25 | 26 | current_path = os.path.dirname(__file__) 27 | 28 | config_info = {} 29 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 30 | config_info = json.load(f) 31 | 32 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 33 | async def self_mute(app: GraiaMiraiApplication, message: MessageChain, 34 | group: Group, member: Member): 35 | if str(group.id) in config_info['groups-enabled'].keys(): 36 | strategy = config_info['default-strategy'] 37 | if not config_info['groups-enabled'][str(group.id)]['use-default-strategy']: 38 | strategy = config_info['groups-enabled'][str(group.id)]['strategy'] 39 | 40 | reg_exr = '^' + strategy['ask'] + ' *?(\d+|\d+\.\d+) *?(d|天|h|min|s|小时|分钟|秒)$' 41 | match_list = re.findall(reg_exr, message.asDisplay()) 42 | if not len(match_list) == 0: 43 | #判断群成员权限 44 | if member.permission == MemberPerm.Member: 45 | #判断机器人权限 46 | if group.accountPerm == MemberPerm.Owner or group.accountPerm == MemberPerm.Administrator: 47 | #计算禁言时长 48 | time_str = match_list[0][0] 49 | time_unit = match_list[0][1] 50 | second = 0 51 | if time_unit == 'd' or time_unit == '天': 52 | second = int(float(time_str) * 24 * 60 * 60) 53 | elif time_unit == 'h' or time_unit == '小时': 54 | second = int(float(time_str) * 60 * 60) 55 | elif time_unit == 'min' or time_unit == '分钟': 56 | second = int(float(time_str) * 60) 57 | elif time_unit == 's' or time_unit == '秒': 58 | second = int(float(time_str)) 59 | 60 | #禁言时间超上限取上限 61 | if second > 30 * 24 * 60 * 60: 62 | second = 30 * 24 * 60 * 60 63 | await app.mute(group, member.id, second) 64 | await app.sendGroupMessage(group, MessageChain.create([At(member.id), Plain(' ' + strategy['over-range-message'])])) 65 | else: 66 | await app.mute(group, member.id, second) 67 | await app.sendGroupMessage(group, MessageChain.create([At(member.id), Plain(' ' + strategy['success-message'])])) 68 | else: 69 | await app.sendGroupMessage(group, MessageChain.create([At(member.id), Plain(' ' + strategy['bot-no-permission-message'])])) 70 | else: 71 | await app.sendGroupMessage(group, MessageChain.create([At(member.id), Plain(' ' + strategy['target-not-member-message'])])) 72 | -------------------------------------------------------------------------------- /modules/recall_detector/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sayu::Modules::RecallDetector 3 | 小坚果撤回检测模块 4 | By GTY 5 | """ 6 | 7 | import json 8 | import os 9 | import random 10 | 11 | from graia.application import Member 12 | from graia.application.event.mirai import GroupRecallEvent 13 | from graia.application.message.elements.internal import At 14 | from graia.saya import Saya, Channel 15 | from graia.saya.builtins.broadcast.schema import ListenerSchema 16 | 17 | from graia.application.entry import Group, GroupMessage, Plain, MessageChain, GraiaMiraiApplication 18 | 19 | # 插件信息 20 | __name__ = "recall_detector" 21 | __description__ = "检测群消息撤回,并给予处理。" 22 | __author__ = "GTY" 23 | __usage__ = "群消息主动检测" 24 | 25 | saya = Saya.current() 26 | channel = Channel.current() 27 | 28 | channel.name(__name__) 29 | channel.description(f"{__description__}\n使用方法:{__usage__}") 30 | channel.author(__author__) 31 | 32 | config_info = {} 33 | # 打开配置文件 34 | current_path = os.path.dirname(__file__) 35 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 36 | config_info = json.load(f) 37 | 38 | user_record = dict() 39 | try: 40 | with open(current_path + '/user_record.json', 'r', encoding='utf-8') as f: 41 | user_record = json.load(f) 42 | except FileNotFoundError: 43 | pass 44 | 45 | 46 | def save_user_record(): 47 | with open(current_path + '/user_record.json', 'w', encoding='utf-8') as f: 48 | json.dump(user_record, f) 49 | 50 | 51 | @channel.use(ListenerSchema(listening_events=[GroupRecallEvent])) 52 | async def recall_detector(app: GraiaMiraiApplication, group: Group, member: Member): 53 | print(f'Sayu::RecallDetector: recall detected: {group.name}, {member.name}') 54 | if str(group.id) in config_info['group_enabled'].keys(): 55 | # 已在该群启用撤回检测 56 | print(f'Sayu::RecallDetector: enabled') 57 | strategy = config_info['default_strategy'] # 先加载默认策略 58 | if not config_info['group_enabled'][str(group.id)]['should_use_default_strategy']: 59 | strategy = config_info['group_enabled'][str(group.id)]['strategy'] # 加载特有的策略 60 | if int(member.id) in strategy['ignore_members']: 61 | # 忽略该用户 62 | return 63 | if strategy['should_count']: 64 | # 需要统计复读次数 65 | 66 | if not str(member.id) in user_record.keys(): 67 | # 该用户无”前科“ 68 | print(f'Sayu::RecallDetector: {member.id} added to keys') 69 | obj = dict() 70 | user_record[str(member.id)] = obj 71 | 72 | print(f'Sayu::RecallDetector::Debug: rec = {user_record}') 73 | 74 | if not str(group.id) in user_record[str(member.id)].keys(): 75 | # 未在该群撤回过 76 | user_record[str(member.id)][str(group.id)] = 0 77 | 78 | user_record[str(member.id)][str(group.id)] += 1 # 记录本次复读 79 | 80 | save_user_record() 81 | 82 | if strategy['should_mute']: 83 | # 应该禁言 84 | await app.mute(group, member, strategy['mute_time_sec']) 85 | 86 | if strategy['should_warn']: 87 | msg = [ 88 | At(member.id), 89 | Plain(' '), 90 | Plain(random.choice(strategy['warning_words'])) 91 | ] 92 | 93 | if strategy['should_warn_with_count']: 94 | msg.append(Plain(f'这是你在本群第{user_record[str(member.id)][str(group.id)]}次撤回消息..')) 95 | 96 | await app.sendGroupMessage(group, MessageChain.create(msg)) 97 | -------------------------------------------------------------------------------- /modules/c++compiler/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import re 4 | 5 | from graia.saya import Saya, Channel 6 | from graia.saya.builtins.broadcast.schema import ListenerSchema 7 | 8 | from graia.application import GraiaMiraiApplication 9 | from graia.application.message.chain import MessageChain 10 | 11 | from graia.application.message.elements.internal import Plain 12 | from graia.application.entry import Friend, Group, Member, FriendMessage, GroupMessage, At 13 | 14 | import requests 15 | # 插件信息 16 | __name__ = "c++_online_compiler" 17 | __description__ = "c++在线编译" 18 | __author__ = "Tinyyu433" 19 | __usage__ = "在群内发送c++ xxxxx" 20 | 21 | saya = Saya.current() 22 | channel = Channel.current() 23 | 24 | channel.name(__name__) 25 | channel.description(f"{__description__}\n使用方法:{__usage__}") 26 | channel.author(__author__) 27 | 28 | config_info = {} 29 | current_path = os.path.dirname(__file__) 30 | with open(current_path + '/config.json', 'r', encoding='utf-8') as f: 31 | config_info = json.load(f) 32 | 33 | def count_and_cut_str_line(str): 34 | count=0 35 | new_str=str 36 | if_out=0 37 | for i in range(len(str)): 38 | if str[i]=='\n': 39 | count+=1 40 | if count >= 20: 41 | if_out=1 42 | new_str=str[:i] 43 | break 44 | ret=[if_out,new_str] 45 | return ret 46 | 47 | 48 | # c++ help 49 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 50 | async def cpp_help(app: GraiaMiraiApplication, message: MessageChain, group: Group,member: Member): 51 | if message.asDisplay() == config_info['key_word'][1] \ 52 | and group.id not in config_info['black_list'] \ 53 | and config_info['allow_use']: 54 | str = config_info['help_tip'] 55 | if message.asDisplay() == config_info['key_word'][2] \ 56 | and group.id not in config_info['black_list'] \ 57 | and config_info['allow_use']: 58 | str = config_info['c++_eg'] 59 | await app.sendGroupMessage(group, MessageChain.create([At(member.id),Plain(str)])) 60 | 61 | # c++ compiler 62 | @channel.use(ListenerSchema(listening_events=[GroupMessage])) 63 | async def cpp_compiler(app: GraiaMiraiApplication, message: MessageChain, group: Group,member: Member): 64 | if message.asDisplay().startswith(config_info['key_word'][0]) \ 65 | and message.asDisplay()!=config_info['key_word'][1]\ 66 | and message.asDisplay()!=config_info['key_word'][2]\ 67 | and group.id not in config_info['black_list'] \ 68 | and config_info['allow_use']: 69 | url = config_info["url"] 70 | data = json.dumps({ 71 | "code":message.asDisplay()[len(config_info['key_word'][0])+1:], 72 | "stdin":(re.findall(r"//\s?StdInput\s?([\w\s]+)\n?",message.asDisplay())[0]) if re.findall(r"//\s?StdInput\s?([\w\s]+)\n?",message.asDisplay()).__len__()!=0 else '', 73 | "options": config_info["data_options"], 74 | "compiler": config_info["data_compiler"], 75 | "compiler-option-raw": config_info["data_compiler-option-raw"], 76 | }) 77 | headers = {'Content-Type': config_info["data_Content-Type"]} 78 | r_json = requests.request("POST", url, headers=headers,data = data) 79 | res=r_json.json() 80 | if "compiler_error" in res.keys(): 81 | resp=(("编译错啦,仔细检查哦\n"+res["compiler_error"])) 82 | else: 83 | resp= "\n编译成功" 84 | if "program_output" in res.keys(): 85 | ret=count_and_cut_str_line(res["program_output"]) 86 | if ret[0]: 87 | resp+=",但是我怀疑你在刷屏啊?!只给你前20行吧\n" 88 | else: 89 | resp += ",输出为:\n" 90 | resp+=ret[1] 91 | await app.sendGroupMessage(group, MessageChain.create([At(member.id),Plain(resp)])) 92 | 93 | -------------------------------------------------------------------------------- /modules/bullshit_generator/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "title":"学生会退会", 3 | "famous":[ 4 | "爱迪生a,天才是百分之一的勤奋加百分之九十九的汗水。b", 5 | "查尔斯·史a,一个人几乎可以在任何他怀有无限热忱的事情上成功。b", 6 | "培根说过,深窥自己的心,而后发觉一切的奇迹在你自己。b", 7 | "歌德曾经a,流水在碰到底处时才会释放活力。b", 8 | "莎士比亚a,那脑袋里的智慧,就像打火石里的火花一样,不去打它是不肯出来的。b", 9 | "戴尔·卡耐基a,多数人都拥有自己不了解的能力和机会,都有可能做到未曾梦想的事情。b", 10 | "白哲特a,坚强的信念能赢得强者的心,并使他们变得更坚强。b", 11 | "伏尔泰a, 不经巨大的困难,不会有伟大的事业。b", 12 | "富勒曾经a, 苦难磨炼一些人,也毁灭另一些人。b", 13 | "文森特·皮尔a, 改变你的想法,你就改变了自己的世界。b", 14 | "拿破仑·希尔a, 不要等待,时机永远不会恰到好处。b", 15 | "塞涅卡a, 生命如同寓言,其价值不在与长短,而在与内容。b", 16 | "奥普拉·温弗瑞a, 你相信什么,你就成为什么样的人。b", 17 | "吕凯特a, 生命不可能有两次,但许多人连一次也不善于度过。b", 18 | "莎士比亚a, 人的一生是短的,但如果卑劣地过这一生,就太长了。b", 19 | "笛卡儿a, 我的努力求学没有得到别的好处,只不过是愈来愈发觉自己的无知。b", 20 | "左拉a, 生活的道路一旦选定,就要勇敢地走到底,决不回头。b", 21 | "米歇潘a, 生命是一条艰险的峡谷,只有勇敢的人才能通过。b", 22 | "吉姆·罗恩a, 要么你主宰生活,要么你被生活主宰。b", 23 | "日本谚语a, 不幸可能成为通向幸福的桥梁。b", 24 | "海贝尔a, 人生就是学校。在那里,与其说好的教师是幸福,不如说好的教师是不幸。b", 25 | "杰纳勒尔·乔治·S·巴顿a, 接受挑战,就可以享受胜利的喜悦。b", 26 | "德谟克利特a, 节制使快乐增加并使享受加强。b", 27 | "裴斯泰洛齐a, 今天应做的事没有做,明天再早也是耽误了。b", 28 | "歌德a, 决定一个人的一生,以及整个命运的,只是一瞬之间。b", 29 | "卡耐基a, 一个不注意小事情的人,永远不会成就大事业。b", 30 | "卢梭a, 浪费时间是一桩大罪过。b", 31 | "康德a, 既然我已经踏上这条道路,那么,任何东西都不应妨碍我沿着这条路走下去。b", 32 | "克劳斯·莫瑟爵士a, 教育需要花费钱,而无知也是一样。b", 33 | "伏尔泰a, 坚持意志伟大的事业需要始终不渝的精神。b", 34 | "亚伯拉罕·林肯a, 你活了多少岁不算什么,重要的是你是如何度过这些岁月的。b", 35 | "韩非a, 内外相应,言行相称。b", 36 | "富兰克林a, 你热爱生命吗?那么别浪费时间,因为时间是组成生命的材料。b", 37 | "马尔顿a, 坚强的信心,能使平凡的人做出惊人的事业。b", 38 | "笛卡儿a, 读一切好书,就是和许多高尚的人谈话。b", 39 | "塞涅卡a, 真正的人生,只有在经过艰难卓绝的斗争之后才能实现。b", 40 | "易卜生a, 伟大的事业,需要决心,能力,组织和责任感。b", 41 | "歌德a, 没有人事先了解自己到底有多大的力量,直到他试过以后才知道。b", 42 | "达尔文a, 敢于浪费哪怕一个钟头时间的人,说明他还不懂得珍惜生命的全部价值。b", 43 | "佚名a, 感激每一个新的挑战,因为它会锻造你的意志和品格。b", 44 | "奥斯特洛夫斯基a, 共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 b", 45 | "苏轼a, 古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。b", 46 | "王阳明a, 故立志者,为学之心也;为学者,立志之事也。b", 47 | "歌德a, 读一本好书,就如同和一个高尚的人在交谈。b", 48 | "乌申斯基a, 学习是劳动,是充满思想的劳动。b", 49 | "别林斯基a, 好的书籍是最贵重的珍宝。b", 50 | "富兰克林a, 读书是易事,思索是难事,但两者缺一,便全无用处。b", 51 | "鲁巴金a, 读书是在别人思想的帮助下,建立起自己的思想。b", 52 | "培根a, 合理安排时间,就等于节约时间。b", 53 | "屠格涅夫a, 你想成为幸福的人吗?但愿你首先学会吃得起苦。b", 54 | "莎士比亚a, 抛弃时间的人,时间也抛弃他。b", 55 | "叔本华a, 普通人只想到如何度过时间,有才能的人设法利用时间。b", 56 | "博a, 一次失败,只是证明我们成功的决心还够坚强。 维b", 57 | "拉罗什夫科a, 取得成就时坚持不懈,要比遭到失败时顽强不屈更重要。b", 58 | "莎士比亚a, 人的一生是短的,但如果卑劣地过这一生,就太长了。b", 59 | "俾斯麦a, 失败是坚忍的最后考验。b", 60 | "池田大作a, 不要回避苦恼和困难,挺起身来向它挑战,进而克服它。b", 61 | "莎士比亚a, 那脑袋里的智慧,就像打火石里的火花一样,不去打它是不肯出来的。b", 62 | "希腊a, 最困难的事情就是认识自己。b", 63 | "黑塞a, 有勇气承担命运这才是英雄好汉。b", 64 | "非洲a, 最灵繁的人也看不见自己的背脊。b", 65 | "培根a, 阅读使人充实,会谈使人敏捷,写作使人精确。b", 66 | "斯宾诺莎a, 最大的骄傲于最大的自卑都表示心灵的最软弱无力。b", 67 | "西班牙a, 自知之明是最难得的知识。b", 68 | "塞内加a, 勇气通往天堂,怯懦通往地狱。b", 69 | "赫尔普斯a, 有时候读书是一种巧妙地避开思考的方法。b", 70 | "笛卡儿a, 阅读一切好书如同和过去最杰出的人谈话。b", 71 | "邓拓a, 越是没有本领的就越加自命不凡。b", 72 | "爱尔兰a, 越是无能的人,越喜欢挑剔别人的错儿。b", 73 | "老子a, 知人者智,自知者明。胜人者有力,自胜者强。b", 74 | "歌德a, 意志坚强的人能把世界放在手中像泥块一样任意揉捏。b", 75 | "迈克尔·F·斯特利a, 最具挑战性的挑战莫过于提升自我。b", 76 | "爱迪生a, 失败也是我需要的,它和成功对我一样有价值。b", 77 | "罗素·贝克a, 一个人即使已登上顶峰,也仍要自强不息。b", 78 | "马云a, 最大的挑战和突破在于用人,而用人最大的突破在于信任人。b", 79 | "雷锋a, 自己活着,就是为了使别人过得更美好。b", 80 | "布尔沃a, 要掌握书,莫被书掌握;要为生而读,莫为读而生。b", 81 | "培根a, 要知道对好事的称颂过于夸大,也会招来人们的反感轻蔑和嫉妒。b", 82 | "莫扎特a, 谁和我一样用功,谁就会和我一样成功。b", 83 | "马克思a, 一切节省,归根到底都归结为时间的节省。b", 84 | "莎士比亚a, 意志命运往往背道而驰,决心到最后会全部推倒。b", 85 | "卡莱尔a, 过去一切时代的精华尽在书中。b", 86 | "培根a, 深窥自己的心,而后发觉一切的奇迹在你自己。b", 87 | "罗曼·罗兰a, 只有把抱怨环境的心情,化为上进的力量,才是成功的保证。b", 88 | "孔子a, 知之者不如好之者,好之者不如乐之者。b", 89 | "达·芬奇a, 大胆和坚定的决心能够抵得上武器的精良。b", 90 | "叔本华a, 意志是一个强壮的盲人,倚靠在明眼的跛子肩上。b", 91 | "黑格尔a, 只有永远躺在泥坑里的人,才不会再掉进坑里。b", 92 | "普列姆昌德a, 希望的灯一旦熄灭,生活刹那间变成了一片黑暗。b", 93 | "维龙a, 要成功不需要什么特别的才能,只要把你能做的小事做得好就行了。b", 94 | "郭沫若a, 形成天才的决定因素应该是勤奋。b", 95 | "洛克a, 学到很多东西的诀窍,就是一下子不要学很多。b", 96 | "西班牙a, 自己的鞋子,自己知道紧在哪里。b", 97 | "拉罗什福科a, 我们唯一不会改正的缺点是软弱。b", 98 | "亚伯拉罕·林肯a, 我这个人走得很慢,但是我从不后退。b", 99 | "美华纳a, 勿问成功的秘诀为何,且尽全力做你应该做的事吧。b", 100 | "俾斯麦a, 对于不屈不挠的人来说,没有失败这回事。b", 101 | "阿卜·日·法拉兹a, 学问是异常珍贵的东西,从任何源泉吸收都不可耻。b", 102 | "白哲特a, 坚强的信念能赢得强者的心,并使他们变得更坚强。 b", 103 | "查尔斯·史考伯a, 一个人几乎可以在任何他怀有无限热忱的事情上成功。 b", 104 | "贝多芬a, 卓越的人一大优点是:在不利与艰难的遭遇里百折不饶。b", 105 | "莎士比亚a, 本来无望的事,大胆尝试,往往能成功。b", 106 | "卡耐基a, 我们若已接受最坏的,就再没有什么损失。b", 107 | "德国a, 只有在人群中间,才能认识自己。b", 108 | "史美尔斯a, 书籍把我们引入最美好的社会,使我们认识各个时代的伟大智者。b", 109 | "冯学峰a, 当一个人用工作去迎接光明,光明很快就会来照耀着他。b", 110 | "吉格·金克拉a, 如果你能做梦,你就能实现它。b" 111 | ], 112 | "bosh":[ 113 | "现在, 解决x的问题, 是非常非常重要的. 所以, ", 114 | "我们不得不面对一个非常尴尬的事实, 那就是, ", 115 | "x的发生, 到底需要如何做到, 不x的发生, 又会如何产生. ", 116 | "而这些并不是完全重要, 更加重要的问题是, ", 117 | "x, 到底应该如何实现. ", 118 | "带着这些问题, 我们来审视一下x. ", 119 | "所谓x, 关键是x需要如何写. ", 120 | "我们一般认为, 抓住了问题的关键, 其他一切则会迎刃而解.", 121 | "问题的关键究竟为何? ", 122 | "x因何而发生?", 123 | "每个人都不得不面对这些问题. 在面对这种问题时, ", 124 | "一般来讲, 我们都必须务必慎重的考虑考虑. ", 125 | "要想清楚, x, 到底是一种怎么样的存在. ", 126 | "了解清楚x到底是一种怎么样的存在, 是解决一切问题的关键.", 127 | "就我个人来说, x对我的意义, 不能不说非常重大. ", 128 | "本人也是经过了深思熟虑,在每个日日夜夜思考这个问题. ", 129 | "x, 发生了会如何, 不发生又会如何. ", 130 | "在这种困难的抉择下, 本人思来想去, 寝食难安.", 131 | "生活中, 若x出现了, 我们就不得不考虑它出现了的事实. ", 132 | "这种事实对本人来说意义重大, 相信对这个世界也是有一定意义的.", 133 | "我们都知道, 只要有意义, 那么就必须慎重考虑.", 134 | "既然如此, ", 135 | "那么, ", 136 | "我认为, ", 137 | "一般来说, ", 138 | "总结的来说, ", 139 | "既然如何, ", 140 | "经过上述讨论, ", 141 | "这样看来, ", 142 | "从这个角度来看, ", 143 | "我们不妨可以这样来想: ", 144 | "这是不可避免的. ", 145 | "可是,即使是这样,x的出现仍然代表了一定的意义. ", 146 | "x似乎是一种巧合,但如果我们从一个更大的角度看待问题,这似乎是一种不可避免的事实. ", 147 | "在这种不可避免的冲突下,我们必须解决这个问题. ", 148 | "对我个人而言,x不仅仅是一个重大的事件,还可能会改变我的人生. " 149 | ], 150 | "after":[ 151 | "这不禁令我深思. ", 152 | "带着这句话, 我们还要更加慎重的审视这个问题: ", 153 | "这启发了我. ", 154 | "我希望诸位也能好好地体会这句话. ", 155 | "这句话语虽然很短, 但令我浮想联翩. ", 156 | "这句话看似简单,但其中的阴郁不禁让人深思. ", 157 | "这句话把我们带到了一个新的维度去思考这个问题: ", 158 | "这似乎解答了我的疑惑. " 159 | ], 160 | "before":[ 161 | "曾经说过", 162 | "在不经意间这样说过", 163 | "说过一句著名的话", 164 | "曾经提到过", 165 | "说过一句富有哲理的话" 166 | ] 167 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------