MCPcopy Create free account
hub / github.com/Semporia/Scripts / getAwardInviteFriend

Function getAwardInviteFriend

jd_fruit.js:790–818  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

788}
789//
790async function getAwardInviteFriend() {
791 await friendListInitForFarm();//查询好友列表
792 // console.log(`查询好友列表数据:${JSON.stringify($.friendList)}\n`)
793 if ($.friendList) {
794 console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`);
795 console.log(`开始删除${$.friendList.friends && $.friendList.friends.length}个好友,可拿每天的邀请奖励`);
796 if ($.friendList.friends && $.friendList.friends.length > 0) {
797 for (let friend of $.friendList.friends) {
798 console.log(`\n开始删除好友 [${friend.shareCode}]`);
799 const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 });
800 if (deleteFriendForFarm && deleteFriendForFarm.code === '0') {
801 console.log(`删除好友 [${friend.shareCode}] 成功\n`);
802 }
803 }
804 }
805 await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友
806 if ($.friendList.inviteFriendCount > 0) {
807 if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) {
808 console.log('开始领取邀请好友的奖励');
809 await awardInviteFriendForFarm();
810 console.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`);
811 }
812 } else {
813 console.log('今日未邀请过好友')
814 }
815 } else {
816 console.log(`查询好友列表失败\n`);
817 }
818}
819//给好友浇水
820async function doFriendsWater() {
821 await friendListInitForFarm();

Callers 1

doDailyTaskFunction · 0.85

Calls 5

friendListInitForFarmFunction · 0.85
receiveFriendInviteFunction · 0.85
awardInviteFriendForFarmFunction · 0.85
requestFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected