1 line
1.9 KiB
JavaScript
1 line
1.9 KiB
JavaScript
(function(s,u,o){"use strict";function p(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function h(a,n){for(var e=0;e<n.length;e++){var t=n[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function v(a,n,e){return n&&h(a.prototype,n),e&&h(a,e),a}const y=o.findByProps("show","confirm","close"),w=o.findByProps("addRelationship"),m=o.findByProps("handleStartCall"),$=o.findByProps("hideActionSheet"),b=o.findByStoreName("UserStore");var g=new(function(){function a(){p(this,a)}return v(a,[{key:"onLoad",value:function(){var n=this;this.patches.push(u.patcher.instead("handleStartCall",m,function(e,t){const[{rawRecipients:[{username:i,discriminator:c},r]},f]=e,l=f?"video call":"call";y.show({title:r?`Start a group ${l}?`:`Start a ${l} with ${i}#${c}?`,body:r?"Are you sure you want to start the group call?":`Are you sure you want to ${l} ${i}#${c}?`,confirmText:"Yes",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){try{t(...e)}catch(d){u.logger.error("Failed to start call",d)}}})})),this.patches.push(u.patcher.instead("addRelationship",w,function(e,t){if(typeof e[0]!="object"||!e[0].userId)return t.apply(n,e);const{username:i,discriminator:c}=b.getUser(e[0].userId),r=setInterval(function(){return $.hideActionSheet()},100);setTimeout(function(){return clearInterval(r)},3e3);const f=e[0].type===2;return new Promise(function(l){y.show({title:`${f?"Block":"Friend"} ${i}#${c}?`,body:`Are you sure you want to ${f?"block":"friend"} ${i}#${c}?`,confirmText:"Yes",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){try{l(t.apply(n,e))}catch(d){u.logger.error("Failed to add relationship",d)}finally{clearInterval(r)}},onCancel:function(){return void clearInterval(r)}})})}))}},{key:"onUnload",value:function(){for(const n of this.patches)n()}}]),a}());return s.default=g,Object.defineProperty(s,"__esModule",{value:!0}),s})({},vendetta,vendetta.metro);
|