forked from apricitykin/useless-shit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeleteNoMore.js
1 lines (1 loc) · 2.28 KB
/
DeleteNoMore.js
1
function y(e){window.enmity.plugins.registerPlugin(e)}function f(e,o){return window.enmity.modules.getModule(e,o)}function i(...e){return window.enmity.modules.getByProps(...e)}window.enmity.modules.common;function D(e){return window.enmity.patcher.create(e)}var h="DeleteNoMore",w="666",M='idk why not seeing those messages"',v=[{name:"felix maybe",id:"499287211381096458"}],N="#ff0069",E="https://raw.githubusercontent.com/FelixDev754/Useful-Things-discord-etc.-/main/DeleteNoMore.js",S={name:h,version:w,description:M,authors:v,color:N,sourceUrl:E};function a(e){return window.enmity.assets.getIDByName(e)}const l=D("DeleteNoMore"),r=f(e=>e.open!==void 0&&e.close!==void 0&&!e.openLazy&&!e.startDrag&&!e.init&&!e.openReplay&&!e.openChannelCallPopout),A={...S,patches:[],onStart(){i("_currentDispatchActionType","_subscriptions","_waitQueue");let e=0,o=3;const d=()=>{try{e++;const u=i("getMessage","getMessages"),g=i("getChannel","getDMFromUserId"),c=i("_currentDispatchActionType","_subscriptions","_waitQueue");console.log(`Attempt ${e}/${o}.`),r.open({content:`Attempt ${e}/${o}.`,source:a("ic_staff_guild_icon_blurple")});const m=c._orderedActionHandlers.MESSAGE_DELETE.find(s=>s.name==="MessageStore"),p=c._orderedActionHandlers.MESSAGE_UPDATE.find(s=>s.name==="MessageStore");l.before(m,"actionHandler",(s,t)=>{const n=u.getMessage(t[0].channelId,t[0].id);if(t[0]={},!n.editedTimestamp||n.editedTimestamp._isValid){const _={type:"MESSAGE_UPDATE",message:{...n,edited_timestamp:"invalid_timestamp",content:n.content+" `[deleted]`",guild_id:g.getChannel(n.channel_id).guild_id}};c.dispatch(_)}}),l.before(p,"actionHandler",(s,t)=>{try{const n=u.getMessage(t[0].message.channel_id,t[0].message.id);try{if(!t[0].edited_timestamp._isValid)return}catch{}t[0].message.content=n.content+" `[edited]`\n"+t[0].message.content;return}catch{}}),console.log("Start successful."),r.open({content:"Start succesfull.",source:a("Check")})}catch{e<o?(console.warn(`Plugin failed to start. Trying again in ${e}0s.`),r.open({content:`Plugin failed to start. trying again in ${e}0s.`,source:a("ic_message_retry")}),setTimeout(d,e*1e4)):(console.error("Plugin failed to start, try restarting app."),r.open({content:"Plugin failed to start, try restarting app.",source:a("Small")}))}};setTimeout(()=>{d()},300)},onStop(){l.unpatchAll()}};y(A);