@@ -559,6 +559,77 @@ namespace Cyan
559559 return result;
560560 }
561561
562+ void MiraiBot::GroupFileRename (GID_t gid, const GroupFile& groupFile, const string& newName)
563+ {
564+ json data =
565+ {
566+ { " sessionKey" , sessionKey_ },
567+ { " target" , int64_t (gid) },
568+ { " id" , groupFile.Id },
569+ { " rename" , newName }
570+ };
571+
572+ auto res = http_client_.Post (" /groupFileRename" , data.dump (), " application/json;charset=UTF-8" );
573+ if (!res)
574+ throw std::runtime_error (" 网络错误" );
575+ if (res->status != 200 )
576+ throw std::runtime_error (" [mirai-api-http error]: " + res->body );
577+ json re_json = json::parse (res->body );
578+ int code = re_json[" code" ].get <int >();
579+ if (code != 0 )
580+ {
581+ string msg = re_json[" msg" ].get <string>();
582+ throw runtime_error (msg);
583+ }
584+ }
585+
586+ void MiraiBot::GroupFileMove (GID_t gid, const GroupFile& groupFile, const string& moveToPath)
587+ {
588+ json data =
589+ {
590+ { " sessionKey" , sessionKey_ },
591+ { " target" , int64_t (gid) },
592+ { " id" , groupFile.Id },
593+ { " movePath" , moveToPath }
594+ };
595+
596+ auto res = http_client_.Post (" /groupFileMove" , data.dump (), " application/json;charset=UTF-8" );
597+ if (!res)
598+ throw std::runtime_error (" 网络错误" );
599+ if (res->status != 200 )
600+ throw std::runtime_error (" [mirai-api-http error]: " + res->body );
601+ json re_json = json::parse (res->body );
602+ int code = re_json[" code" ].get <int >();
603+ if (code != 0 )
604+ {
605+ string msg = re_json[" msg" ].get <string>();
606+ throw runtime_error (msg);
607+ }
608+ }
609+
610+ void MiraiBot::GroupFileDelete (GID_t gid, const GroupFile& groupFile)
611+ {
612+ json data =
613+ {
614+ { " sessionKey" , sessionKey_ },
615+ { " target" , int64_t (gid) },
616+ { " id" , groupFile.Id }
617+ };
618+
619+ auto res = http_client_.Post (" /groupFileDelete" , data.dump (), " application/json;charset=UTF-8" );
620+ if (!res)
621+ throw std::runtime_error (" 网络错误" );
622+ if (res->status != 200 )
623+ throw std::runtime_error (" [mirai-api-http error]: " + res->body );
624+ json re_json = json::parse (res->body );
625+ int code = re_json[" code" ].get <int >();
626+ if (code != 0 )
627+ {
628+ string msg = re_json[" msg" ].get <string>();
629+ throw runtime_error (msg);
630+ }
631+ }
632+
562633 bool MiraiBot::MuteAll (GID_t target)
563634 {
564635 json data =
0 commit comments