├── AnswerBook.lua ├── AutoSelect.lua ├── LICENSE ├── README.md ├── bandori.lua ├── hitokoto.lua ├── mc-checker.sh ├── mcFinder.lua └── weather.lua /AnswerBook.lua: -------------------------------------------------------------------------------- 1 | local log = require("log") 2 | local Api = require("coreApi") 3 | local json = require("json") 4 | local http = require("http") 5 | 6 | arr = { 7 | "找个人给你意见", 8 | "算了吧", 9 | "请教你的妈妈", 10 | "当然咯", 11 | "谁说得准呢,先观望着", 12 | "千万别傻", 13 | "保持你的好奇心,去挖掘真相", 14 | "把心揣怀里", 15 | "答案在镜子里", 16 | "不","这事儿不靠谱", 17 | "天上要掉馅饼了", 18 | "有好运","要有耐心", 19 | "你需要知道真相", 20 | "还有另一种情况", 21 | "观望", 22 | "别让它影响到你", 23 | "是","信任", 24 | "列个清单", 25 | "时机不对", 26 | "照你想的那样去做", 27 | "量力而行", 28 | "但行好事,莫问前程", 29 | "抛弃首选方案", 30 | "走容易走的路", 31 | "最佳方案不一定可行", 32 | "不会作就不会死", 33 | "试试卖萌", 34 | "借助他人的经验", 35 | "再多考虑", 36 | "注意细节", 37 | "说出来吧", 38 | "不要犹豫", 39 | "机会稍纵即逝", 40 | "制订了一个新计划", 41 | "GO", 42 | "谁都不能保证", 43 | "情况很快就会发生变化", 44 | "不要陷得太深", 45 | "转移你的注意力", 46 | "至关重要", 47 | "告诉自己什么是最重要的", 48 | "为什么不", 49 | "别傻等了", 50 | "不要忘记", 51 | "为什么不呢", 52 | "去解决", 53 | "寻找更多的选择", 54 | "上帝为你关一扇门,必定会为你打开一扇窗", 55 | "随波逐流未必是好事", 56 | "问天问大地,不如问自己", 57 | "你就是答案", 58 | "去争取机会", 59 | "改变不了世界,改变自己", 60 | "主动一点,人生会大不相同", 61 | "学会妥协","掌握更多信息", 62 | "相信你最初的想法", 63 | "勿忘初心,放得始终", 64 | "扫除障碍","把重心放在工作/学习上", 65 | "培养一项新的爱好", 66 | "对他人慷慨", 67 | "不放赌一把", 68 | "去做其他的事情", 69 | "观察形势", 70 | "休息,休息一会", 71 | "这是你最后的机会", 72 | "再考虑一下", 73 | "并不明智", 74 | "等待更好的", 75 | "很快就能解决", 76 | "重要","是的", 77 | "采取行动","去做", 78 | "不要过火", 79 | "事情开始变得有趣了", 80 | "保存你的实力", 81 | "这是一定的", 82 | "不确定的因素有点多", 83 | "结果不错", 84 | "你可能不得不放弃其他东西", 85 | "不要犹豫", 86 | "不需要", 87 | "去倾诉", 88 | "告诉别人这对你意味着什么", 89 | "无论你做何种选择,结果都是对的", 90 | "保持头脑清醒", 91 | "制定计划", 92 | "很麻烦", 93 | "克服困难", 94 | "实际一点", 95 | "你需要一点帮助", 96 | "协作", 97 | "需找更多的选择", 98 | "负责", 99 | "阻止", 100 | "你必须现在就行动", 101 | "遵守规则", 102 | "坚持", 103 | "你不会失望的", 104 | "需要花费点时间", 105 | "不要迫于压力而改变初衷", 106 | "显而易见", 107 | "不雅忽略身边的人", 108 | "抗拒", 109 | "不值得斗争", 110 | "玩得开心就好", 111 | "毋庸置疑", 112 | "你也许会失望", 113 | "去改变", 114 | "一个强有力的承诺会换回更好的结果", 115 | "也许有更好的解决方案", 116 | "不要害怕", 117 | "想法太多,选择太少", 118 | "是的", 119 | "一笑而过", 120 | "取决于你的选择", 121 | "随TA去","你需要考虑其他方面", 122 | "一年后就不那么重要了", 123 | "醒醒吧,别做梦了", 124 | "意义非凡", 125 | "默数十秒再问我", 126 | "去行动", 127 | "发挥你的想象力", 128 | "对的", 129 | "为了确保最好的结果,保持冷静", 130 | "等待", 131 | "你必须弥补这个缺点", 132 | "你会后悔的", 133 | "毫无疑问", 134 | "当然", 135 | "现在比以往任何时候的情况都要好", 136 | "相信你的直觉", 137 | "这是一个机会", 138 | "去问你爸爸", 139 | "从来没有", 140 | "寻找一个指路人", 141 | "去尝试", 142 | "没有", 143 | "错的", 144 | "别不自量力", 145 | "荒谬", 146 | "不赌", 147 | "不值得冒险", 148 | "不妥协", 149 | "关注你的家庭生活", 150 | "肯定", 151 | "不可预测", 152 | "绝对不", 153 | "我确定", 154 | "尽早完成", 155 | "令人期待的事情马上要发生", 156 | "你需要适应", 157 | "表示怀疑", 158 | "它会带来好运", 159 | "要有耐心", 160 | "看看会发生什么", 161 | "记录下来", 162 | "不宜在这个时候", 163 | "决定了就去做", 164 | "别要求太多", 165 | "放弃第一个方案", 166 | "HOLD不住", 167 | "谨慎小心", 168 | "注意细节", 169 | "注意身后", 170 | "不要犹豫", 171 | "继续前进", 172 | "情况很快就会发生改变", 173 | "不要被情绪左右", 174 | "转移注意力", 175 | "着眼未来", 176 | "问自己什么是最重要的", 177 | "不要等了", 178 | "保持乐观", 179 | "没有更好的选择", 180 | "列出原因", 181 | "抓住机会", 182 | "改变自己", 183 | "你需要主动", 184 | "妥协", 185 | "有比这更重要的东西", 186 | "你需要掌握更多的信息", 187 | "删除记忆", 188 | "能让你快乐的那个决定", 189 | "你需要考虑其他方面", 190 | "你会后悔的", 191 | "毫无疑问", 192 | "当然", 193 | "相信自己的直觉", 194 | "这是一个机会", 195 | "形势不明", 196 | "先让自己休息", 197 | "重新考虑", 198 | "不明智", 199 | "抓住机会", 200 | "等待机会", 201 | "不要做得太过分", 202 | "保持现状", 203 | "不要忧虑", 204 | "有意料之外的事会发生,不妨等待", 205 | "你会失望的", 206 | "花更多的时间来决定", 207 | "你开心就好" 208 | } 209 | 210 | function ReceiveGroupMsg(CurrentQQ, data) 211 | if data.FromUserId ==2126622797 then--防止自我复读 212 | return 1 end 213 | if string.find(data.Content, "!答案之书") == 1 or string.find(data.Content, "!答案之书") == 1 then 214 | if(string.find(data.Content, "!") == 1) then 215 | key = data.Content:gsub("!答案之书", "") 216 | elseif(string.find(data.Content, "!") == 1) then 217 | key = data.Content:gsub("!答案之书", "") 218 | end 219 | if(key ~= "") then 220 | text = arr[math.random(table.getn(arr))] 221 | SetMessage(CurrentQQ,data,text) 222 | else 223 | text = "答案之书无法给出答案" 224 | SetMessage(CurrentQQ,data,text) 225 | end 226 | end 227 | return 1 228 | end 229 | 230 | function SetMessage(CurrentQQ,data,text) 231 | luaMsg = 232 | Api.Api_SendMsg(--调用发消息的接口 233 | CurrentQQ, 234 | { 235 | toUser = data.FromGroupId, --回复当前消息的来源群ID 236 | sendToType = 2, --2发送给群1发送给好友3私聊 237 | sendMsgType = "TextMsg", --进行文本复读回复 238 | groupid = 0, --不是私聊自然就为0咯 239 | content = "[ATUSER("..data.FromUserId..")]\n" .. text 240 | } 241 | ) 242 | return 1 243 | end 244 | function ReceiveEvents(CurrentQQ, data, extData) 245 | return 1 246 | end -------------------------------------------------------------------------------- /AutoSelect.lua: -------------------------------------------------------------------------------- 1 | local log = require("log") 2 | local Api = require("coreApi") 3 | local json = require("json") 4 | local http = require("http") 5 | 6 | function ReceiveFriendMsg(CurrentQQ, data) 7 | return 1 8 | end 9 | function ReceiveGroupMsg(CurrentQQ, data) 10 | if data.FromUin ==2126622797 then--防止自我复读 11 | return 1 end 12 | if(string.find(data.Content, "!") == 1) then 13 | rowkey = data.Content:gsub("!", "") 14 | elseif(string.find(data.Content, "!") == 1) then 15 | rowkey = data.Content:gsub("!", "") 16 | else 17 | return 1 18 | end 19 | if(string.find(rowkey, "还是") ~= nil) then 20 | key = string.split(rowkey, "还是") 21 | text = key[math.random(table.getn(key))] 22 | elseif(string.find(rowkey, " or ") ~= nil) then 23 | key = string.split(rowkey, " or ") 24 | text = key[math.random(table.getn(key))] 25 | else 26 | return 1 27 | end 28 | if(text ~= "") then 29 | msg = "建议你选择:" .. text .. "" 30 | else 31 | msg = "找不到选择项\n![选项1]还是[选项2]" 32 | end 33 | ApiRet = 34 | Api.Api_SendMsg( 35 | CurrentQQ, 36 | { 37 | toUser = data.FromGroupId, 38 | sendToType = 2, 39 | sendMsgType = "TextMsg", 40 | groupid = 0, 41 | content = msg, 42 | atUser = 0 43 | } 44 | ) 45 | msg = nil 46 | text = nil 47 | return 1 48 | end 49 | function ReceiveEvents(CurrentQQ, data, extData) 50 | return 1 51 | end 52 | 53 | function string.split(input, delimiter) 54 | input = tostring(input) 55 | delimiter = tostring(delimiter) 56 | if (delimiter=='') then return false end 57 | local pos,arr = 0, {} 58 | -- for each divider found 59 | for st,sp in function() return string.find(input, delimiter, pos, true) end do 60 | table.insert(arr, string.sub(input, pos, st - 1)) 61 | pos = sp + 1 62 | end 63 | table.insert(arr, string.sub(input, pos)) 64 | return arr 65 | end 66 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 BluesDawn576 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BDbot 2 | ![license](https://img.shields.io/github/license/BluesDawn576/OPQBot-Plugins) 3 | ![status](https://img.shields.io/badge/status-停止维护-red) 4 | 5 | > 仓库已迁移(重构) -> [BDbot_Plugins](https://github.com/BluesDawn576/BDbot_Plugins) 6 | 7 | 『BDbot』个人插件仓库 8 | 9 | 本仓库内容需要借助[OPQbot](https://github.com/OPQBOT/OPQ)才能使用 10 | 11 | ### 目前已实现的功能(带\*表示已开源) 12 | 13 | #### 音游相关 14 | 15 | Arcaea查分 16 | 17 | Osu查分 (目前仅支持个人信息查询) 18 | 19 | \*bandori邦邦车站 ([BandoriStation](https://github.com/maborosh/BandoriStation)) `!ycm` 20 | 21 | #### minecraft相关 22 | 23 | \*自定义mc服务器查询 `!mc [地址]` 24 | 25 | MC群定制服务器查询(每群仅支持一个服务器) `查询服务器` 26 | 27 | \*检测minecraft (java)版本更新情况,并推送至指定群内(借助shell定时任务) 28 | 29 | 30 | #### 群内娱乐 31 | 32 | \*一言,随机一句话 `!一言` 33 | 34 | \*让bot决定你要做什么(支持多选项) `![选项1]还是[选项2]` 35 | 36 | 随机一张生草图 `!生草` 37 | 38 | \*答案之书 `!答案之书 [问题]` 39 | 40 | 41 | #### 气象查询 42 | 43 | \*最新气象云图查询 44 | 45 | + 风云二号 46 | + 真彩图 `!云图 fy2` 47 | + 西北太平洋云图 `!云图 fy2f` 48 | + 风云四号 49 | + 中国区真彩图 `!云图 fy4a` 50 | + 全圆盘真彩图 `!云图 fy4af` 51 | + 向日葵8号机动观测 `!云图 h8` 52 | 53 | \*当天降水量预报查询(24/48/72,缺省24)`!预报 [小时]` -------------------------------------------------------------------------------- /bandori.lua: -------------------------------------------------------------------------------- 1 | local log = require("log") 2 | local Api = require("coreApi") 3 | local json = require("json") 4 | local http = require("http") 5 | 6 | function ReceiveFriendMsg(CurrentQQ, data) 7 | return 1 8 | end 9 | 10 | function ReceiveGroupMsg(CurrentQQ, data) 11 | if data.FromUin ==2126622797 then--防止自我复读 12 | return 1 end 13 | if data.Content == "!邦邦车站" or data.Content == "!邦邦车站" or data.Content == "!有车吗" or data.Content == "!有车吗" or data.Content == "!ycm" or data.Content == "!ycm" then 14 | response, error_message = 15 | http.request( 16 | "GET", 17 | "https://api.bandoristation.com/?function=query_room_number" 18 | ) 19 | local bb = response.body 20 | local a6 = json.decode(bb) 21 | if a6.status == "success" then 22 | local count = table.getn(a6.response) 23 | local room = {} 24 | local time = os.time() 25 | for i=1,count,1 do 26 | room[i] = "["..time - math.floor(a6.response[i].time*0.001).."秒前] ("..a6.response[i].number..") "..a6.response[i].raw_message 27 | end 28 | local text = table.concat(room,"\n") 29 | if count ~= 0 then 30 | message = "当前邦邦车站有"..count.."辆车\n"..text 31 | else 32 | message = "myc" 33 | end 34 | 35 | else 36 | message = "错误:"..a6.response 37 | end 38 | SetMessage(CurrentQQ,data,message,data.FromUserId) 39 | end 40 | return 1 41 | end 42 | 43 | function ReceiveEvents(CurrentQQ, data, extData) 44 | return 1 45 | end 46 | 47 | function SetMessage(CurrentQQ,data,text,at) 48 | if at ~= 0 then 49 | luaMsg = 50 | Api.Api_SendMsg(--调用发消息的接口 51 | CurrentQQ, 52 | { 53 | toUser = data.FromGroupId, --回复当前消息的来源群ID 54 | sendToType = 2, --2发送给群1发送给好友3私聊 55 | sendMsgType = "TextMsg", --进行文本复读回复 56 | groupid = 0, --不是私聊自然就为0咯 57 | content = "[ATUSER("..at..")] "..text --回复内容 58 | } 59 | ) 60 | else 61 | luaMsg = 62 | Api.Api_SendMsg(--调用发消息的接口 63 | CurrentQQ, 64 | { 65 | toUser = data.FromGroupId, --回复当前消息的来源群ID 66 | sendToType = 2, --2发送给群1发送给好友3私聊 67 | sendMsgType = "TextMsg", --进行文本复读回复 68 | groupid = 0, --不是私聊自然就为0咯 69 | content = text --回复内容 70 | } 71 | ) 72 | end 73 | end -------------------------------------------------------------------------------- /hitokoto.lua: -------------------------------------------------------------------------------- 1 | local log = require("log") 2 | local Api = require("coreApi") 3 | local json = require("json") 4 | local http = require("http") 5 | 6 | function ReceiveFriendMsg(CurrentQQ, data) 7 | return 1 8 | end 9 | function ReceiveGroupMsg(CurrentQQ, data) 10 | if data.FromUin ==2126622797 then--防止自我复读 11 | return 1 end 12 | if (string.find(data.Content, "!一言") == 1 or string.find(data.Content, "!一言") == 1 or string.find(data.Content, "!hitokoto") == 1 or string.find(data.Content, "!hitokoto") == 1) then 13 | local text = nil 14 | response, error_message = 15 | http.request( 16 | "GET", 17 | "https://v1.hitokoto.cn/" 18 | ) 19 | local hitokoto = response.body 20 | local a = json.decode(hitokoto) 21 | if(a.from_who == nil) then 22 | from = "「" .. a.from .. "」" 23 | else 24 | from = a.from_who .. "「" .. a.from .. "」" 25 | end 26 | text = "『一言 hitokoto』\n" .. a.hitokoto .. "\n——" .. from 27 | ApiRet = 28 | Api.Api_SendMsg( 29 | CurrentQQ, 30 | { 31 | toUser = data.FromGroupId, 32 | sendToType = 2, 33 | sendMsgType = "TextMsg", 34 | groupid = 0, 35 | content = text, 36 | atUser = 0 37 | } 38 | ) 39 | text = nil 40 | end 41 | return 1 42 | end 43 | function ReceiveEvents(CurrentQQ, data, extData) 44 | return 1 45 | end 46 | -------------------------------------------------------------------------------- /mc-checker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #-------------------------------------------- 3 | # 检测minecraft(java)新版本 并向群内推送 4 | # author:BluesDawn576 5 | # date: 2020.08.11 6 | #-------------------------------------------- 7 | #检测mc新版本 sh脚本(需要OPQBot框架配合) 8 | #本脚本需要安装jq(不是jQuery) 否则将无法运行 9 | #本脚本支持单Q多群 多Q多群自行添加逻辑 10 | #改一下脚本路径就可以每小时执行了 具体其他时长写法请了解Cron表达式 11 | #添加定时计划 每小时执行 命令例:(echo "0 * * * * /home/pi/桌面/IOTQQ_3.0.0_linux_arm64/Time/time.sh" ;crontab -l) |crontab 12 | #或使用宝塔面板添加计划任务 任务类型为Shell脚本 13 | 14 | #填写你的机器人QQ号 15 | SelfQQ="" 16 | #发送群号 支持多群 多群 一个空格分开 17 | RevGroupArr=("114514" "1919810") 18 | #配置文件储存位置(建议在机器人目录,例如:/root/公共/OPQBot/Config/mc-checker.dat) 19 | datPath="" 20 | #端口号 你运行机器人的那个端口 21 | Post="8888" 22 | 23 | #检测文件是否存在 不存在将自动创建 24 | if [ ! -f "$datPath" ] ; then 25 | touch "$datPath" 26 | release="0.0" 27 | snapshot="0.0" 28 | else 29 | release=$(echo $(cat $datPath) | cut -d \, -f 1) 30 | snapshot=$(echo $(cat $datPath) | cut -d \, -f 2) 31 | fi 32 | 33 | str=$(curl -s http://launchermeta.mojang.com/mc/game/version_manifest.json) 34 | #解析json 需要安装jq 35 | Id=$(echo $str|jq -r '.versions[0].id') 36 | Type=$(echo $str|jq -r '.versions[0].type') 37 | Time=$(echo $str|jq -r '.versions[0].time') 38 | #判断类型 39 | if [ $Type = "release" ] ; then 40 | if [[ $release != $Id ]] ; then 41 | _type="正式版" 42 | isNew=true 43 | cat > $datPath << END_TEXT 44 | $Id,$snapshot 45 | END_TEXT 46 | fi 47 | elif [ $Type = "snapshot" ] ; then 48 | if [[ $snapshot != $Id ]] ; then 49 | _type="快照" 50 | isNew=true 51 | cat > $datPath << END_TEXT 52 | $release,$Id 53 | END_TEXT 54 | fi 55 | fi 56 | if [[ $isNew == true ]] ; then 57 | for i in "${!RevGroupArr[@]}"; do 58 | RevGroup=${RevGroupArr[$i]} 59 | curl "http://127.0.0.1:$Post/v1/LuaApiCaller?qq=$SelfQQ&funcname=SendMsg&timeout=10" -H 'Content-Type: application/json' --data-binary '{"toUser":'${RevGroup}',"sendToType":2,"sendMsgType":"TextMsg","content":"发现'$_type'更新: '$Id'\n时间: '$Time'","groupid":0,"atUser":0}' 60 | done 61 | fi 62 | -------------------------------------------------------------------------------- /mcFinder.lua: -------------------------------------------------------------------------------- 1 | local log = require("log") 2 | local Api = require("coreApi") 3 | local json = require("json") 4 | local http = require("http") 5 | 6 | function ReceiveFriendMsg(CurrentQQ, data) 7 | return 1 8 | end 9 | function ReceiveGroupMsg(CurrentQQ, data) 10 | if data.FromUin ==2126622797 then--防止自我复读 11 | return 1 end 12 | if (string.find(data.Content, "!mc") == 1 or string.find(data.Content, "!mc") == 1) then 13 | if(string.find(data.Content, "!") == 1) then 14 | key = data.Content:gsub("!mc", "") 15 | elseif(string.find(data.Content, "!") == 1) then 16 | key = data.Content:gsub("!mc", "") 17 | end 18 | local text = nil 19 | if(key ~= "") then 20 | response, error_message = 21 | http.request( 22 | "GET", 23 | "https://api.bluesdawn.top/minecraft/server/api?host=" .. key 24 | ) 25 | local mc = response.body 26 | local a = json.decode(mc) 27 | local _status = a.status 28 | if (_status == "Online") then 29 | if(a.version.version == nil) then 30 | ver = "未知" 31 | else 32 | ver = a.version.version 33 | end 34 | if(a.mods.type == nil) then 35 | text = "状态:在线\n人数:" ..a.players.online.. "/" ..a.players.max.. "\nMOTD:" ..a.motd.clean.text.. "\n版本:" ..ver.. "\nPing:" ..a.queryinfo.processed.. "" 36 | else 37 | text = "状态:在线\n人数:" ..a.players.online.. "/" ..a.players.max.. "\nMOTD:" ..a.motd.clean.text.. "\n版本:" ..ver.. "\nPing:" ..a.queryinfo.processed.. "\n(此服务器为mod服,拥有" ..table.getn(a.mods.modList).. "个模组)" 38 | end 39 | else 40 | text = "连接超时或离线" 41 | end 42 | else 43 | text = "你查了个寂寞\n!mc [欲查询的服务器地址]" 44 | end 45 | ApiRet = 46 | Api.Api_SendMsg( 47 | CurrentQQ, 48 | { 49 | toUser = data.FromGroupId, 50 | sendToType = 2, 51 | sendMsgType = "TextMsg", 52 | groupid = 0, 53 | content = text, 54 | atUser = data.FromUserId 55 | } 56 | ) 57 | mc = nil 58 | a = nil 59 | ver = nil 60 | text = nil 61 | _status = nil 62 | end 63 | return 1 64 | end 65 | function ReceiveEvents(CurrentQQ, data, extData) 66 | return 1 67 | end -------------------------------------------------------------------------------- /weather.lua: -------------------------------------------------------------------------------- 1 | local log = require("log") 2 | local Api = require("coreApi") 3 | local json = require("json") 4 | local http = require("http") 5 | 6 | function ReceiveFriendMsg(CurrentQQ, data) 7 | return 1 8 | end 9 | function ReceiveGroupMsg(CurrentQQ, data) 10 | if data.FromUin ==2126622797 then--防止自我复读 11 | return 1 end 12 | 13 | if (string.find(data.Content, "!云图") == 1 or string.find(data.Content, "!云图") == 1) then 14 | if data.Content == "!云图" or data.Content == "!云图" then 15 | url = "https://i.tq121.com.cn/i/weather2015/index/tianqiyubao.png" 16 | text = "『BDbot』现已支持的云图\n风云二号全国云图: !云图 fy2\n风云二号西北太平洋云图: !云图 fy2f\n风云四号全国云图: !云图 fy4a\n风云四号全圆盘云图: !云图\n向日葵8号机动观测:!云图 h8" 17 | elseif data.Content == "!云图 fy2" or data.Content == "!云图 fy2" or data.Content == "!云图fy2" then 18 | Time = os.date('!%Y%m%d') 19 | Hour = os.date('!%H') 20 | if(tonumber(os.date('!%M')) < 30) then 21 | Hour = string.format("%02d",Hour - 1) 22 | end 23 | 24 | if(tonumber(os.date('%H')) == 1 and tonumber(os.date('%H')) == 2) then 25 | Hour = "16" 26 | end 27 | --url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nsmc_wxcl_asc_e99_achn_lno_py_" ..Time..Hour.. "1500000.jpg" --中国天气源 28 | url = "http://img.nsmc.org.cn/CLOUDIMAGE/FY2/WXCL/SEVP_NSMC_WXCL_ASC_E99_ACHN_LNO_PY_" ..Time..Hour.. "1500000.jpg" --中国气象局源 29 | text = "" 30 | elseif data.Content == "!云图 fy2f" or data.Content == "!云图 fy2f" or data.Content == "!云图fy2f" or data.Content == "!云图fy2f" then 31 | url = "http://img.nsmc.org.cn/CLOUDIMAGE/FY2F/REG/FY2F_SEC_IR1_PA5_YYYYMMDD_HHmm.jpg" --国家卫星气象中心源 32 | text = "" 33 | elseif data.Content == "!云图 fy4a" or data.Content == "!云图 fy4a" or data.Content == "!云图fy4a" or data.Content == "!云图fy4a" then 34 | url = "http://img.nsmc.org.cn/CLOUDIMAGE/FY4A/MTCC/FY4A_CHINA.JPG" --国家卫星气象中心源 35 | text = "" 36 | elseif data.Content == "!云图 fy4af" or data.Content == "!云图 fy4af" or data.Content == "!云图fy4af" or data.Content == "!云图fy4af" then 37 | url = "http://img.nsmc.org.cn/CLOUDIMAGE/FY4A/MTCC/FY4A_DISK.JPG" --国家卫星气象中心源 38 | text = "" 39 | elseif data.Content == "!云图 h8" or data.Content == "!云图 h8" or data.Content == "!云图h8" or data.Content == "!云图h8" then 40 | if tonumber(os.date('%H')) > 7 and tonumber(os.date('%H')) < 17 then --根据主机时区适当修改,需要确保日本时间为白天,不然返回一片黑( 41 | url = "https://weather-models.info/latest/nocache/himawari/target/vis0.png" --WeatherModels源 真彩色 42 | else 43 | url = "https://weather-models.info/latest/nocache/himawari/target/bd0.png" --WeatherModels源 红外 44 | end 45 | text = "" 46 | else 47 | url = "https://i.tq121.com.cn/i/weather2015/index/tianqiyubao.png" 48 | text = "没有此类云图" 49 | end 50 | elseif (string.find(data.Content, "!预报") == 1 or string.find(data.Content, "!预报") == 1) then 51 | if(string.find(data.Content, "!") == 1) then 52 | key = data.Content:gsub("!预报", "") 53 | elseif(string.find(data.Content, "!") == 1) then 54 | key = data.Content:gsub("!预报", "") 55 | end 56 | Time = os.date('%Y%m%d') 57 | text = "" 58 | if(key == "24" or key == " 24" or key == "") then 59 | if(tonumber(os.date('%H')) >= 0 and tonumber(os.date('%H')) <= 6) then 60 | url = "https://i.tq121.com.cn/i/weather2015/index/tianqiyubao.png" 61 | text = "今日还没有24小时降水量预报图,请7点后再试" 62 | elseif(tonumber(os.date('%H')) > 6 and tonumber(os.date('%H')) <= 10) then 63 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "000002400.jpg" 64 | elseif(tonumber(os.date('%H')) > 10 and tonumber(os.date('%H')) <= 18) then 65 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "060002400.jpg" 66 | elseif(tonumber(os.date('%H')) > 18) then 67 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "120002400.jpg" 68 | end 69 | elseif(key == "48" or key == " 48") then 70 | if(tonumber(os.date('%H')) >= 0 and tonumber(os.date('%H')) <= 6) then 71 | url = "https://i.tq121.com.cn/i/weather2015/index/tianqiyubao.png" 72 | text = "今日还没有48小时降水量预报图,请7点后再试" 73 | elseif(tonumber(os.date('%H')) > 6 and tonumber(os.date('%H')) <= 18) then 74 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "000004800.jpg" 75 | elseif(tonumber(os.date('%H')) > 18) then 76 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "120004800.jpg" 77 | end 78 | elseif(key == "72" or key == " 72") then 79 | if(tonumber(os.date('%H')) >= 0 and tonumber(os.date('%H')) <= 6) then 80 | url = "https://i.tq121.com.cn/i/weather2015/index/tianqiyubao.png" 81 | text = "今日还没有72小时降水量预报图,请7点后再试" 82 | elseif(tonumber(os.date('%H')) > 6 and tonumber(os.date('%H')) <= 18) then 83 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "000007200.jpg" 84 | elseif(tonumber(os.date('%H')) > 18) then 85 | url = "http://pi.weather.com.cn/i/product/pic/l/sevp_nmc_stfc_sfer_er24_achn_l88_p9_" ..Time.. "120007200.jpg" 86 | end 87 | else 88 | url = "https://i.tq121.com.cn/i/weather2015/index/tianqiyubao.png" 89 | text = "你输入的时长不正确\n!预报 [24/48/72] (缺省24)" 90 | end 91 | else 92 | return 1 93 | end 94 | luaRes = 95 | Api.Api_SendMsg(--调用发消息的接口 96 | CurrentQQ, 97 | { 98 | toUser = data.FromGroupId, --回复当前消息的来源群ID 99 | sendToType = 2, --2发送给群1发送给好友3私聊 100 | sendMsgType = "PicMsg", --进行文本复读回复 101 | content = text, 102 | picUrl = url, 103 | picBase64Buf = "", 104 | fileMd5 = "" 105 | } 106 | ) 107 | Time=nil 108 | Hour=nil 109 | key=nil 110 | url=nil 111 | text=nil 112 | return 1 113 | end 114 | function ReceiveEvents(CurrentQQ, data, extData) 115 | return 1 116 | end --------------------------------------------------------------------------------